Skip to content

Use output_base_dir for mir_dump_dir #140120

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 1 addition & 12 deletions src/tools/compiletest/src/runtest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1395,14 +1395,6 @@ impl<'test> TestCx<'test> {
matches!(self.config.suite.as_str(), "rustdoc-ui" | "rustdoc-js" | "rustdoc-json")
}

fn get_mir_dump_dir(&self) -> Utf8PathBuf {
let mut mir_dump_dir = self.config.build_test_suite_root.clone();
debug!("input_file: {}", self.testpaths.file);
mir_dump_dir.push(&self.testpaths.relative_dir);
mir_dump_dir.push(self.testpaths.file.file_stem().unwrap());
mir_dump_dir
}

fn make_compile_args(
&self,
input_file: &Utf8Path,
Expand Down Expand Up @@ -1511,10 +1503,7 @@ 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).unwrap_or_else(|e| {
panic!("failed to remove and recreate output directory `{mir_dump_dir}`: {e}")
});
let mir_dump_dir = self.output_base_dir();
let mut dir_opt = "-Zdump-mir-dir=".to_string();
dir_opt.push_str(mir_dump_dir.as_str());
debug!("dir_opt: {:?}", dir_opt);
Expand Down
4 changes: 2 additions & 2 deletions src/tools/compiletest/src/runtest/mir_opt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ impl TestCx<'_> {
self.diff_mir_files(from_file.into(), after.into())
} else {
let mut output_file = Utf8PathBuf::new();
output_file.push(self.get_mir_dump_dir());
output_file.push(self.output_base_dir());
output_file.push(&from_file);
debug!("comparing the contents of: {} with {:?}", output_file, expected_file);
if !output_file.exists() {
Expand Down Expand Up @@ -100,7 +100,7 @@ impl TestCx<'_> {

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