mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 06:11:35 +00:00
Pass interner to ProjectionTy::self_type_parameter
This commit is contained in:
parent
fab1c06646
commit
aefcbf2758
4 changed files with 7 additions and 7 deletions
|
@ -251,7 +251,7 @@ impl HirDisplay for ProjectionTy {
|
||||||
}
|
}
|
||||||
|
|
||||||
let trait_ = f.db.trait_data(self.trait_(f.db));
|
let trait_ = f.db.trait_data(self.trait_(f.db));
|
||||||
let first_parameter = self.self_type_parameter().into_displayable(
|
let first_parameter = self.self_type_parameter(&Interner).into_displayable(
|
||||||
f.db,
|
f.db,
|
||||||
f.max_size,
|
f.max_size,
|
||||||
f.omit_verbose_types,
|
f.omit_verbose_types,
|
||||||
|
@ -602,7 +602,7 @@ impl HirDisplay for Ty {
|
||||||
WhereClause::AliasEq(AliasEq {
|
WhereClause::AliasEq(AliasEq {
|
||||||
alias: AliasTy::Projection(proj),
|
alias: AliasTy::Projection(proj),
|
||||||
ty: _,
|
ty: _,
|
||||||
}) => proj.self_type_parameter() == self,
|
}) => proj.self_type_parameter(&Interner) == self,
|
||||||
_ => false,
|
_ => false,
|
||||||
})
|
})
|
||||||
.collect::<Vec<_>>();
|
.collect::<Vec<_>>();
|
||||||
|
|
|
@ -78,8 +78,8 @@ impl ProjectionTy {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn self_type_parameter(&self) -> &Ty {
|
pub fn self_type_parameter(&self, interner: &Interner) -> &Ty {
|
||||||
&self.substitution.interned()[0].assert_ty_ref(&Interner)
|
&self.substitution.interned()[0].assert_ty_ref(interner)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn trait_(&self, db: &dyn HirDatabase) -> TraitId {
|
fn trait_(&self, db: &dyn HirDatabase) -> TraitId {
|
||||||
|
@ -477,7 +477,7 @@ impl Ty {
|
||||||
WhereClause::AliasEq(AliasEq {
|
WhereClause::AliasEq(AliasEq {
|
||||||
alias: AliasTy::Projection(proj),
|
alias: AliasTy::Projection(proj),
|
||||||
ty: _,
|
ty: _,
|
||||||
}) => proj.self_type_parameter() == self,
|
}) => proj.self_type_parameter(&Interner) == self,
|
||||||
_ => false,
|
_ => false,
|
||||||
})
|
})
|
||||||
.collect_vec();
|
.collect_vec();
|
||||||
|
|
|
@ -89,7 +89,7 @@ pub(crate) fn trait_solve_query(
|
||||||
..
|
..
|
||||||
})) = &goal.value.goal
|
})) = &goal.value.goal
|
||||||
{
|
{
|
||||||
if let TyKind::BoundVar(_) = projection_ty.self_type_parameter().kind(&Interner) {
|
if let TyKind::BoundVar(_) = projection_ty.self_type_parameter(&Interner).kind(&Interner) {
|
||||||
// Hack: don't ask Chalk to normalize with an unknown self type, it'll say that's impossible
|
// Hack: don't ask Chalk to normalize with an unknown self type, it'll say that's impossible
|
||||||
return Some(Solution::Ambig(Guidance::Unknown));
|
return Some(Solution::Ambig(Guidance::Unknown));
|
||||||
}
|
}
|
||||||
|
|
|
@ -552,7 +552,7 @@ pub(super) fn generic_predicate_to_inline_bound(
|
||||||
Some(make_binders(rust_ir::InlineBound::TraitBound(trait_bound), pred.num_binders))
|
Some(make_binders(rust_ir::InlineBound::TraitBound(trait_bound), pred.num_binders))
|
||||||
}
|
}
|
||||||
WhereClause::AliasEq(AliasEq { alias: AliasTy::Projection(projection_ty), ty }) => {
|
WhereClause::AliasEq(AliasEq { alias: AliasTy::Projection(projection_ty), ty }) => {
|
||||||
if projection_ty.self_type_parameter() != &self_ty_shifted_in {
|
if projection_ty.self_type_parameter(&Interner) != &self_ty_shifted_in {
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
let trait_ = projection_ty.trait_(db);
|
let trait_ = projection_ty.trait_(db);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue