Skip to content

Commit 40166c8

Browse files
committed
Don't allow .html files in tests/mir-opt/
HTML files were needed for testing `-Z dump-mir-spanview`, but that flag has been removed by rust-lang#119566.
1 parent 714b29a commit 40166c8

File tree

1 file changed

+6
-5
lines changed
  • src/tools/miropt-test-tools/src

1 file changed

+6
-5
lines changed

Diff for: src/tools/miropt-test-tools/src/lib.rs

+6-5
Original file line numberDiff line numberDiff line change
@@ -98,11 +98,12 @@ pub fn files_for_miropt_test(
9898
from_file = format!("{}.{}.mir", test_name, first_pass);
9999
to_file = Some(second_file);
100100
} else {
101-
let ext_re = regex::Regex::new(r#"(\.(mir|dot|html))$"#).unwrap();
102-
let cap = ext_re
103-
.captures_iter(test_name)
104-
.next()
105-
.expect("test_name has an invalid extension");
101+
// Allow-list for file extensions that can be produced by MIR dumps.
102+
// Other extensions can be added here, as needed by new dump flags.
103+
let ext_re = regex::Regex::new(r#"(\.(mir|dot))$"#).unwrap();
104+
let cap = ext_re.captures_iter(test_name).next().unwrap_or_else(|| {
105+
panic!("in {testfile:?}:\nEMIT_MIR has an unrecognized extension: {test_name}")
106+
});
106107
let extension = cap.get(1).unwrap().as_str();
107108

108109
expected_file =

0 commit comments

Comments
 (0)