about summary refs log tree commit diff
diff options
context:
space:
mode:
authorNicholas Nethercote <n.nethercote@gmail.com>2023-02-03 10:15:24 +1100
committerNicholas Nethercote <n.nethercote@gmail.com>2023-02-06 08:52:04 +1100
commitf08a3371b01f6d6b01bf351f28bf0fbba2bd1b87 (patch)
tree2744a1db2c031b8f8b9768dc4a3f2cde8c448c65
parentbac7628eae905b0c806788914c9b7ee9409983de (diff)
downloadrust-f08a3371b01f6d6b01bf351f28bf0fbba2bd1b87.tar.gz
rust-f08a3371b01f6d6b01bf351f28bf0fbba2bd1b87.zip
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.
-rw-r--r--compiler/rustc_infer/src/infer/mod.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/compiler/rustc_infer/src/infer/mod.rs b/compiler/rustc_infer/src/infer/mod.rs
index f39170bb291..14af720fca1 100644
--- a/compiler/rustc_infer/src/infer/mod.rs
+++ b/compiler/rustc_infer/src/infer/mod.rs
@@ -1389,8 +1389,8 @@ impl<'tcx> InferCtxt<'tcx> {
     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)