about summary refs log tree commit diff
path: root/compiler/rustc_hir_analysis
diff options
context:
space:
mode:
authordianne <diannes.gm@gmail.com>2025-08-13 01:02:13 -0700
committerdianne <diannes.gm@gmail.com>2025-08-13 01:38:22 -0700
commit8fc3938d9961568dfec38b10506f33fd9bc7c147 (patch)
treea6e4f51b31faad2c7ce7b0aef74e524b685c33fa /compiler/rustc_hir_analysis
parentbbf08d87eb92f618120b6517651588950780b3e4 (diff)
downloadrust-8fc3938d9961568dfec38b10506f33fd9bc7c147.tar.gz
rust-8fc3938d9961568dfec38b10506f33fd9bc7c147.zip
fix scope of `super let` bindings within `if let`
They now use the enclosing temporary scope as their scope, regardless of
which `ScopeData` was used to mark it.
Diffstat (limited to 'compiler/rustc_hir_analysis')
-rw-r--r--compiler/rustc_hir_analysis/src/check/region.rs8
1 files changed, 2 insertions, 6 deletions
diff --git a/compiler/rustc_hir_analysis/src/check/region.rs b/compiler/rustc_hir_analysis/src/check/region.rs
index f5770b7312d..2ba7ed46f92 100644
--- a/compiler/rustc_hir_analysis/src/check/region.rs
+++ b/compiler/rustc_hir_analysis/src/check/region.rs
@@ -490,12 +490,8 @@ fn resolve_local<'tcx>(
             //
             // Iterate up to the enclosing destruction scope to find the same scope that will also
             // be used for the result of the block itself.
-            while let Some(s) = visitor.cx.var_parent {
-                let parent = visitor.scope_tree.parent_map.get(&s).cloned();
-                if let Some(Scope { data: ScopeData::Destruction, .. }) = parent {
-                    break;
-                }
-                visitor.cx.var_parent = parent;
+            if let Some(inner_scope) = visitor.cx.var_parent {
+                (visitor.cx.var_parent, _) = visitor.scope_tree.default_temporary_scope(inner_scope)
             }
         }
     }