Skip to content

Commit

Permalink
Improve the diagnostics around misspelled mir dump filenames
Browse files Browse the repository at this point in the history
  • Loading branch information
oli-obk committed Jul 29, 2020
1 parent f7a1e64 commit 1864a97
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/tools/compiletest/src/runtest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3239,8 +3239,19 @@ impl<'test> TestCx<'test> {
}

fn diff_mir_files(&self, before: PathBuf, after: PathBuf) -> String {
let before = self.get_mir_dump_dir().join(before);
let after = self.get_mir_dump_dir().join(after);
let to_full_path = |path: PathBuf| {
let full = self.get_mir_dump_dir().join(&path);
if !full.exists() {
panic!(
"the mir dump file for {} does not exist (requested in {})",
path.display(),
self.testpaths.file.display(),
);
}
full
};
let before = to_full_path(before);
let after = to_full_path(after);
debug!("comparing the contents of: {} with {}", before.display(), after.display());
let before = fs::read_to_string(before).unwrap();
let after = fs::read_to_string(after).unwrap();
Expand Down

0 comments on commit 1864a97

Please sign in to comment.