diff options
author | Laurențiu Nicola <[email protected]> | 2021-04-05 15:37:24 +0100 |
---|---|---|
committer | Laurențiu Nicola <[email protected]> | 2021-04-05 15:37:24 +0100 |
commit | aefcbf275804f558ab18e83bfc8869187713b4ad (patch) | |
tree | acce29c3d04b16434a3d031c8b0d698c7707dc97 /crates/hir_ty/src | |
parent | fab1c066464022613729a6d714dc83b7d698ece5 (diff) |
Pass interner to ProjectionTy::self_type_parameter
Diffstat (limited to 'crates/hir_ty/src')
-rw-r--r-- | crates/hir_ty/src/display.rs | 4 | ||||
-rw-r--r-- | crates/hir_ty/src/lib.rs | 6 | ||||
-rw-r--r-- | crates/hir_ty/src/traits.rs | 2 | ||||
-rw-r--r-- | crates/hir_ty/src/traits/chalk/mapping.rs | 2 |
4 files changed, 7 insertions, 7 deletions
diff --git a/crates/hir_ty/src/display.rs b/crates/hir_ty/src/display.rs index 5ff70c893..965476a05 100644 --- a/crates/hir_ty/src/display.rs +++ b/crates/hir_ty/src/display.rs | |||
@@ -251,7 +251,7 @@ impl HirDisplay for ProjectionTy { | |||
251 | } | 251 | } |
252 | 252 | ||
253 | let trait_ = f.db.trait_data(self.trait_(f.db)); | 253 | let trait_ = f.db.trait_data(self.trait_(f.db)); |
254 | let first_parameter = self.self_type_parameter().into_displayable( | 254 | let first_parameter = self.self_type_parameter(&Interner).into_displayable( |
255 | f.db, | 255 | f.db, |
256 | f.max_size, | 256 | f.max_size, |
257 | f.omit_verbose_types, | 257 | f.omit_verbose_types, |
@@ -602,7 +602,7 @@ impl HirDisplay for Ty { | |||
602 | WhereClause::AliasEq(AliasEq { | 602 | WhereClause::AliasEq(AliasEq { |
603 | alias: AliasTy::Projection(proj), | 603 | alias: AliasTy::Projection(proj), |
604 | ty: _, | 604 | ty: _, |
605 | }) => proj.self_type_parameter() == self, | 605 | }) => proj.self_type_parameter(&Interner) == self, |
606 | _ => false, | 606 | _ => false, |
607 | }) | 607 | }) |
608 | .collect::<Vec<_>>(); | 608 | .collect::<Vec<_>>(); |
diff --git a/crates/hir_ty/src/lib.rs b/crates/hir_ty/src/lib.rs index d1513df1f..80dd7aaca 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 { |
@@ -477,7 +477,7 @@ impl Ty { | |||
477 | WhereClause::AliasEq(AliasEq { | 477 | WhereClause::AliasEq(AliasEq { |
478 | alias: AliasTy::Projection(proj), | 478 | alias: AliasTy::Projection(proj), |
479 | ty: _, | 479 | ty: _, |
480 | }) => proj.self_type_parameter() == self, | 480 | }) => proj.self_type_parameter(&Interner) == self, |
481 | _ => false, | 481 | _ => false, |
482 | }) | 482 | }) |
483 | .collect_vec(); | 483 | .collect_vec(); |
diff --git a/crates/hir_ty/src/traits.rs b/crates/hir_ty/src/traits.rs index 66d600bfc..c8883485c 100644 --- a/crates/hir_ty/src/traits.rs +++ b/crates/hir_ty/src/traits.rs | |||
@@ -89,7 +89,7 @@ pub(crate) fn trait_solve_query( | |||
89 | .. | 89 | .. |
90 | })) = &goal.value.goal | 90 | })) = &goal.value.goal |
91 | { | 91 | { |
92 | if let TyKind::BoundVar(_) = projection_ty.self_type_parameter().kind(&Interner) { | 92 | if let TyKind::BoundVar(_) = projection_ty.self_type_parameter(&Interner).kind(&Interner) { |
93 | // Hack: don't ask Chalk to normalize with an unknown self type, it'll say that's impossible | 93 | // Hack: don't ask Chalk to normalize with an unknown self type, it'll say that's impossible |
94 | return Some(Solution::Ambig(Guidance::Unknown)); | 94 | return Some(Solution::Ambig(Guidance::Unknown)); |
95 | } | 95 | } |
diff --git a/crates/hir_ty/src/traits/chalk/mapping.rs b/crates/hir_ty/src/traits/chalk/mapping.rs index 59aaa5560..240f9d456 100644 --- a/crates/hir_ty/src/traits/chalk/mapping.rs +++ b/crates/hir_ty/src/traits/chalk/mapping.rs | |||
@@ -552,7 +552,7 @@ pub(super) fn generic_predicate_to_inline_bound( | |||
552 | Some(make_binders(rust_ir::InlineBound::TraitBound(trait_bound), pred.num_binders)) | 552 | Some(make_binders(rust_ir::InlineBound::TraitBound(trait_bound), pred.num_binders)) |
553 | } | 553 | } |
554 | WhereClause::AliasEq(AliasEq { alias: AliasTy::Projection(projection_ty), ty }) => { | 554 | WhereClause::AliasEq(AliasEq { alias: AliasTy::Projection(projection_ty), ty }) => { |
555 | if projection_ty.self_type_parameter() != &self_ty_shifted_in { | 555 | if projection_ty.self_type_parameter(&Interner) != &self_ty_shifted_in { |
556 | return None; | 556 | return None; |
557 | } | 557 | } |
558 | let trait_ = projection_ty.trait_(db); | 558 | let trait_ = projection_ty.trait_(db); |