about summary refs log tree commit diff
diff options
context:
space:
mode:
authorBen Kimock <kimockb@gmail.com>2024-01-30 22:28:28 -0500
committerBen Kimock <kimockb@gmail.com>2024-02-06 23:36:05 -0500
commit2116ed723d178313cac1ff829d5a7417bba1cd3b (patch)
tree19089ae81925666f8344f87aca63ff50838bde86
parent4451bf4d678c67755c153995d638559a76469af2 (diff)
downloadrust-2116ed723d178313cac1ff829d5a7417bba1cd3b.tar.gz
rust-2116ed723d178313cac1ff829d5a7417bba1cd3b.zip
Tweak a few mir-opt tests instead of using -Clink-dead-code
-rw-r--r--src/bootstrap/src/core/build_steps/test.rs1
-rw-r--r--src/tools/compiletest/src/runtest.rs1
-rw-r--r--tests/mir-opt/fn_ptr_shim.rs2
-rw-r--r--tests/mir-opt/retag.rs2
-rw-r--r--tests/mir-opt/slice_drop_shim.rs6
-rw-r--r--tests/mir-opt/unusual_item_types.rs2
6 files changed, 7 insertions, 7 deletions
diff --git a/src/bootstrap/src/core/build_steps/test.rs b/src/bootstrap/src/core/build_steps/test.rs
index e1a1c416ae9..baf1b5a4a1a 100644
--- a/src/bootstrap/src/core/build_steps/test.rs
+++ b/src/bootstrap/src/core/build_steps/test.rs
@@ -1470,7 +1470,6 @@ impl Step for MirOpt {
         };
 
         if builder.config.cmd.bless() {
-            crate::utils::cc_detect::find_target(builder, self.compiler.host);
             // All that we really need to do is cover all combinations of 32/64-bit and unwind/abort,
             // but while we're at it we might as well flex our cross-compilation support. This
             // selection covers all our tier 1 operating systems and architectures using only tier
diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs
index 00ebd91f387..ed1c559e1f6 100644
--- a/src/tools/compiletest/src/runtest.rs
+++ b/src/tools/compiletest/src/runtest.rs
@@ -2468,7 +2468,6 @@ impl<'test> TestCx<'test> {
                     "-Zlint-mir",
                     "-Zdump-mir-exclude-pass-number",
                     "--crate-type=rlib",
-                    "-Clink-dead-code",
                 ]);
                 if let Some(pass) = &self.props.mir_unit_test {
                     rustc.args(&["-Zmir-opt-level=0", &format!("-Zmir-enable-passes=+{}", pass)]);
diff --git a/tests/mir-opt/fn_ptr_shim.rs b/tests/mir-opt/fn_ptr_shim.rs
index c82260baefe..2650cbf9704 100644
--- a/tests/mir-opt/fn_ptr_shim.rs
+++ b/tests/mir-opt/fn_ptr_shim.rs
@@ -5,7 +5,7 @@
 // (as only `FnDef` and `FnPtr` callees are allowed in MIR).
 
 // EMIT_MIR core.ops-function-Fn-call.AddMovesForPackedDrops.before.mir
-fn main() {
+pub fn main() {
     call(noop as fn());
 }
 
diff --git a/tests/mir-opt/retag.rs b/tests/mir-opt/retag.rs
index 1e4b017dad5..554b8ece90f 100644
--- a/tests/mir-opt/retag.rs
+++ b/tests/mir-opt/retag.rs
@@ -28,7 +28,7 @@ impl Drop for Test {
 
 // EMIT_MIR retag.main.SimplifyCfg-elaborate-drops.after.mir
 // EMIT_MIR retag.main-{closure#0}.SimplifyCfg-elaborate-drops.after.mir
-fn main() {
+pub fn main() {
     let mut x = 0;
     {
         let v = Test(0).foo(&mut x); // just making sure we do not panic when there is a tuple struct ctor
diff --git a/tests/mir-opt/slice_drop_shim.rs b/tests/mir-opt/slice_drop_shim.rs
index cac0a349128..037e048b3b7 100644
--- a/tests/mir-opt/slice_drop_shim.rs
+++ b/tests/mir-opt/slice_drop_shim.rs
@@ -1,6 +1,8 @@
 // skip-filecheck
-// compile-flags: -Zmir-opt-level=0
-
+// compile-flags: -Zmir-opt-level=0 -Clink-dead-code
+// mir-opt tests are always built as rlibs so that they seamlessly cross-compile,
+// so this test only produces MIR for the drop_in_place we're looking for
+// if we use -Clink-dead-code.
 
 // EMIT_MIR core.ptr-drop_in_place.[String].AddMovesForPackedDrops.before.mir
 fn main() {
diff --git a/tests/mir-opt/unusual_item_types.rs b/tests/mir-opt/unusual_item_types.rs
index 49b663b4f82..fa6ba515473 100644
--- a/tests/mir-opt/unusual_item_types.rs
+++ b/tests/mir-opt/unusual_item_types.rs
@@ -23,7 +23,7 @@ enum E {
     V = 5,
 }
 
-fn main() {
+pub fn main() {
     let f = Test::X as fn(usize) -> Test;
 // EMIT_MIR core.ptr-drop_in_place.Vec_i32_.AddMovesForPackedDrops.before.mir
     let v = Vec::<i32>::new();