1
Fork 0

Use an operand instead of a place that is always turned into an operand

This commit is contained in:
Oli Scherer 2025-01-27 10:35:03 +00:00
parent a9213c27ad
commit e1e2e17d20

View file

@ -178,7 +178,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
source_info, source_info,
expect, expect,
expect_ty, expect_ty,
ref_str, Operand::Copy(ref_str),
ref_str_ty, ref_str_ty,
); );
} else if !ty.is_scalar() { } else if !ty.is_scalar() {
@ -191,12 +191,11 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
source_info, source_info,
expect, expect,
expect_ty, expect_ty,
place, Operand::Copy(place),
ty, ty,
); );
} else { } else {
assert_eq!(expect_ty, ty); assert_eq!(expect_ty, ty);
let val = Operand::Copy(place);
self.compare( self.compare(
block, block,
success_block, success_block,
@ -204,7 +203,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
source_info, source_info,
BinOp::Eq, BinOp::Eq,
expect, expect,
val, Operand::Copy(place),
); );
} }
} }
@ -377,7 +376,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
source_info: SourceInfo, source_info: SourceInfo,
mut expect: Operand<'tcx>, mut expect: Operand<'tcx>,
expect_ty: Ty<'tcx>, expect_ty: Ty<'tcx>,
mut val: Place<'tcx>, mut val: Operand<'tcx>,
mut ty: Ty<'tcx>, mut ty: Ty<'tcx>,
) { ) {
// If we're using `b"..."` as a pattern, we need to insert an // If we're using `b"..."` as a pattern, we need to insert an
@ -413,11 +412,11 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
PointerCoercion::Unsize, PointerCoercion::Unsize,
CoercionSource::Implicit, CoercionSource::Implicit,
), ),
Operand::Copy(val), val,
ty, ty,
), ),
); );
val = temp; val = Operand::Copy(temp);
} }
if opt_ref_test_ty.is_some() { if opt_ref_test_ty.is_some() {
let slice = self.temp(ty, source_info.span); let slice = self.temp(ty, source_info.span);
@ -473,11 +472,8 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
const_: method, const_: method,
})), })),
args: [Spanned { node: Operand::Copy(val), span: DUMMY_SP }, Spanned { args: [Spanned { node: val, span: DUMMY_SP }, Spanned { node: expect, span: DUMMY_SP }]
node: expect, .into(),
span: DUMMY_SP,
}]
.into(),
destination: eq_result, destination: eq_result,
target: Some(eq_block), target: Some(eq_block),
unwind: UnwindAction::Continue, unwind: UnwindAction::Continue,