about summary refs log tree commit diff
path: root/compiler/rustc_mir_build
diff options
context:
space:
mode:
authorFolkert de Vries <folkert@folkertdev.nl>2025-08-01 16:15:21 +0200
committerFolkert de Vries <folkert@folkertdev.nl>2025-08-10 14:25:49 +0200
commit3e76b58453461a7ac04db4914caff584345d8448 (patch)
tree42e01485b3b56697d4a975eb4793a0bf888b0cf0 /compiler/rustc_mir_build
parent9916ce362f712b7aa91cd7576a5dcfc575ffd621 (diff)
downloadrust-3e76b58453461a7ac04db4914caff584345d8448.tar.gz
rust-3e76b58453461a7ac04db4914caff584345d8448.zip
add place mention for `#[loop_match]` scrutinee
Diffstat (limited to 'compiler/rustc_mir_build')
-rw-r--r--compiler/rustc_mir_build/src/builder/expr/into.rs6
-rw-r--r--compiler/rustc_mir_build/src/builder/matches/mod.rs2
2 files changed, 5 insertions, 3 deletions
diff --git a/compiler/rustc_mir_build/src/builder/expr/into.rs b/compiler/rustc_mir_build/src/builder/expr/into.rs
index ac87f671699..78bcc47d9d0 100644
--- a/compiler/rustc_mir_build/src/builder/expr/into.rs
+++ b/compiler/rustc_mir_build/src/builder/expr/into.rs
@@ -295,9 +295,11 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
                     this.diverge_from(loop_block);
 
                     // Logic for `match`.
-                    let scrutinee_place_builder =
-                        unpack!(body_block = this.as_place_builder(body_block, scrutinee));
                     let scrutinee_span = this.thir.exprs[scrutinee].span;
+                    let scrutinee_place_builder = unpack!(
+                        body_block = this.lower_scrutinee(body_block, scrutinee, scrutinee_span)
+                    );
+
                     let match_start_span = match_span.shrink_to_lo().to(scrutinee_span);
 
                     let mut patterns = Vec::with_capacity(arms.len());
diff --git a/compiler/rustc_mir_build/src/builder/matches/mod.rs b/compiler/rustc_mir_build/src/builder/matches/mod.rs
index 2c29b862841..e863f94af7e 100644
--- a/compiler/rustc_mir_build/src/builder/matches/mod.rs
+++ b/compiler/rustc_mir_build/src/builder/matches/mod.rs
@@ -407,7 +407,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
     }
 
     /// Evaluate the scrutinee and add the PlaceMention for it.
-    fn lower_scrutinee(
+    pub(crate) fn lower_scrutinee(
         &mut self,
         mut block: BasicBlock,
         scrutinee_id: ExprId,