Skip to content

Commit e1e2e17

Browse files
committed
Use an operand instead of a place that is always turned into an operand
1 parent a9213c2 commit e1e2e17

File tree

1 file changed

+8
-12
lines changed
  • compiler/rustc_mir_build/src/builder/matches

1 file changed

+8
-12
lines changed

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

+8-12
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
178178
source_info,
179179
expect,
180180
expect_ty,
181-
ref_str,
181+
Operand::Copy(ref_str),
182182
ref_str_ty,
183183
);
184184
} else if !ty.is_scalar() {
@@ -191,20 +191,19 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
191191
source_info,
192192
expect,
193193
expect_ty,
194-
place,
194+
Operand::Copy(place),
195195
ty,
196196
);
197197
} else {
198198
assert_eq!(expect_ty, ty);
199-
let val = Operand::Copy(place);
200199
self.compare(
201200
block,
202201
success_block,
203202
fail_block,
204203
source_info,
205204
BinOp::Eq,
206205
expect,
207-
val,
206+
Operand::Copy(place),
208207
);
209208
}
210209
}
@@ -377,7 +376,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
377376
source_info: SourceInfo,
378377
mut expect: Operand<'tcx>,
379378
expect_ty: Ty<'tcx>,
380-
mut val: Place<'tcx>,
379+
mut val: Operand<'tcx>,
381380
mut ty: Ty<'tcx>,
382381
) {
383382
// If we're using `b"..."` as a pattern, we need to insert an
@@ -413,11 +412,11 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
413412
PointerCoercion::Unsize,
414413
CoercionSource::Implicit,
415414
),
416-
Operand::Copy(val),
415+
val,
417416
ty,
418417
),
419418
);
420-
val = temp;
419+
val = Operand::Copy(temp);
421420
}
422421
if opt_ref_test_ty.is_some() {
423422
let slice = self.temp(ty, source_info.span);
@@ -473,11 +472,8 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
473472

474473
const_: method,
475474
})),
476-
args: [Spanned { node: Operand::Copy(val), span: DUMMY_SP }, Spanned {
477-
node: expect,
478-
span: DUMMY_SP,
479-
}]
480-
.into(),
475+
args: [Spanned { node: val, span: DUMMY_SP }, Spanned { node: expect, span: DUMMY_SP }]
476+
.into(),
481477
destination: eq_result,
482478
target: Some(eq_block),
483479
unwind: UnwindAction::Continue,

0 commit comments

Comments
 (0)