Skip to content

Commit f0c2097

Browse files
committed
add place mention for #[loop_match] scrutinee
1 parent 36bf31d commit f0c2097

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

compiler/rustc_mir_build/src/builder/expr/into.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -295,9 +295,11 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
295295
this.diverge_from(loop_block);
296296

297297
// Logic for `match`.
298-
let scrutinee_place_builder =
299-
unpack!(body_block = this.as_place_builder(body_block, scrutinee));
300298
let scrutinee_span = this.thir.exprs[scrutinee].span;
299+
let scrutinee_place_builder = unpack!(
300+
body_block = this.lower_scrutinee(body_block, scrutinee, scrutinee_span)
301+
);
302+
301303
let match_start_span = match_span.shrink_to_lo().to(scrutinee_span);
302304

303305
let mut patterns = Vec::with_capacity(arms.len());

compiler/rustc_mir_build/src/builder/matches/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
407407
}
408408

409409
/// Evaluate the scrutinee and add the PlaceMention for it.
410-
fn lower_scrutinee(
410+
pub(crate) fn lower_scrutinee(
411411
&mut self,
412412
mut block: BasicBlock,
413413
scrutinee_id: ExprId,

0 commit comments

Comments
 (0)