Add an early-exit to `QueryNormalizer::fold_ty`

This commit is contained in:
Jonas Schievink 2020-01-28 00:52:21 +01:00
parent b181835a6b
commit 474d0e3371
1 changed files with 4 additions and 0 deletions

View File

@ -81,6 +81,10 @@ impl<'cx, 'tcx> TypeFolder<'tcx> for QueryNormalizer<'cx, 'tcx> {
}
fn fold_ty(&mut self, ty: Ty<'tcx>) -> Ty<'tcx> {
if !ty.has_projections() {
return ty;
}
let ty = ty.super_fold_with(self);
match ty.kind {
ty::Opaque(def_id, substs) if !substs.has_escaping_bound_vars() => {