aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir_ty/src/traits
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir_ty/src/traits')
-rw-r--r--crates/ra_hir_ty/src/traits/chalk.rs50
-rw-r--r--crates/ra_hir_ty/src/traits/chalk/interner.rs14
-rw-r--r--crates/ra_hir_ty/src/traits/chalk/mapping.rs40
3 files changed, 52 insertions, 52 deletions
diff --git a/crates/ra_hir_ty/src/traits/chalk.rs b/crates/ra_hir_ty/src/traits/chalk.rs
index 5b0f12a3c..61de3cc30 100644
--- a/crates/ra_hir_ty/src/traits/chalk.rs
+++ b/crates/ra_hir_ty/src/traits/chalk.rs
@@ -4,6 +4,7 @@ use std::sync::Arc;
4use log::debug; 4use log::debug;
5 5
6use chalk_ir::{fold::shift::Shift, GenericArg, TypeName}; 6use chalk_ir::{fold::shift::Shift, GenericArg, TypeName};
7use chalk_solve::rust_ir::{self, WellKnownTrait};
7 8
8use hir_def::{ 9use hir_def::{
9 lang_item::{lang_attr, LangItemTarget}, 10 lang_item::{lang_attr, LangItemTarget},
@@ -16,7 +17,6 @@ use crate::{
16 db::HirDatabase, display::HirDisplay, method_resolution::TyFingerprint, utils::generics, 17 db::HirDatabase, display::HirDisplay, method_resolution::TyFingerprint, utils::generics,
17 CallableDef, DebruijnIndex, GenericPredicate, Substs, Ty, TypeCtor, 18 CallableDef, DebruijnIndex, GenericPredicate, Substs, Ty, TypeCtor,
18}; 19};
19use chalk_rust_ir::WellKnownTrait;
20use mapping::{convert_where_clauses, generic_predicate_to_inline_bound, make_binders}; 20use mapping::{convert_where_clauses, generic_predicate_to_inline_bound, make_binders};
21 21
22pub use self::interner::*; 22pub use self::interner::*;
@@ -55,7 +55,7 @@ impl<'a> chalk_solve::RustIrDatabase<Interner> for ChalkContext<'a> {
55 fn fn_def_datum( 55 fn fn_def_datum(
56 &self, 56 &self,
57 fn_def_id: chalk_ir::FnDefId<Interner>, 57 fn_def_id: chalk_ir::FnDefId<Interner>,
58 ) -> Arc<chalk_rust_ir::FnDefDatum<Interner>> { 58 ) -> Arc<rust_ir::FnDefDatum<Interner>> {
59 self.db.fn_def_datum(self.krate, fn_def_id) 59 self.db.fn_def_datum(self.krate, fn_def_id)
60 } 60 }
61 61
@@ -112,7 +112,7 @@ impl<'a> chalk_solve::RustIrDatabase<Interner> for ChalkContext<'a> {
112 } 112 }
113 fn well_known_trait_id( 113 fn well_known_trait_id(
114 &self, 114 &self,
115 well_known_trait: chalk_rust_ir::WellKnownTrait, 115 well_known_trait: rust_ir::WellKnownTrait,
116 ) -> Option<chalk_ir::TraitId<Interner>> { 116 ) -> Option<chalk_ir::TraitId<Interner>> {
117 let lang_attr = lang_attr_from_well_known_trait(well_known_trait); 117 let lang_attr = lang_attr_from_well_known_trait(well_known_trait);
118 let lang_items = self.db.crate_lang_items(self.krate); 118 let lang_items = self.db.crate_lang_items(self.krate);
@@ -133,13 +133,13 @@ impl<'a> chalk_solve::RustIrDatabase<Interner> for ChalkContext<'a> {
133 fn opaque_ty_data( 133 fn opaque_ty_data(
134 &self, 134 &self,
135 _id: chalk_ir::OpaqueTyId<Interner>, 135 _id: chalk_ir::OpaqueTyId<Interner>,
136 ) -> Arc<chalk_rust_ir::OpaqueTyDatum<Interner>> { 136 ) -> Arc<rust_ir::OpaqueTyDatum<Interner>> {
137 unimplemented!() 137 unimplemented!()
138 } 138 }
139 139
140 fn force_impl_for( 140 fn force_impl_for(
141 &self, 141 &self,
142 _well_known: chalk_rust_ir::WellKnownTrait, 142 _well_known: rust_ir::WellKnownTrait,
143 _ty: &chalk_ir::TyData<Interner>, 143 _ty: &chalk_ir::TyData<Interner>,
144 ) -> Option<bool> { 144 ) -> Option<bool> {
145 // this method is mostly for rustc 145 // this method is mostly for rustc
@@ -150,6 +150,10 @@ impl<'a> chalk_solve::RustIrDatabase<Interner> for ChalkContext<'a> {
150 // FIXME: implement actual object safety 150 // FIXME: implement actual object safety
151 true 151 true
152 } 152 }
153
154 fn hidden_opaque_type(&self, _id: chalk_ir::OpaqueTyId<Interner>) -> chalk_ir::Ty<Interner> {
155 Ty::Unknown.to_chalk(self.db)
156 }
153} 157}
154 158
155pub(crate) fn program_clauses_for_chalk_env_query( 159pub(crate) fn program_clauses_for_chalk_env_query(
@@ -188,7 +192,7 @@ pub(crate) fn associated_ty_data_query(
188 .collect(); 192 .collect();
189 193
190 let where_clauses = convert_where_clauses(db, type_alias.into(), &bound_vars); 194 let where_clauses = convert_where_clauses(db, type_alias.into(), &bound_vars);
191 let bound_data = chalk_rust_ir::AssociatedTyDatumBound { bounds, where_clauses }; 195 let bound_data = rust_ir::AssociatedTyDatumBound { bounds, where_clauses };
192 let datum = AssociatedTyDatum { 196 let datum = AssociatedTyDatum {
193 trait_id: trait_.to_chalk(db), 197 trait_id: trait_.to_chalk(db),
194 id, 198 id,
@@ -209,7 +213,7 @@ pub(crate) fn trait_datum_query(
209 debug!("trait {:?} = {:?}", trait_id, trait_data.name); 213 debug!("trait {:?} = {:?}", trait_id, trait_data.name);
210 let generic_params = generics(db.upcast(), trait_.into()); 214 let generic_params = generics(db.upcast(), trait_.into());
211 let bound_vars = Substs::bound_vars(&generic_params, DebruijnIndex::INNERMOST); 215 let bound_vars = Substs::bound_vars(&generic_params, DebruijnIndex::INNERMOST);
212 let flags = chalk_rust_ir::TraitFlags { 216 let flags = rust_ir::TraitFlags {
213 auto: trait_data.auto, 217 auto: trait_data.auto,
214 upstream: trait_.lookup(db.upcast()).container.module(db.upcast()).krate != krate, 218 upstream: trait_.lookup(db.upcast()).container.module(db.upcast()).krate != krate,
215 non_enumerable: true, 219 non_enumerable: true,
@@ -221,7 +225,7 @@ pub(crate) fn trait_datum_query(
221 let where_clauses = convert_where_clauses(db, trait_.into(), &bound_vars); 225 let where_clauses = convert_where_clauses(db, trait_.into(), &bound_vars);
222 let associated_ty_ids = 226 let associated_ty_ids =
223 trait_data.associated_types().map(|type_alias| type_alias.to_chalk(db)).collect(); 227 trait_data.associated_types().map(|type_alias| type_alias.to_chalk(db)).collect();
224 let trait_datum_bound = chalk_rust_ir::TraitDatumBound { where_clauses }; 228 let trait_datum_bound = rust_ir::TraitDatumBound { where_clauses };
225 let well_known = 229 let well_known =
226 lang_attr(db.upcast(), trait_).and_then(|name| well_known_trait_from_lang_attr(&name)); 230 lang_attr(db.upcast(), trait_).and_then(|name| well_known_trait_from_lang_attr(&name));
227 let trait_datum = TraitDatum { 231 let trait_datum = TraitDatum {
@@ -271,12 +275,12 @@ pub(crate) fn struct_datum_query(
271 convert_where_clauses(db, generic_def, &bound_vars) 275 convert_where_clauses(db, generic_def, &bound_vars)
272 }) 276 })
273 .unwrap_or_else(Vec::new); 277 .unwrap_or_else(Vec::new);
274 let flags = chalk_rust_ir::AdtFlags { 278 let flags = rust_ir::AdtFlags {
275 upstream, 279 upstream,
276 // FIXME set fundamental flag correctly 280 // FIXME set fundamental flag correctly
277 fundamental: false, 281 fundamental: false,
278 }; 282 };
279 let struct_datum_bound = chalk_rust_ir::AdtDatumBound { 283 let struct_datum_bound = rust_ir::AdtDatumBound {
280 fields: Vec::new(), // FIXME add fields (only relevant for auto traits) 284 fields: Vec::new(), // FIXME add fields (only relevant for auto traits)
281 where_clauses, 285 where_clauses,
282 }; 286 };
@@ -316,9 +320,9 @@ fn impl_def_datum(
316 let bound_vars = Substs::bound_vars(&generic_params, DebruijnIndex::INNERMOST); 320 let bound_vars = Substs::bound_vars(&generic_params, DebruijnIndex::INNERMOST);
317 let trait_ = trait_ref.trait_; 321 let trait_ = trait_ref.trait_;
318 let impl_type = if impl_id.lookup(db.upcast()).container.module(db.upcast()).krate == krate { 322 let impl_type = if impl_id.lookup(db.upcast()).container.module(db.upcast()).krate == krate {
319 chalk_rust_ir::ImplType::Local 323 rust_ir::ImplType::Local
320 } else { 324 } else {
321 chalk_rust_ir::ImplType::External 325 rust_ir::ImplType::External
322 }; 326 };
323 let where_clauses = convert_where_clauses(db, impl_id.into(), &bound_vars); 327 let where_clauses = convert_where_clauses(db, impl_id.into(), &bound_vars);
324 let negative = impl_data.is_negative; 328 let negative = impl_data.is_negative;
@@ -331,13 +335,9 @@ fn impl_def_datum(
331 ); 335 );
332 let trait_ref = trait_ref.to_chalk(db); 336 let trait_ref = trait_ref.to_chalk(db);
333 337
334 let polarity = if negative { 338 let polarity = if negative { rust_ir::Polarity::Negative } else { rust_ir::Polarity::Positive };
335 chalk_rust_ir::Polarity::Negative
336 } else {
337 chalk_rust_ir::Polarity::Positive
338 };
339 339
340 let impl_datum_bound = chalk_rust_ir::ImplDatumBound { trait_ref, where_clauses }; 340 let impl_datum_bound = rust_ir::ImplDatumBound { trait_ref, where_clauses };
341 let trait_data = db.trait_data(trait_); 341 let trait_data = db.trait_data(trait_);
342 let associated_ty_value_ids = impl_data 342 let associated_ty_value_ids = impl_data
343 .items 343 .items
@@ -395,8 +395,8 @@ fn type_alias_associated_ty_value(
395 .associated_type_by_name(&type_alias_data.name) 395 .associated_type_by_name(&type_alias_data.name)
396 .expect("assoc ty value should not exist"); // validated when building the impl data as well 396 .expect("assoc ty value should not exist"); // validated when building the impl data as well
397 let ty = db.ty(type_alias.into()); 397 let ty = db.ty(type_alias.into());
398 let value_bound = chalk_rust_ir::AssociatedTyValueBound { ty: ty.value.to_chalk(db) }; 398 let value_bound = rust_ir::AssociatedTyValueBound { ty: ty.value.to_chalk(db) };
399 let value = chalk_rust_ir::AssociatedTyValue { 399 let value = rust_ir::AssociatedTyValue {
400 impl_id: Impl::ImplDef(impl_id).to_chalk(db), 400 impl_id: Impl::ImplDef(impl_id).to_chalk(db),
401 associated_ty_id: assoc_ty.to_chalk(db), 401 associated_ty_id: assoc_ty.to_chalk(db),
402 value: make_binders(value_bound, ty.num_binders), 402 value: make_binders(value_bound, ty.num_binders),
@@ -414,7 +414,7 @@ pub(crate) fn fn_def_datum_query(
414 let sig = db.callable_item_signature(callable_def); 414 let sig = db.callable_item_signature(callable_def);
415 let bound_vars = Substs::bound_vars(&generic_params, DebruijnIndex::INNERMOST); 415 let bound_vars = Substs::bound_vars(&generic_params, DebruijnIndex::INNERMOST);
416 let where_clauses = convert_where_clauses(db, callable_def.into(), &bound_vars); 416 let where_clauses = convert_where_clauses(db, callable_def.into(), &bound_vars);
417 let bound = chalk_rust_ir::FnDefDatumBound { 417 let bound = rust_ir::FnDefDatumBound {
418 // Note: Chalk doesn't actually use this information yet as far as I am aware, but we provide it anyway 418 // Note: Chalk doesn't actually use this information yet as far as I am aware, but we provide it anyway
419 argument_types: sig.value.params().iter().map(|ty| ty.clone().to_chalk(db)).collect(), 419 argument_types: sig.value.params().iter().map(|ty| ty.clone().to_chalk(db)).collect(),
420 return_type: sig.value.ret().clone().to_chalk(db), 420 return_type: sig.value.ret().clone().to_chalk(db),
@@ -460,14 +460,14 @@ impl From<crate::traits::GlobalImplId> for ImplId {
460 } 460 }
461} 461}
462 462
463impl From<chalk_rust_ir::AssociatedTyValueId<Interner>> for crate::traits::AssocTyValueId { 463impl From<rust_ir::AssociatedTyValueId<Interner>> for crate::traits::AssocTyValueId {
464 fn from(id: chalk_rust_ir::AssociatedTyValueId<Interner>) -> Self { 464 fn from(id: rust_ir::AssociatedTyValueId<Interner>) -> Self {
465 Self::from_intern_id(id.0) 465 Self::from_intern_id(id.0)
466 } 466 }
467} 467}
468 468
469impl From<crate::traits::AssocTyValueId> for chalk_rust_ir::AssociatedTyValueId<Interner> { 469impl From<crate::traits::AssocTyValueId> for rust_ir::AssociatedTyValueId<Interner> {
470 fn from(assoc_ty_value_id: crate::traits::AssocTyValueId) -> Self { 470 fn from(assoc_ty_value_id: crate::traits::AssocTyValueId) -> Self {
471 chalk_rust_ir::AssociatedTyValueId(assoc_ty_value_id.as_intern_id()) 471 rust_ir::AssociatedTyValueId(assoc_ty_value_id.as_intern_id())
472 } 472 }
473} 473}
diff --git a/crates/ra_hir_ty/src/traits/chalk/interner.rs b/crates/ra_hir_ty/src/traits/chalk/interner.rs
index 2a27f8ed8..e27074ba6 100644
--- a/crates/ra_hir_ty/src/traits/chalk/interner.rs
+++ b/crates/ra_hir_ty/src/traits/chalk/interner.rs
@@ -11,17 +11,17 @@ use std::{fmt, sync::Arc};
11pub struct Interner; 11pub struct Interner;
12 12
13pub type AssocTypeId = chalk_ir::AssocTypeId<Interner>; 13pub type AssocTypeId = chalk_ir::AssocTypeId<Interner>;
14pub type AssociatedTyDatum = chalk_rust_ir::AssociatedTyDatum<Interner>; 14pub type AssociatedTyDatum = chalk_solve::rust_ir::AssociatedTyDatum<Interner>;
15pub type TraitId = chalk_ir::TraitId<Interner>; 15pub type TraitId = chalk_ir::TraitId<Interner>;
16pub type TraitDatum = chalk_rust_ir::TraitDatum<Interner>; 16pub type TraitDatum = chalk_solve::rust_ir::TraitDatum<Interner>;
17pub type AdtId = chalk_ir::AdtId<Interner>; 17pub type AdtId = chalk_ir::AdtId<Interner>;
18pub type StructDatum = chalk_rust_ir::AdtDatum<Interner>; 18pub type StructDatum = chalk_solve::rust_ir::AdtDatum<Interner>;
19pub type ImplId = chalk_ir::ImplId<Interner>; 19pub type ImplId = chalk_ir::ImplId<Interner>;
20pub type ImplDatum = chalk_rust_ir::ImplDatum<Interner>; 20pub type ImplDatum = chalk_solve::rust_ir::ImplDatum<Interner>;
21pub type AssociatedTyValueId = chalk_rust_ir::AssociatedTyValueId<Interner>; 21pub type AssociatedTyValueId = chalk_solve::rust_ir::AssociatedTyValueId<Interner>;
22pub type AssociatedTyValue = chalk_rust_ir::AssociatedTyValue<Interner>; 22pub type AssociatedTyValue = chalk_solve::rust_ir::AssociatedTyValue<Interner>;
23pub type FnDefId = chalk_ir::FnDefId<Interner>; 23pub type FnDefId = chalk_ir::FnDefId<Interner>;
24pub type FnDefDatum = chalk_rust_ir::FnDefDatum<Interner>; 24pub type FnDefDatum = chalk_solve::rust_ir::FnDefDatum<Interner>;
25 25
26impl chalk_ir::interner::Interner for Interner { 26impl chalk_ir::interner::Interner for Interner {
27 type InternedType = Box<chalk_ir::TyData<Self>>; // FIXME use Arc? 27 type InternedType = Box<chalk_ir::TyData<Self>>; // FIXME use Arc?
diff --git a/crates/ra_hir_ty/src/traits/chalk/mapping.rs b/crates/ra_hir_ty/src/traits/chalk/mapping.rs
index 7082cb095..5f6daf842 100644
--- a/crates/ra_hir_ty/src/traits/chalk/mapping.rs
+++ b/crates/ra_hir_ty/src/traits/chalk/mapping.rs
@@ -7,6 +7,7 @@ use chalk_ir::{
7 cast::Cast, fold::shift::Shift, interner::HasInterner, PlaceholderIndex, Scalar, TypeName, 7 cast::Cast, fold::shift::Shift, interner::HasInterner, PlaceholderIndex, Scalar, TypeName,
8 UniverseIndex, 8 UniverseIndex,
9}; 9};
10use chalk_solve::rust_ir;
10 11
11use hir_def::{type_ref::Mutability, AssocContainerId, GenericDefId, Lookup, TypeAliasId}; 12use hir_def::{type_ref::Mutability, AssocContainerId, GenericDefId, Lookup, TypeAliasId};
12use ra_db::salsa::InternKey; 13use ra_db::salsa::InternKey;
@@ -106,7 +107,7 @@ impl ToChalk for Ty {
106 }) 107 })
107 } 108 }
108 chalk_ir::TyData::BoundVar(idx) => Ty::Bound(idx), 109 chalk_ir::TyData::BoundVar(idx) => Ty::Bound(idx),
109 chalk_ir::TyData::InferenceVar(_iv) => Ty::Unknown, 110 chalk_ir::TyData::InferenceVar(_iv, _kind) => Ty::Unknown,
110 chalk_ir::TyData::Dyn(where_clauses) => { 111 chalk_ir::TyData::Dyn(where_clauses) => {
111 assert_eq!(where_clauses.bounds.binders.len(&Interner), 1); 112 assert_eq!(where_clauses.bounds.binders.len(&Interner), 1);
112 let predicates = where_clauses 113 let predicates = where_clauses
@@ -232,12 +233,13 @@ impl ToChalk for TypeCtor {
232 let id = callable_def.to_chalk(db); 233 let id = callable_def.to_chalk(db);
233 TypeName::FnDef(id) 234 TypeName::FnDef(id)
234 } 235 }
236 TypeCtor::Never => TypeName::Never,
237
235 TypeCtor::Int(Uncertain::Unknown) 238 TypeCtor::Int(Uncertain::Unknown)
236 | TypeCtor::Float(Uncertain::Unknown) 239 | TypeCtor::Float(Uncertain::Unknown)
237 | TypeCtor::Adt(_) 240 | TypeCtor::Adt(_)
238 | TypeCtor::Array 241 | TypeCtor::Array
239 | TypeCtor::FnPtr { .. } 242 | TypeCtor::FnPtr { .. }
240 | TypeCtor::Never
241 | TypeCtor::Closure { .. } => { 243 | TypeCtor::Closure { .. } => {
242 // other TypeCtors get interned and turned into a chalk StructId 244 // other TypeCtors get interned and turned into a chalk StructId
243 let struct_id = db.intern_type_ctor(self).into(); 245 let struct_id = db.intern_type_ctor(self).into();
@@ -273,13 +275,14 @@ impl ToChalk for TypeCtor {
273 TypeName::Slice => TypeCtor::Slice, 275 TypeName::Slice => TypeCtor::Slice,
274 TypeName::Ref(mutability) => TypeCtor::Ref(from_chalk(db, mutability)), 276 TypeName::Ref(mutability) => TypeCtor::Ref(from_chalk(db, mutability)),
275 TypeName::Str => TypeCtor::Str, 277 TypeName::Str => TypeCtor::Str,
278 TypeName::Never => TypeCtor::Never,
276 279
277 TypeName::FnDef(fn_def_id) => { 280 TypeName::FnDef(fn_def_id) => {
278 let callable_def = from_chalk(db, fn_def_id); 281 let callable_def = from_chalk(db, fn_def_id);
279 TypeCtor::FnDef(callable_def) 282 TypeCtor::FnDef(callable_def)
280 } 283 }
281 284
282 TypeName::Error => { 285 TypeName::Array | TypeName::Error => {
283 // this should not be reached, since we don't represent TypeName::Error with TypeCtor 286 // this should not be reached, since we don't represent TypeName::Error with TypeCtor
284 unreachable!() 287 unreachable!()
285 } 288 }
@@ -508,7 +511,7 @@ where
508 511
509 fn to_chalk(self, db: &dyn HirDatabase) -> chalk_ir::Canonical<T::Chalk> { 512 fn to_chalk(self, db: &dyn HirDatabase) -> chalk_ir::Canonical<T::Chalk> {
510 let parameter = chalk_ir::CanonicalVarKind::new( 513 let parameter = chalk_ir::CanonicalVarKind::new(
511 chalk_ir::VariableKind::Ty, 514 chalk_ir::VariableKind::Ty(chalk_ir::TyKind::General),
512 chalk_ir::UniverseIndex::ROOT, 515 chalk_ir::UniverseIndex::ROOT,
513 ); 516 );
514 let value = self.value.to_chalk(db); 517 let value = self.value.to_chalk(db);
@@ -579,17 +582,17 @@ impl ToChalk for builtin::BuiltinImplData {
579 type Chalk = ImplDatum; 582 type Chalk = ImplDatum;
580 583
581 fn to_chalk(self, db: &dyn HirDatabase) -> ImplDatum { 584 fn to_chalk(self, db: &dyn HirDatabase) -> ImplDatum {
582 let impl_type = chalk_rust_ir::ImplType::External; 585 let impl_type = rust_ir::ImplType::External;
583 let where_clauses = self.where_clauses.into_iter().map(|w| w.to_chalk(db)).collect(); 586 let where_clauses = self.where_clauses.into_iter().map(|w| w.to_chalk(db)).collect();
584 587
585 let impl_datum_bound = 588 let impl_datum_bound =
586 chalk_rust_ir::ImplDatumBound { trait_ref: self.trait_ref.to_chalk(db), where_clauses }; 589 rust_ir::ImplDatumBound { trait_ref: self.trait_ref.to_chalk(db), where_clauses };
587 let associated_ty_value_ids = 590 let associated_ty_value_ids =
588 self.assoc_ty_values.into_iter().map(|v| v.to_chalk(db)).collect(); 591 self.assoc_ty_values.into_iter().map(|v| v.to_chalk(db)).collect();
589 chalk_rust_ir::ImplDatum { 592 rust_ir::ImplDatum {
590 binders: make_binders(impl_datum_bound, self.num_vars), 593 binders: make_binders(impl_datum_bound, self.num_vars),
591 impl_type, 594 impl_type,
592 polarity: chalk_rust_ir::Polarity::Positive, 595 polarity: rust_ir::Polarity::Positive,
593 associated_ty_value_ids, 596 associated_ty_value_ids,
594 } 597 }
595 } 598 }
@@ -604,9 +607,9 @@ impl ToChalk for builtin::BuiltinImplAssocTyValueData {
604 607
605 fn to_chalk(self, db: &dyn HirDatabase) -> AssociatedTyValue { 608 fn to_chalk(self, db: &dyn HirDatabase) -> AssociatedTyValue {
606 let ty = self.value.to_chalk(db); 609 let ty = self.value.to_chalk(db);
607 let value_bound = chalk_rust_ir::AssociatedTyValueBound { ty }; 610 let value_bound = rust_ir::AssociatedTyValueBound { ty };
608 611
609 chalk_rust_ir::AssociatedTyValue { 612 rust_ir::AssociatedTyValue {
610 associated_ty_id: self.assoc_ty_id.to_chalk(db), 613 associated_ty_id: self.assoc_ty_id.to_chalk(db),
611 impl_id: self.impl_.to_chalk(db), 614 impl_id: self.impl_.to_chalk(db),
612 value: make_binders(value_bound, self.num_vars), 615 value: make_binders(value_bound, self.num_vars),
@@ -628,7 +631,7 @@ where
628 chalk_ir::Binders::new( 631 chalk_ir::Binders::new(
629 chalk_ir::VariableKinds::from( 632 chalk_ir::VariableKinds::from(
630 &Interner, 633 &Interner,
631 std::iter::repeat(chalk_ir::VariableKind::Ty).take(num_vars), 634 std::iter::repeat(chalk_ir::VariableKind::Ty(chalk_ir::TyKind::General)).take(num_vars),
632 ), 635 ),
633 value, 636 value,
634 ) 637 )
@@ -655,7 +658,7 @@ pub(super) fn generic_predicate_to_inline_bound(
655 db: &dyn HirDatabase, 658 db: &dyn HirDatabase,
656 pred: &GenericPredicate, 659 pred: &GenericPredicate,
657 self_ty: &Ty, 660 self_ty: &Ty,
658) -> Option<chalk_rust_ir::InlineBound<Interner>> { 661) -> Option<rust_ir::InlineBound<Interner>> {
659 // An InlineBound is like a GenericPredicate, except the self type is left out. 662 // An InlineBound is like a GenericPredicate, except the self type is left out.
660 // We don't have a special type for this, but Chalk does. 663 // We don't have a special type for this, but Chalk does.
661 match pred { 664 match pred {
@@ -670,8 +673,8 @@ pub(super) fn generic_predicate_to_inline_bound(
670 .map(|ty| ty.clone().to_chalk(db).cast(&Interner)) 673 .map(|ty| ty.clone().to_chalk(db).cast(&Interner))
671 .collect(); 674 .collect();
672 let trait_bound = 675 let trait_bound =
673 chalk_rust_ir::TraitBound { trait_id: trait_ref.trait_.to_chalk(db), args_no_self }; 676 rust_ir::TraitBound { trait_id: trait_ref.trait_.to_chalk(db), args_no_self };
674 Some(chalk_rust_ir::InlineBound::TraitBound(trait_bound)) 677 Some(rust_ir::InlineBound::TraitBound(trait_bound))
675 } 678 }
676 GenericPredicate::Projection(proj) => { 679 GenericPredicate::Projection(proj) => {
677 if &proj.projection_ty.parameters[0] != self_ty { 680 if &proj.projection_ty.parameters[0] != self_ty {
@@ -685,16 +688,13 @@ pub(super) fn generic_predicate_to_inline_bound(
685 .iter() 688 .iter()
686 .map(|ty| ty.clone().to_chalk(db).cast(&Interner)) 689 .map(|ty| ty.clone().to_chalk(db).cast(&Interner))
687 .collect(); 690 .collect();
688 let alias_eq_bound = chalk_rust_ir::AliasEqBound { 691 let alias_eq_bound = rust_ir::AliasEqBound {
689 value: proj.ty.clone().to_chalk(db), 692 value: proj.ty.clone().to_chalk(db),
690 trait_bound: chalk_rust_ir::TraitBound { 693 trait_bound: rust_ir::TraitBound { trait_id: trait_.to_chalk(db), args_no_self },
691 trait_id: trait_.to_chalk(db),
692 args_no_self,
693 },
694 associated_ty_id: proj.projection_ty.associated_ty.to_chalk(db), 694 associated_ty_id: proj.projection_ty.associated_ty.to_chalk(db),
695 parameters: Vec::new(), // FIXME we don't support generic associated types yet 695 parameters: Vec::new(), // FIXME we don't support generic associated types yet
696 }; 696 };
697 Some(chalk_rust_ir::InlineBound::AliasEqBound(alias_eq_bound)) 697 Some(rust_ir::InlineBound::AliasEqBound(alias_eq_bound))
698 } 698 }
699 GenericPredicate::Error => None, 699 GenericPredicate::Error => None,
700 } 700 }