Skip to content

Commit 8d00f76

Browse files
committed
Unnest a variable in prep for the next commit which needs access to the place
1 parent 8006510 commit 8d00f76

File tree

1 file changed

+8
-5
lines changed
  • compiler/rustc_mir_build/src/build/matches

1 file changed

+8
-5
lines changed

compiler/rustc_mir_build/src/build/matches/test.rs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -387,11 +387,10 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
387387
make_target_blocks: impl FnOnce(&mut Self) -> Vec<BasicBlock>,
388388
source_info: SourceInfo,
389389
value: ConstantKind<'tcx>,
390-
place: Place<'tcx>,
390+
mut val: Place<'tcx>,
391391
mut ty: Ty<'tcx>,
392392
) {
393393
let mut expect = self.literal_operand(source_info.span, value);
394-
let mut val = Operand::Copy(place);
395394

396395
// If we're using `b"..."` as a pattern, we need to insert an
397396
// unsizing coercion, as the byte string has the type `&[u8; N]`.
@@ -421,9 +420,13 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
421420
block,
422421
source_info,
423422
temp,
424-
Rvalue::Cast(CastKind::Pointer(PointerCast::Unsize), val, ty),
423+
Rvalue::Cast(
424+
CastKind::Pointer(PointerCast::Unsize),
425+
Operand::Copy(val),
426+
ty,
427+
),
425428
);
426-
val = Operand::Move(temp);
429+
val = temp;
427430
}
428431
if opt_ref_test_ty.is_some() {
429432
let slice = self.temp(ty, source_info.span);
@@ -463,7 +466,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
463466

464467
literal: method,
465468
})),
466-
args: vec![val, expect],
469+
args: vec![Operand::Copy(val), expect],
467470
destination: eq_result,
468471
target: Some(eq_block),
469472
unwind: UnwindAction::Continue,

0 commit comments

Comments
 (0)