From f08a3371b01f6d6b01bf351f28bf0fbba2bd1b87 Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Fri, 3 Feb 2023 10:15:24 +1100 Subject: [PATCH] Improve early bailout test in `resolve_vars_if_possible`. `!t.has_non_region_infer()` is the test used in `OpportunisticVarResolver`, and catches a few cases that `!t.needs_infer()` misses. --- compiler/rustc_infer/src/infer/mod.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/compiler/rustc_infer/src/infer/mod.rs b/compiler/rustc_infer/src/infer/mod.rs index f39170bb2916..14af720fca1f 100644 --- a/compiler/rustc_infer/src/infer/mod.rs +++ b/compiler/rustc_infer/src/infer/mod.rs @@ -1389,8 +1389,8 @@ pub fn resolve_vars_if_possible(&self, value: T) -> T where T: TypeFoldable<'tcx>, { - if !value.needs_infer() { - return value; // Avoid duplicated subst-folding. + if !value.has_non_region_infer() { + return value; } let mut r = resolve::OpportunisticVarResolver::new(self); value.fold_with(&mut r)