Use QuantifiedWhereClause in generic_predicates as well

Still far too much binder skipping going on; I find it hard to imagine
this is all correct, but the tests pass.
This commit is contained in:
Florian Diebold 2021-03-21 17:40:14 +01:00
parent 590c416359
commit 1d5c4a77fb
9 changed files with 28 additions and 37 deletions

View file

@ -581,7 +581,7 @@ impl HirDisplay for Ty {
.generic_predicates(id.parent)
.into_iter()
.map(|pred| pred.clone().subst(&substs))
.filter(|wc| match &wc {
.filter(|wc| match &wc.skip_binders() {
WhereClause::Implemented(tr) => tr.self_type_parameter() == self,
WhereClause::AliasEq(AliasEq {
alias: AliasTy::Projection(proj),
@ -590,15 +590,7 @@ impl HirDisplay for Ty {
_ => false,
})
.collect::<Vec<_>>();
write_bounds_like_dyn_trait_with_prefix(
"impl",
&bounds
.iter()
.cloned()
.map(crate::Binders::wrap_empty)
.collect::<Vec<_>>(),
f,
)?;
write_bounds_like_dyn_trait_with_prefix("impl", &bounds, f)?;
}
}
}