about summary refs log tree commit diff
path: root/compiler/rustc_infer/src
diff options
context:
space:
mode:
authorMichael Goulet <michael@errs.io>2025-06-28 20:46:46 +0000
committerMichael Goulet <michael@errs.io>2025-06-28 20:48:58 +0000
commited16ae851bdb840ab2e7776e343ef865bfcbb76d (patch)
treea2c5f146aee53d5b7dad5f8bc77d14b3c6633682 /compiler/rustc_infer/src
parentb63223c152212832ce37a109e26cc5f84c577532 (diff)
downloadrust-ed16ae851bdb840ab2e7776e343ef865bfcbb76d.tar.gz
rust-ed16ae851bdb840ab2e7776e343ef865bfcbb76d.zip
Do not freshen ReError
Diffstat (limited to 'compiler/rustc_infer/src')
-rw-r--r--compiler/rustc_infer/src/infer/freshen.rs9
1 files changed, 4 insertions, 5 deletions
diff --git a/compiler/rustc_infer/src/infer/freshen.rs b/compiler/rustc_infer/src/infer/freshen.rs
index cae674165f0..ddc0b116806 100644
--- a/compiler/rustc_infer/src/infer/freshen.rs
+++ b/compiler/rustc_infer/src/infer/freshen.rs
@@ -110,17 +110,16 @@ impl<'a, 'tcx> TypeFolder<TyCtxt<'tcx>> for TypeFreshener<'a, 'tcx> {
 
     fn fold_region(&mut self, r: ty::Region<'tcx>) -> ty::Region<'tcx> {
         match r.kind() {
-            ty::ReBound(..) => {
-                // leave bound regions alone
-                r
-            }
+            // Leave bound regions alone, since they affect selection via the leak check.
+            ty::ReBound(..) => r,
+            // Leave error regions alone, since they affect selection b/c of incompleteness.
+            ty::ReError(_) => r,
 
             ty::ReEarlyParam(..)
             | ty::ReLateParam(_)
             | ty::ReVar(_)
             | ty::RePlaceholder(..)
             | ty::ReStatic
-            | ty::ReError(_)
             | ty::ReErased => self.cx().lifetimes.re_erased,
         }
     }