From 1864a973b3a0a5a6c5a7c71d7d7cd052732e5c02 Mon Sep 17 00:00:00 2001 From: Oliver Scherer Date: Wed, 29 Jul 2020 22:39:50 +0200 Subject: [PATCH] Improve the diagnostics around misspelled mir dump filenames --- src/tools/compiletest/src/runtest.rs | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs index 9354cc16a9ae9..b97ca9e3a0f27 100644 --- a/src/tools/compiletest/src/runtest.rs +++ b/src/tools/compiletest/src/runtest.rs @@ -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();