From a715948477cf4ebeec6510fedbf93be10a230f4c Mon Sep 17 00:00:00 2001 From: Michael Goulet Date: Tue, 23 Aug 2022 04:21:03 +0000 Subject: [PATCH] Normalize opaques with escaping bound vars in AssocTypeNormalizer --- compiler/rustc_trait_selection/src/traits/project.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/compiler/rustc_trait_selection/src/traits/project.rs b/compiler/rustc_trait_selection/src/traits/project.rs index aeaccffd5f5f7..2e346b9fa1c7a 100644 --- a/compiler/rustc_trait_selection/src/traits/project.rs +++ b/compiler/rustc_trait_selection/src/traits/project.rs @@ -494,15 +494,15 @@ impl<'a, 'b, 'tcx> TypeFolder<'tcx> for AssocTypeNormalizer<'a, 'b, 'tcx> { // to make sure we don't forget to fold the substs regardless. 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. - ty::Opaque(def_id, substs) if !substs.has_escaping_bound_vars() => { + ty::Opaque(def_id, substs) => { // Only normalize `impl Trait` outside of type inference, usually in codegen. match self.param_env.reveal() { Reveal::UserFacing => ty.super_fold_with(self), Reveal::All => { + // N.b. there is an assumption here all this code can handle + // escaping bound vars. + let recursion_limit = self.tcx().recursion_limit(); if !recursion_limit.value_within_limit(self.depth) { let obligation = Obligation::with_depth(