eagerly check for bound vars of predicates

This commit is contained in:
lcnr 2022-07-14 12:47:38 +02:00
parent 39a990d2f1
commit 864d2f3528
2 changed files with 8 additions and 0 deletions

View File

@ -448,6 +448,10 @@ impl<'a, 'tcx> TypeFolder<'tcx> for BoundVarReplacer<'a, 'tcx> {
_ => ct.super_fold_with(self),
}
}
fn fold_predicate(&mut self, p: ty::Predicate<'tcx>) -> ty::Predicate<'tcx> {
if p.has_vars_bound_at_or_above(self.current_index) { p.super_fold_with(self) } else { p }
}
}
impl<'tcx> TyCtxt<'tcx> {

View File

@ -756,6 +756,10 @@ impl<'tcx> TypeFolder<'tcx> for BoundVarReplacer<'_, 'tcx> {
_ => ct.super_fold_with(self),
}
}
fn fold_predicate(&mut self, p: ty::Predicate<'tcx>) -> ty::Predicate<'tcx> {
if p.has_vars_bound_at_or_above(self.current_index) { p.super_fold_with(self) } else { p }
}
}
// The inverse of `BoundVarReplacer`: replaces placeholders with the bound vars from which they came.