From 40166c894ad7f3de348545da0e92d88e2ead393f Mon Sep 17 00:00:00 2001 From: Zalathar Date: Tue, 16 Jan 2024 17:37:24 +1100 Subject: [PATCH] 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 #119566. --- src/tools/miropt-test-tools/src/lib.rs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/tools/miropt-test-tools/src/lib.rs b/src/tools/miropt-test-tools/src/lib.rs index cae96f593199e..7d60033c3e824 100644 --- a/src/tools/miropt-test-tools/src/lib.rs +++ b/src/tools/miropt-test-tools/src/lib.rs @@ -98,11 +98,12 @@ pub fn files_for_miropt_test( from_file = format!("{}.{}.mir", test_name, first_pass); to_file = Some(second_file); } else { - let ext_re = regex::Regex::new(r#"(\.(mir|dot|html))$"#).unwrap(); - let cap = ext_re - .captures_iter(test_name) - .next() - .expect("test_name has an invalid extension"); + // Allow-list for file extensions that can be produced by MIR dumps. + // Other extensions can be added here, as needed by new dump flags. + let ext_re = regex::Regex::new(r#"(\.(mir|dot))$"#).unwrap(); + let cap = ext_re.captures_iter(test_name).next().unwrap_or_else(|| { + panic!("in {testfile:?}:\nEMIT_MIR has an unrecognized extension: {test_name}") + }); let extension = cap.get(1).unwrap().as_str(); expected_file =