Skip to content

Commit 1864a97

Browse files
committed
Improve the diagnostics around misspelled mir dump filenames
1 parent f7a1e64 commit 1864a97

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

src/tools/compiletest/src/runtest.rs

+13-2
Original file line numberDiff line numberDiff line change
@@ -3239,8 +3239,19 @@ impl<'test> TestCx<'test> {
32393239
}
32403240

32413241
fn diff_mir_files(&self, before: PathBuf, after: PathBuf) -> String {
3242-
let before = self.get_mir_dump_dir().join(before);
3243-
let after = self.get_mir_dump_dir().join(after);
3242+
let to_full_path = |path: PathBuf| {
3243+
let full = self.get_mir_dump_dir().join(&path);
3244+
if !full.exists() {
3245+
panic!(
3246+
"the mir dump file for {} does not exist (requested in {})",
3247+
path.display(),
3248+
self.testpaths.file.display(),
3249+
);
3250+
}
3251+
full
3252+
};
3253+
let before = to_full_path(before);
3254+
let after = to_full_path(after);
32443255
debug!("comparing the contents of: {} with {}", before.display(), after.display());
32453256
let before = fs::read_to_string(before).unwrap();
32463257
let after = fs::read_to_string(after).unwrap();

0 commit comments

Comments
 (0)