about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2024-05-15 08:28:02 +0000
committerbors <bors@rust-lang.org>2024-05-15 08:28:02 +0000
commita71c3ffce9ca505af27f43cd3bad7606a72e3ec8 (patch)
treea47a9c9e3192fc6c466781fe7d0f66f6c9a40fde
parent44fa5fd39a1d2af41bd7f43bc246a5e4f6d94696 (diff)
parent848f3c2c6e65c799bb87e5f0308ad7556f7e7fcb (diff)
downloadrust-a71c3ffce9ca505af27f43cd3bad7606a72e3ec8.tar.gz
rust-a71c3ffce9ca505af27f43cd3bad7606a72e3ec8.zip
Auto merge of #125032 - compiler-errors:crash-dump-dir, r=onur-ozkan
Make crashes dump mir to build dir

Set `-Zdump-mir-dir` for `crashes`-style tests.

Alternatively, we just remove `tests/crashes/124436.rs`, since if the only way to get it to repro is via `-Zdump-mir`, then maybe it's not worth it to fix.

Fixes #125029
-rw-r--r--src/tools/compiletest/src/runtest.rs22
1 files changed, 14 insertions, 8 deletions
diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs
index 1d69ed59859..02c9d384ab7 100644
--- a/src/tools/compiletest/src/runtest.rs
+++ b/src/tools/compiletest/src/runtest.rs
@@ -2478,6 +2478,15 @@ impl<'test> TestCx<'test> {
             }
         }
 
+        let set_mir_dump_dir = |rustc: &mut Command| {
+            let mir_dump_dir = self.get_mir_dump_dir();
+            remove_and_create_dir_all(&mir_dump_dir);
+            let mut dir_opt = "-Zdump-mir-dir=".to_string();
+            dir_opt.push_str(mir_dump_dir.to_str().unwrap());
+            debug!("dir_opt: {:?}", dir_opt);
+            rustc.arg(dir_opt);
+        };
+
         match self.config.mode {
             Incremental => {
                 // If we are extracting and matching errors in the new
@@ -2532,13 +2541,7 @@ impl<'test> TestCx<'test> {
                     ]);
                 }
 
-                let mir_dump_dir = self.get_mir_dump_dir();
-                remove_and_create_dir_all(&mir_dump_dir);
-                let mut dir_opt = "-Zdump-mir-dir=".to_string();
-                dir_opt.push_str(mir_dump_dir.to_str().unwrap());
-                debug!("dir_opt: {:?}", dir_opt);
-
-                rustc.arg(dir_opt);
+                set_mir_dump_dir(&mut rustc);
             }
             CoverageMap => {
                 rustc.arg("-Cinstrument-coverage");
@@ -2560,8 +2563,11 @@ impl<'test> TestCx<'test> {
             Assembly | Codegen => {
                 rustc.arg("-Cdebug-assertions=no");
             }
+            Crashes => {
+                set_mir_dump_dir(&mut rustc);
+            }
             RunPassValgrind | Pretty | DebugInfo | Rustdoc | RustdocJson | RunMake
-            | CodegenUnits | JsDocTest | Crashes => {
+            | CodegenUnits | JsDocTest => {
                 // do not use JSON output
             }
         }