don't normalize wf predicates

this allows us to soundly use unnormalized projections for wf
This commit is contained in:
lcnr 2022-07-13 19:42:08 +02:00
parent 8d1fa7105b
commit f25cb83296
26 changed files with 226 additions and 102 deletions

View file

@ -351,4 +351,16 @@ impl<'cx, 'tcx> FallibleTypeFolder<'tcx> for QueryNormalizer<'cx, 'tcx> {
mir::ConstantKind::Val(_, _) => constant.try_super_fold_with(self)?,
})
}
#[inline]
fn try_fold_predicate(
&mut self,
p: ty::Predicate<'tcx>,
) -> Result<ty::Predicate<'tcx>, Self::Error> {
if p.allow_normalization() && needs_normalization(&p, self.param_env.reveal()) {
p.try_super_fold_with(self)
} else {
Ok(p)
}
}
}