// wait to fold the substs.
// Wrap this in a closure so we don't accidentally return from the outer function
- let res = (|| match *ty.kind() {
+ let res = match *ty.kind() {
// This is really important. While we *can* handle this, this has
// severe performance implications for large opaque types with
// late-bound regions. See `issue-88862` benchmark.
{
// Only normalize `impl Trait` outside of type inference, usually in codegen.
match self.param_env.reveal() {
- Reveal::UserFacing => ty.try_super_fold_with(self),
+ Reveal::UserFacing => ty.try_super_fold_with(self)?,
Reveal::All => {
let substs = substs.try_fold_with(self)?;
}
let folded_ty = ensure_sufficient_stack(|| self.try_fold_ty(concrete_ty));
self.anon_depth -= 1;
- folded_ty
+ folded_ty?
}
}
}
// `tcx.normalize_projection_ty` may normalize to a type that still has
// unevaluated consts, so keep normalizing here if that's the case.
if res != ty && res.has_type_flags(ty::TypeFlags::HAS_CT_PROJECTION) {
- Ok(res.try_super_fold_with(self)?)
+ res.try_super_fold_with(self)?
} else {
- Ok(res)
+ res
}
}
// `tcx.normalize_projection_ty` may normalize to a type that still has
// unevaluated consts, so keep normalizing here if that's the case.
if res != ty && res.has_type_flags(ty::TypeFlags::HAS_CT_PROJECTION) {
- Ok(res.try_super_fold_with(self)?)
+ res.try_super_fold_with(self)?
} else {
- Ok(res)
+ res
}
}
- _ => ty.try_super_fold_with(self),
- })()?;
+ _ => ty.try_super_fold_with(self)?,
+ };
self.cache.insert(ty, res);
Ok(res)