Skip to content

Commit 280aa4a

Browse files
authored
Rollup merge of rust-lang#140120 - ChrisDenton:mir-opt-dump-rev, r=jieyouxu
Use `output_base_dir` for `mir_dump_dir` It just occurred to me that the problem might be due to multiple revisions using the same dump directory (and therefore deleting the other revision's dir). This fixes that by simply using the normal per-test output directory, which is revision safe.
2 parents c43b82f + 5e202a3 commit 280aa4a

File tree

2 files changed

+3
-14
lines changed

2 files changed

+3
-14
lines changed

src/tools/compiletest/src/runtest.rs

+1-12
Original file line numberDiff line numberDiff line change
@@ -1395,14 +1395,6 @@ impl<'test> TestCx<'test> {
13951395
matches!(self.config.suite.as_str(), "rustdoc-ui" | "rustdoc-js" | "rustdoc-json")
13961396
}
13971397

1398-
fn get_mir_dump_dir(&self) -> Utf8PathBuf {
1399-
let mut mir_dump_dir = self.config.build_test_suite_root.clone();
1400-
debug!("input_file: {}", self.testpaths.file);
1401-
mir_dump_dir.push(&self.testpaths.relative_dir);
1402-
mir_dump_dir.push(self.testpaths.file.file_stem().unwrap());
1403-
mir_dump_dir
1404-
}
1405-
14061398
fn make_compile_args(
14071399
&self,
14081400
input_file: &Utf8Path,
@@ -1511,10 +1503,7 @@ impl<'test> TestCx<'test> {
15111503
}
15121504

15131505
let set_mir_dump_dir = |rustc: &mut Command| {
1514-
let mir_dump_dir = self.get_mir_dump_dir();
1515-
remove_and_create_dir_all(&mir_dump_dir).unwrap_or_else(|e| {
1516-
panic!("failed to remove and recreate output directory `{mir_dump_dir}`: {e}")
1517-
});
1506+
let mir_dump_dir = self.output_base_dir();
15181507
let mut dir_opt = "-Zdump-mir-dir=".to_string();
15191508
dir_opt.push_str(mir_dump_dir.as_str());
15201509
debug!("dir_opt: {:?}", dir_opt);

src/tools/compiletest/src/runtest/mir_opt.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ impl TestCx<'_> {
5656
self.diff_mir_files(from_file.into(), after.into())
5757
} else {
5858
let mut output_file = Utf8PathBuf::new();
59-
output_file.push(self.get_mir_dump_dir());
59+
output_file.push(self.output_base_dir());
6060
output_file.push(&from_file);
6161
debug!("comparing the contents of: {} with {:?}", output_file, expected_file);
6262
if !output_file.exists() {
@@ -100,7 +100,7 @@ impl TestCx<'_> {
100100

101101
fn diff_mir_files(&self, before: Utf8PathBuf, after: Utf8PathBuf) -> String {
102102
let to_full_path = |path: Utf8PathBuf| {
103-
let full = self.get_mir_dump_dir().join(&path);
103+
let full = self.output_base_dir().join(&path);
104104
if !full.exists() {
105105
panic!(
106106
"the mir dump file for {} does not exist (requested in {})",

0 commit comments

Comments
 (0)