aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_ty/src/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/hir_ty/src/lib.rs')
-rw-r--r--crates/hir_ty/src/lib.rs14
1 files changed, 8 insertions, 6 deletions
diff --git a/crates/hir_ty/src/lib.rs b/crates/hir_ty/src/lib.rs
index d1513df1f..adfdcaa37 100644
--- a/crates/hir_ty/src/lib.rs
+++ b/crates/hir_ty/src/lib.rs
@@ -78,8 +78,8 @@ impl ProjectionTy {
78 } 78 }
79 } 79 }
80 80
81 pub fn self_type_parameter(&self) -> &Ty { 81 pub fn self_type_parameter(&self, interner: &Interner) -> &Ty {
82 &self.substitution.interned()[0].assert_ty_ref(&Interner) 82 &self.substitution.interned()[0].assert_ty_ref(interner)
83 } 83 }
84 84
85 fn trait_(&self, db: &dyn HirDatabase) -> TraitId { 85 fn trait_(&self, db: &dyn HirDatabase) -> TraitId {
@@ -165,8 +165,8 @@ impl<T: TypeWalk> Binders<T> {
165} 165}
166 166
167impl TraitRef { 167impl TraitRef {
168 pub fn self_type_parameter(&self) -> &Ty { 168 pub fn self_type_parameter(&self, interner: &Interner) -> &Ty {
169 &self.substitution.at(&Interner, 0).assert_ty_ref(&Interner) 169 &self.substitution.at(interner, 0).assert_ty_ref(interner)
170 } 170 }
171 171
172 pub fn hir_trait_id(&self) -> TraitId { 172 pub fn hir_trait_id(&self) -> TraitId {
@@ -473,11 +473,13 @@ impl Ty {
473 .into_iter() 473 .into_iter()
474 .map(|pred| pred.clone().subst(&substs)) 474 .map(|pred| pred.clone().subst(&substs))
475 .filter(|wc| match &wc.skip_binders() { 475 .filter(|wc| match &wc.skip_binders() {
476 WhereClause::Implemented(tr) => tr.self_type_parameter() == self, 476 WhereClause::Implemented(tr) => {
477 tr.self_type_parameter(&Interner) == self
478 }
477 WhereClause::AliasEq(AliasEq { 479 WhereClause::AliasEq(AliasEq {
478 alias: AliasTy::Projection(proj), 480 alias: AliasTy::Projection(proj),
479 ty: _, 481 ty: _,
480 }) => proj.self_type_parameter() == self, 482 }) => proj.self_type_parameter(&Interner) == self,
481 _ => false, 483 _ => false,
482 }) 484 })
483 .collect_vec(); 485 .collect_vec();