about summary refs log tree commit diff
diff options
context:
space:
mode:
authorOli Scherer <github333195615777966@oli-obk.de>2025-01-27 10:35:03 +0000
committerOli Scherer <github333195615777966@oli-obk.de>2025-01-27 10:36:30 +0000
commite1e2e17d2059a0c5e4d1770d1db30d9cf7bb4b26 (patch)
tree1a563ebd3f199ff485c3de92a427f0c521e92d1d
parenta9213c27ad09a97ac769c451bbed78e91c84cab8 (diff)
downloadrust-e1e2e17d2059a0c5e4d1770d1db30d9cf7bb4b26.tar.gz
rust-e1e2e17d2059a0c5e4d1770d1db30d9cf7bb4b26.zip
Use an operand instead of a place that is always turned into an operand
-rw-r--r--compiler/rustc_mir_build/src/builder/matches/test.rs20
1 files changed, 8 insertions, 12 deletions
diff --git a/compiler/rustc_mir_build/src/builder/matches/test.rs b/compiler/rustc_mir_build/src/builder/matches/test.rs
index ec2a9300136..f7b0f734b2d 100644
--- a/compiler/rustc_mir_build/src/builder/matches/test.rs
+++ b/compiler/rustc_mir_build/src/builder/matches/test.rs
@@ -178,7 +178,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
                         source_info,
                         expect,
                         expect_ty,
-                        ref_str,
+                        Operand::Copy(ref_str),
                         ref_str_ty,
                     );
                 } else if !ty.is_scalar() {
@@ -191,12 +191,11 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
                         source_info,
                         expect,
                         expect_ty,
-                        place,
+                        Operand::Copy(place),
                         ty,
                     );
                 } else {
                     assert_eq!(expect_ty, ty);
-                    let val = Operand::Copy(place);
                     self.compare(
                         block,
                         success_block,
@@ -204,7 +203,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
                         source_info,
                         BinOp::Eq,
                         expect,
-                        val,
+                        Operand::Copy(place),
                     );
                 }
             }
@@ -377,7 +376,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
         source_info: SourceInfo,
         mut expect: Operand<'tcx>,
         expect_ty: Ty<'tcx>,
-        mut val: Place<'tcx>,
+        mut val: Operand<'tcx>,
         mut ty: Ty<'tcx>,
     ) {
         // 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,
                                 CoercionSource::Implicit,
                             ),
-                            Operand::Copy(val),
+                            val,
                             ty,
                         ),
                     );
-                    val = temp;
+                    val = Operand::Copy(temp);
                 }
                 if opt_ref_test_ty.is_some() {
                     let slice = self.temp(ty, source_info.span);
@@ -473,11 +472,8 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
 
                 const_: method,
             })),
-            args: [Spanned { node: Operand::Copy(val), span: DUMMY_SP }, Spanned {
-                node: expect,
-                span: DUMMY_SP,
-            }]
-            .into(),
+            args: [Spanned { node: val, span: DUMMY_SP }, Spanned { node: expect, span: DUMMY_SP }]
+                .into(),
             destination: eq_result,
             target: Some(eq_block),
             unwind: UnwindAction::Continue,