Skip to content

Commit aefcbf2

Browse files
committed
Pass interner to ProjectionTy::self_type_parameter
1 parent fab1c06 commit aefcbf2

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

crates/hir_ty/src/display.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ impl HirDisplay for ProjectionTy {
251251
}
252252

253253
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(
255255
f.db,
256256
f.max_size,
257257
f.omit_verbose_types,
@@ -602,7 +602,7 @@ impl HirDisplay for Ty {
602602
WhereClause::AliasEq(AliasEq {
603603
alias: AliasTy::Projection(proj),
604604
ty: _,
605-
}) => proj.self_type_parameter() == self,
605+
}) => proj.self_type_parameter(&Interner) == self,
606606
_ => false,
607607
})
608608
.collect::<Vec<_>>();

crates/hir_ty/src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,8 @@ impl ProjectionTy {
7878
}
7979
}
8080

81-
pub fn self_type_parameter(&self) -> &Ty {
82-
&self.substitution.interned()[0].assert_ty_ref(&Interner)
81+
pub fn self_type_parameter(&self, interner: &Interner) -> &Ty {
82+
&self.substitution.interned()[0].assert_ty_ref(interner)
8383
}
8484

8585
fn trait_(&self, db: &dyn HirDatabase) -> TraitId {
@@ -477,7 +477,7 @@ impl Ty {
477477
WhereClause::AliasEq(AliasEq {
478478
alias: AliasTy::Projection(proj),
479479
ty: _,
480-
}) => proj.self_type_parameter() == self,
480+
}) => proj.self_type_parameter(&Interner) == self,
481481
_ => false,
482482
})
483483
.collect_vec();

crates/hir_ty/src/traits.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ pub(crate) fn trait_solve_query(
8989
..
9090
})) = &goal.value.goal
9191
{
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) {
9393
// Hack: don't ask Chalk to normalize with an unknown self type, it'll say that's impossible
9494
return Some(Solution::Ambig(Guidance::Unknown));
9595
}

crates/hir_ty/src/traits/chalk/mapping.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -552,7 +552,7 @@ pub(super) fn generic_predicate_to_inline_bound(
552552
Some(make_binders(rust_ir::InlineBound::TraitBound(trait_bound), pred.num_binders))
553553
}
554554
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 {
556556
return None;
557557
}
558558
let trait_ = projection_ty.trait_(db);

0 commit comments

Comments
 (0)