diff options
Diffstat (limited to 'crates/ra_hir')
-rw-r--r-- | crates/ra_hir/src/code_model.rs | 2 | ||||
-rw-r--r-- | crates/ra_hir/src/ty.rs | 13 | ||||
-rw-r--r-- | crates/ra_hir/src/ty/infer/path.rs | 39 | ||||
-rw-r--r-- | crates/ra_hir/src/ty/lower.rs | 14 | ||||
-rw-r--r-- | crates/ra_hir/src/ty/method_resolution.rs | 18 | ||||
-rw-r--r-- | crates/ra_hir/src/ty/traits/chalk.rs | 50 |
6 files changed, 68 insertions, 68 deletions
diff --git a/crates/ra_hir/src/code_model.rs b/crates/ra_hir/src/code_model.rs index 9578c20b0..7b5d78543 100644 --- a/crates/ra_hir/src/code_model.rs +++ b/crates/ra_hir/src/code_model.rs | |||
@@ -741,7 +741,7 @@ impl Trait { | |||
741 | } | 741 | } |
742 | 742 | ||
743 | pub fn trait_ref(self, db: &impl HirDatabase) -> TraitRef { | 743 | pub fn trait_ref(self, db: &impl HirDatabase) -> TraitRef { |
744 | TraitRef::for_trait(db, self) | 744 | TraitRef::for_trait(db, self.id) |
745 | } | 745 | } |
746 | 746 | ||
747 | pub fn is_auto(self, db: &impl DefDatabase) -> bool { | 747 | pub fn is_auto(self, db: &impl DefDatabase) -> bool { |
diff --git a/crates/ra_hir/src/ty.rs b/crates/ra_hir/src/ty.rs index 2a2dc26b4..3711068fa 100644 --- a/crates/ra_hir/src/ty.rs +++ b/crates/ra_hir/src/ty.rs | |||
@@ -26,7 +26,7 @@ use ra_db::{impl_intern_key, salsa}; | |||
26 | 26 | ||
27 | use crate::{ | 27 | use crate::{ |
28 | db::HirDatabase, expr::ExprId, util::make_mut_slice, Adt, Crate, FloatTy, IntTy, Mutability, | 28 | db::HirDatabase, expr::ExprId, util::make_mut_slice, Adt, Crate, FloatTy, IntTy, Mutability, |
29 | Name, Trait, Uncertain, | 29 | Name, Uncertain, |
30 | }; | 30 | }; |
31 | use display::{HirDisplay, HirFormatter}; | 31 | use display::{HirDisplay, HirFormatter}; |
32 | 32 | ||
@@ -445,7 +445,7 @@ impl Deref for Substs { | |||
445 | #[derive(Clone, PartialEq, Eq, Debug, Hash)] | 445 | #[derive(Clone, PartialEq, Eq, Debug, Hash)] |
446 | pub struct TraitRef { | 446 | pub struct TraitRef { |
447 | /// FIXME name? | 447 | /// FIXME name? |
448 | pub trait_: Trait, | 448 | pub trait_: TraitId, |
449 | pub substs: Substs, | 449 | pub substs: Substs, |
450 | } | 450 | } |
451 | 451 | ||
@@ -676,7 +676,7 @@ impl Ty { | |||
676 | } | 676 | } |
677 | 677 | ||
678 | /// If this is an `impl Trait` or `dyn Trait`, returns that trait. | 678 | /// If this is an `impl Trait` or `dyn Trait`, returns that trait. |
679 | pub fn inherent_trait(&self) -> Option<Trait> { | 679 | pub fn inherent_trait(&self) -> Option<TraitId> { |
680 | match self { | 680 | match self { |
681 | Ty::Dyn(predicates) | Ty::Opaque(predicates) => { | 681 | Ty::Dyn(predicates) | Ty::Opaque(predicates) => { |
682 | predicates.iter().find_map(|pred| match pred { | 682 | predicates.iter().find_map(|pred| match pred { |
@@ -988,7 +988,10 @@ impl HirDisplay for Ty { | |||
988 | write!( | 988 | write!( |
989 | f, | 989 | f, |
990 | "{}", | 990 | "{}", |
991 | trait_ref.trait_.name(f.db).unwrap_or_else(Name::missing) | 991 | f.db.trait_data(trait_ref.trait_) |
992 | .name | ||
993 | .clone() | ||
994 | .unwrap_or_else(Name::missing) | ||
992 | )?; | 995 | )?; |
993 | if trait_ref.substs.len() > 1 { | 996 | if trait_ref.substs.len() > 1 { |
994 | write!(f, "<")?; | 997 | write!(f, "<")?; |
@@ -1049,7 +1052,7 @@ impl TraitRef { | |||
1049 | } else { | 1052 | } else { |
1050 | write!(f, ": ")?; | 1053 | write!(f, ": ")?; |
1051 | } | 1054 | } |
1052 | write!(f, "{}", self.trait_.name(f.db).unwrap_or_else(Name::missing))?; | 1055 | write!(f, "{}", f.db.trait_data(self.trait_).name.clone().unwrap_or_else(Name::missing))?; |
1053 | if self.substs.len() > 1 { | 1056 | if self.substs.len() > 1 { |
1054 | write!(f, "<")?; | 1057 | write!(f, "<")?; |
1055 | f.write_joined(&self.substs[1..], ", ")?; | 1058 | f.write_joined(&self.substs[1..], ", ")?; |
diff --git a/crates/ra_hir/src/ty/infer/path.rs b/crates/ra_hir/src/ty/infer/path.rs index 6165eba4f..202fff4f3 100644 --- a/crates/ra_hir/src/ty/infer/path.rs +++ b/crates/ra_hir/src/ty/infer/path.rs | |||
@@ -143,24 +143,27 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> { | |||
143 | id: ExprOrPatId, | 143 | id: ExprOrPatId, |
144 | ) -> Option<(ValueNs, Option<Substs>)> { | 144 | ) -> Option<(ValueNs, Option<Substs>)> { |
145 | let trait_ = trait_ref.trait_; | 145 | let trait_ = trait_ref.trait_; |
146 | let item = trait_.items(self.db).iter().copied().find_map(|item| match item { | 146 | let item = |
147 | AssocItem::Function(func) => { | 147 | self.db.trait_data(trait_).items.iter().map(|(_name, id)| (*id).into()).find_map( |
148 | if segment.name == func.name(self.db) { | 148 | |item| match item { |
149 | Some(AssocItem::Function(func)) | 149 | AssocItem::Function(func) => { |
150 | } else { | 150 | if segment.name == func.name(self.db) { |
151 | None | 151 | Some(AssocItem::Function(func)) |
152 | } | 152 | } else { |
153 | } | 153 | None |
154 | } | ||
155 | } | ||
154 | 156 | ||
155 | AssocItem::Const(konst) => { | 157 | AssocItem::Const(konst) => { |
156 | if konst.name(self.db).map_or(false, |n| n == segment.name) { | 158 | if konst.name(self.db).map_or(false, |n| n == segment.name) { |
157 | Some(AssocItem::Const(konst)) | 159 | Some(AssocItem::Const(konst)) |
158 | } else { | 160 | } else { |
159 | None | 161 | None |
160 | } | 162 | } |
161 | } | 163 | } |
162 | AssocItem::TypeAlias(_) => None, | 164 | AssocItem::TypeAlias(_) => None, |
163 | })?; | 165 | }, |
166 | )?; | ||
164 | let def = match item { | 167 | let def = match item { |
165 | AssocItem::Function(f) => ValueNs::FunctionId(f.id), | 168 | AssocItem::Function(f) => ValueNs::FunctionId(f.id), |
166 | AssocItem::Const(c) => ValueNs::ConstId(c.id), | 169 | AssocItem::Const(c) => ValueNs::ConstId(c.id), |
@@ -212,7 +215,7 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> { | |||
212 | .fill_with_params() | 215 | .fill_with_params() |
213 | .build(); | 216 | .build(); |
214 | self.obligations.push(super::Obligation::Trait(TraitRef { | 217 | self.obligations.push(super::Obligation::Trait(TraitRef { |
215 | trait_: t, | 218 | trait_: t.id, |
216 | substs: trait_substs, | 219 | substs: trait_substs, |
217 | })); | 220 | })); |
218 | Some(substs) | 221 | Some(substs) |
diff --git a/crates/ra_hir/src/ty/lower.rs b/crates/ra_hir/src/ty/lower.rs index 805a73ff5..a7149614d 100644 --- a/crates/ra_hir/src/ty/lower.rs +++ b/crates/ra_hir/src/ty/lower.rs | |||
@@ -15,7 +15,7 @@ use hir_def::{ | |||
15 | resolver::{HasResolver, Resolver, TypeNs}, | 15 | resolver::{HasResolver, Resolver, TypeNs}, |
16 | type_ref::{TypeBound, TypeRef}, | 16 | type_ref::{TypeBound, TypeRef}, |
17 | AdtId, AstItemDef, EnumVariantId, FunctionId, GenericDefId, HasModule, LocalStructFieldId, | 17 | AdtId, AstItemDef, EnumVariantId, FunctionId, GenericDefId, HasModule, LocalStructFieldId, |
18 | Lookup, StructId, VariantId, | 18 | Lookup, StructId, TraitId, VariantId, |
19 | }; | 19 | }; |
20 | use ra_arena::map::ArenaMap; | 20 | use ra_arena::map::ArenaMap; |
21 | use ra_db::CrateId; | 21 | use ra_db::CrateId; |
@@ -172,7 +172,7 @@ impl Ty { | |||
172 | let segment = &remaining_segments[0]; | 172 | let segment = &remaining_segments[0]; |
173 | let associated_ty = associated_type_by_name_including_super_traits( | 173 | let associated_ty = associated_type_by_name_including_super_traits( |
174 | db, | 174 | db, |
175 | trait_ref.trait_.id, | 175 | trait_ref.trait_, |
176 | &segment.name, | 176 | &segment.name, |
177 | ); | 177 | ); |
178 | match associated_ty { | 178 | match associated_ty { |
@@ -263,7 +263,7 @@ impl Ty { | |||
263 | GenericPredicate::Implemented(tr) if tr.self_ty() == &self_ty => Some(tr.trait_), | 263 | GenericPredicate::Implemented(tr) if tr.self_ty() == &self_ty => Some(tr.trait_), |
264 | _ => None, | 264 | _ => None, |
265 | }); | 265 | }); |
266 | let traits = traits_from_env.flat_map(|t| all_super_traits(db, t.id)).map(Trait::from); | 266 | let traits = traits_from_env.flat_map(|t| all_super_traits(db, t)).map(Trait::from); |
267 | for t in traits { | 267 | for t in traits { |
268 | if let Some(associated_ty) = db.trait_data(t.id).associated_type_by_name(&segment.name) | 268 | if let Some(associated_ty) = db.trait_data(t.id).associated_type_by_name(&segment.name) |
269 | { | 269 | { |
@@ -423,7 +423,7 @@ impl TraitRef { | |||
423 | if let Some(self_ty) = explicit_self_ty { | 423 | if let Some(self_ty) = explicit_self_ty { |
424 | make_mut_slice(&mut substs.0)[0] = self_ty; | 424 | make_mut_slice(&mut substs.0)[0] = self_ty; |
425 | } | 425 | } |
426 | TraitRef { trait_: resolved, substs } | 426 | TraitRef { trait_: resolved.id, substs } |
427 | } | 427 | } |
428 | 428 | ||
429 | pub(crate) fn from_hir( | 429 | pub(crate) fn from_hir( |
@@ -450,8 +450,8 @@ impl TraitRef { | |||
450 | substs_from_path_segment(db, resolver, segment, Some(resolved.id.into()), !has_self_param) | 450 | substs_from_path_segment(db, resolver, segment, Some(resolved.id.into()), !has_self_param) |
451 | } | 451 | } |
452 | 452 | ||
453 | pub(crate) fn for_trait(db: &impl HirDatabase, trait_: Trait) -> TraitRef { | 453 | pub(crate) fn for_trait(db: &impl HirDatabase, trait_: TraitId) -> TraitRef { |
454 | let substs = Substs::identity(&db.generic_params(trait_.id.into())); | 454 | let substs = Substs::identity(&db.generic_params(trait_.into())); |
455 | TraitRef { trait_, substs } | 455 | TraitRef { trait_, substs } |
456 | } | 456 | } |
457 | 457 | ||
@@ -510,7 +510,7 @@ fn assoc_type_bindings_from_type_bound<'a>( | |||
510 | .flat_map(|args_and_bindings| args_and_bindings.bindings.iter()) | 510 | .flat_map(|args_and_bindings| args_and_bindings.bindings.iter()) |
511 | .map(move |(name, type_ref)| { | 511 | .map(move |(name, type_ref)| { |
512 | let associated_ty = | 512 | let associated_ty = |
513 | associated_type_by_name_including_super_traits(db, trait_ref.trait_.id, &name); | 513 | associated_type_by_name_including_super_traits(db, trait_ref.trait_, &name); |
514 | let associated_ty = match associated_ty { | 514 | let associated_ty = match associated_ty { |
515 | None => return GenericPredicate::Error, | 515 | None => return GenericPredicate::Error, |
516 | Some(t) => t, | 516 | Some(t) => t, |
diff --git a/crates/ra_hir/src/ty/method_resolution.rs b/crates/ra_hir/src/ty/method_resolution.rs index 9988570e8..f1bc638ee 100644 --- a/crates/ra_hir/src/ty/method_resolution.rs +++ b/crates/ra_hir/src/ty/method_resolution.rs | |||
@@ -68,7 +68,7 @@ impl CrateImplBlocks { | |||
68 | if let Some(tr) = | 68 | if let Some(tr) = |
69 | TraitRef::from_hir(db, &resolver, &trait_ref, Some(target_ty)) | 69 | TraitRef::from_hir(db, &resolver, &trait_ref, Some(target_ty)) |
70 | { | 70 | { |
71 | res.impls_by_trait.entry(tr.trait_.id).or_default().push(impl_id); | 71 | res.impls_by_trait.entry(tr.trait_).or_default().push(impl_id); |
72 | } | 72 | } |
73 | } | 73 | } |
74 | None => { | 74 | None => { |
@@ -249,13 +249,11 @@ fn iterate_trait_method_candidates<T>( | |||
249 | let traits_from_env = env | 249 | let traits_from_env = env |
250 | .trait_predicates_for_self_ty(&ty.value) | 250 | .trait_predicates_for_self_ty(&ty.value) |
251 | .map(|tr| tr.trait_) | 251 | .map(|tr| tr.trait_) |
252 | .flat_map(|t| all_super_traits(db, t.id)) | 252 | .flat_map(|t| all_super_traits(db, t)); |
253 | .map(Trait::from); | 253 | let traits = |
254 | let traits = inherent_trait | 254 | inherent_trait.chain(traits_from_env).chain(resolver.traits_in_scope(db).into_iter()); |
255 | .chain(traits_from_env) | ||
256 | .chain(resolver.traits_in_scope(db).into_iter().map(Trait::from)); | ||
257 | 'traits: for t in traits { | 255 | 'traits: for t in traits { |
258 | let data = db.trait_data(t.id); | 256 | let data = db.trait_data(t); |
259 | 257 | ||
260 | // we'll be lazy about checking whether the type implements the | 258 | // we'll be lazy about checking whether the type implements the |
261 | // trait, but if we find out it doesn't, we'll skip the rest of the | 259 | // trait, but if we find out it doesn't, we'll skip the rest of the |
@@ -330,7 +328,7 @@ pub(crate) fn implements_trait( | |||
330 | db: &impl HirDatabase, | 328 | db: &impl HirDatabase, |
331 | resolver: &Resolver, | 329 | resolver: &Resolver, |
332 | krate: Crate, | 330 | krate: Crate, |
333 | trait_: Trait, | 331 | trait_: TraitId, |
334 | ) -> bool { | 332 | ) -> bool { |
335 | if ty.value.inherent_trait() == Some(trait_) { | 333 | if ty.value.inherent_trait() == Some(trait_) { |
336 | // FIXME this is a bit of a hack, since Chalk should say the same thing | 334 | // FIXME this is a bit of a hack, since Chalk should say the same thing |
@@ -373,11 +371,11 @@ impl Ty { | |||
373 | fn generic_implements_goal( | 371 | fn generic_implements_goal( |
374 | db: &impl HirDatabase, | 372 | db: &impl HirDatabase, |
375 | env: Arc<TraitEnvironment>, | 373 | env: Arc<TraitEnvironment>, |
376 | trait_: Trait, | 374 | trait_: TraitId, |
377 | self_ty: Canonical<Ty>, | 375 | self_ty: Canonical<Ty>, |
378 | ) -> Canonical<InEnvironment<super::Obligation>> { | 376 | ) -> Canonical<InEnvironment<super::Obligation>> { |
379 | let num_vars = self_ty.num_vars; | 377 | let num_vars = self_ty.num_vars; |
380 | let substs = super::Substs::build_for_def(db, trait_.id) | 378 | let substs = super::Substs::build_for_def(db, trait_) |
381 | .push(self_ty.value) | 379 | .push(self_ty.value) |
382 | .fill_with_bound_vars(num_vars as u32) | 380 | .fill_with_bound_vars(num_vars as u32) |
383 | .build(); | 381 | .build(); |
diff --git a/crates/ra_hir/src/ty/traits/chalk.rs b/crates/ra_hir/src/ty/traits/chalk.rs index 78f4b3e27..02d37dead 100644 --- a/crates/ra_hir/src/ty/traits/chalk.rs +++ b/crates/ra_hir/src/ty/traits/chalk.rs | |||
@@ -9,7 +9,9 @@ use chalk_ir::{ | |||
9 | }; | 9 | }; |
10 | use chalk_rust_ir::{AssociatedTyDatum, AssociatedTyValue, ImplDatum, StructDatum, TraitDatum}; | 10 | use chalk_rust_ir::{AssociatedTyDatum, AssociatedTyValue, ImplDatum, StructDatum, TraitDatum}; |
11 | 11 | ||
12 | use hir_def::{lang_item::LangItemTarget, ContainerId, GenericDefId, Lookup, TraitId, TypeAliasId}; | 12 | use hir_def::{ |
13 | lang_item::LangItemTarget, AstItemDef, ContainerId, GenericDefId, Lookup, TraitId, TypeAliasId, | ||
14 | }; | ||
13 | use hir_expand::name; | 15 | use hir_expand::name; |
14 | 16 | ||
15 | use ra_db::salsa::{InternId, InternKey}; | 17 | use ra_db::salsa::{InternId, InternKey}; |
@@ -19,7 +21,7 @@ use crate::{ | |||
19 | db::HirDatabase, | 21 | db::HirDatabase, |
20 | ty::display::HirDisplay, | 22 | ty::display::HirDisplay, |
21 | ty::{ApplicationTy, GenericPredicate, ProjectionTy, Substs, TraitRef, Ty, TypeCtor, TypeWalk}, | 23 | ty::{ApplicationTy, GenericPredicate, ProjectionTy, Substs, TraitRef, Ty, TypeCtor, TypeWalk}, |
22 | Crate, ImplBlock, Trait, TypeAlias, | 24 | Crate, ImplBlock, TypeAlias, |
23 | }; | 25 | }; |
24 | 26 | ||
25 | /// This represents a trait whose name we could not resolve. | 27 | /// This represents a trait whose name we could not resolve. |
@@ -167,15 +169,15 @@ impl ToChalk for TraitRef { | |||
167 | } | 169 | } |
168 | } | 170 | } |
169 | 171 | ||
170 | impl ToChalk for Trait { | 172 | impl ToChalk for TraitId { |
171 | type Chalk = chalk_ir::TraitId; | 173 | type Chalk = chalk_ir::TraitId; |
172 | 174 | ||
173 | fn to_chalk(self, _db: &impl HirDatabase) -> chalk_ir::TraitId { | 175 | fn to_chalk(self, _db: &impl HirDatabase) -> chalk_ir::TraitId { |
174 | chalk_ir::TraitId(id_to_chalk(self.id)) | 176 | chalk_ir::TraitId(id_to_chalk(self)) |
175 | } | 177 | } |
176 | 178 | ||
177 | fn from_chalk(_db: &impl HirDatabase, trait_id: chalk_ir::TraitId) -> Trait { | 179 | fn from_chalk(_db: &impl HirDatabase, trait_id: chalk_ir::TraitId) -> TraitId { |
178 | Trait { id: id_from_chalk(trait_id.0) } | 180 | id_from_chalk(trait_id.0) |
179 | } | 181 | } |
180 | } | 182 | } |
181 | 183 | ||
@@ -443,10 +445,10 @@ where | |||
443 | if trait_id == UNKNOWN_TRAIT { | 445 | if trait_id == UNKNOWN_TRAIT { |
444 | return Vec::new(); | 446 | return Vec::new(); |
445 | } | 447 | } |
446 | let trait_: Trait = from_chalk(self.db, trait_id); | 448 | let trait_: TraitId = from_chalk(self.db, trait_id); |
447 | let mut result: Vec<_> = self | 449 | let mut result: Vec<_> = self |
448 | .db | 450 | .db |
449 | .impls_for_trait(self.krate, trait_) | 451 | .impls_for_trait(self.krate, trait_.into()) |
450 | .iter() | 452 | .iter() |
451 | .copied() | 453 | .copied() |
452 | .map(Impl::ImplBlock) | 454 | .map(Impl::ImplBlock) |
@@ -459,7 +461,7 @@ where | |||
459 | [super::FnTrait::FnOnce, super::FnTrait::FnMut, super::FnTrait::Fn].iter() | 461 | [super::FnTrait::FnOnce, super::FnTrait::FnMut, super::FnTrait::Fn].iter() |
460 | { | 462 | { |
461 | if let Some(actual_trait) = get_fn_trait(self.db, self.krate, fn_trait) { | 463 | if let Some(actual_trait) = get_fn_trait(self.db, self.krate, fn_trait) { |
462 | if trait_.id == actual_trait { | 464 | if trait_ == actual_trait { |
463 | let impl_ = super::ClosureFnTraitImplData { def, expr, fn_trait }; | 465 | let impl_ = super::ClosureFnTraitImplData { def, expr, fn_trait }; |
464 | result.push(Impl::ClosureFnTraitImpl(impl_).to_chalk(self.db)); | 466 | result.push(Impl::ClosureFnTraitImpl(impl_).to_chalk(self.db)); |
465 | } | 467 | } |
@@ -516,7 +518,7 @@ pub(crate) fn associated_ty_data_query( | |||
516 | where_clauses: vec![], | 518 | where_clauses: vec![], |
517 | }; | 519 | }; |
518 | let datum = AssociatedTyDatum { | 520 | let datum = AssociatedTyDatum { |
519 | trait_id: Trait::from(trait_).to_chalk(db), | 521 | trait_id: trait_.to_chalk(db), |
520 | id, | 522 | id, |
521 | name: lalrpop_intern::intern(&db.type_alias_data(type_alias).name.to_string()), | 523 | name: lalrpop_intern::intern(&db.type_alias_data(type_alias).name.to_string()), |
522 | binders: make_binders(bound_data, generic_params.count_params_including_parent()), | 524 | binders: make_binders(bound_data, generic_params.count_params_including_parent()), |
@@ -548,29 +550,23 @@ pub(crate) fn trait_datum_query( | |||
548 | associated_ty_ids: vec![], | 550 | associated_ty_ids: vec![], |
549 | }); | 551 | }); |
550 | } | 552 | } |
551 | let trait_: Trait = from_chalk(db, trait_id); | 553 | let trait_: TraitId = from_chalk(db, trait_id); |
552 | debug!("trait {:?} = {:?}", trait_id, trait_.name(db)); | 554 | let trait_data = db.trait_data(trait_); |
553 | let generic_params = db.generic_params(trait_.id.into()); | 555 | debug!("trait {:?} = {:?}", trait_id, trait_data.name); |
556 | let generic_params = db.generic_params(trait_.into()); | ||
554 | let bound_vars = Substs::bound_vars(&generic_params); | 557 | let bound_vars = Substs::bound_vars(&generic_params); |
555 | let flags = chalk_rust_ir::TraitFlags { | 558 | let flags = chalk_rust_ir::TraitFlags { |
556 | auto: trait_.is_auto(db), | 559 | auto: trait_data.auto, |
557 | upstream: trait_.module(db).krate() != krate, | 560 | upstream: trait_.module(db).krate != krate.crate_id, |
558 | non_enumerable: true, | 561 | non_enumerable: true, |
559 | coinductive: false, // only relevant for Chalk testing | 562 | coinductive: false, // only relevant for Chalk testing |
560 | // FIXME set these flags correctly | 563 | // FIXME set these flags correctly |
561 | marker: false, | 564 | marker: false, |
562 | fundamental: false, | 565 | fundamental: false, |
563 | }; | 566 | }; |
564 | let where_clauses = convert_where_clauses(db, trait_.id.into(), &bound_vars); | 567 | let where_clauses = convert_where_clauses(db, trait_.into(), &bound_vars); |
565 | let associated_ty_ids = trait_ | 568 | let associated_ty_ids = |
566 | .items(db) | 569 | trait_data.associated_types().map(|type_alias| type_alias.to_chalk(db)).collect(); |
567 | .into_iter() | ||
568 | .filter_map(|trait_item| match trait_item { | ||
569 | crate::AssocItem::TypeAlias(type_alias) => Some(type_alias.id), | ||
570 | _ => None, | ||
571 | }) | ||
572 | .map(|type_alias| type_alias.to_chalk(db)) | ||
573 | .collect(); | ||
574 | let trait_datum_bound = chalk_rust_ir::TraitDatumBound { where_clauses }; | 570 | let trait_datum_bound = chalk_rust_ir::TraitDatumBound { where_clauses }; |
575 | let trait_datum = TraitDatum { | 571 | let trait_datum = TraitDatum { |
576 | id: trait_id, | 572 | id: trait_id, |
@@ -661,7 +657,7 @@ fn impl_block_datum( | |||
661 | }; | 657 | }; |
662 | 658 | ||
663 | let impl_datum_bound = chalk_rust_ir::ImplDatumBound { trait_ref, where_clauses }; | 659 | let impl_datum_bound = chalk_rust_ir::ImplDatumBound { trait_ref, where_clauses }; |
664 | let trait_data = db.trait_data(trait_.id); | 660 | let trait_data = db.trait_data(trait_); |
665 | let associated_ty_value_ids = impl_block | 661 | let associated_ty_value_ids = impl_block |
666 | .items(db) | 662 | .items(db) |
667 | .into_iter() | 663 | .into_iter() |
@@ -785,7 +781,7 @@ fn type_alias_associated_ty_value( | |||
785 | .expect("assoc ty value should not exist") // we don't return any assoc ty values if the impl'd trait can't be resolved | 781 | .expect("assoc ty value should not exist") // we don't return any assoc ty values if the impl'd trait can't be resolved |
786 | .trait_; | 782 | .trait_; |
787 | let assoc_ty = db | 783 | let assoc_ty = db |
788 | .trait_data(trait_.id) | 784 | .trait_data(trait_) |
789 | .associated_type_by_name(&type_alias.name(db)) | 785 | .associated_type_by_name(&type_alias.name(db)) |
790 | .expect("assoc ty value should not exist"); // validated when building the impl data as well | 786 | .expect("assoc ty value should not exist"); // validated when building the impl data as well |
791 | let generic_params = db.generic_params(impl_block.id.into()); | 787 | let generic_params = db.generic_params(impl_block.id.into()); |