Rollup merge of #127451 - GuillaumeGomez:improve-output-type-permutations, r=kobzol

Improve `run-make/output-type-permutations` code and improve `filename_not_in_denylist` API

r? ``@Kobzol``
This commit is contained in:
许杰友 Jieyou Xu (Joe) 2024-07-08 13:04:33 +08:00 committed by GitHub
commit 033283456a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 4 deletions

View File

@ -296,7 +296,8 @@ pub fn not_contains<P: AsRef<Path>>(path: P, expected: &str) -> bool {
}
/// Returns true if the filename at `path` is not in `expected`.
pub fn filename_not_in_denylist<P: AsRef<Path>>(path: P, expected: &[String]) -> bool {
pub fn filename_not_in_denylist<P: AsRef<Path>, V: AsRef<[String]>>(path: P, expected: V) -> bool {
let expected = expected.as_ref();
path.as_ref()
.file_name()
.is_some_and(|name| !expected.contains(&name.to_str().unwrap().to_owned()))

View File

@ -17,9 +17,8 @@
// `rustc_invocation`: the rustc command being tested
// Any unexpected output files not listed in `must_exist` or `can_exist` will cause a failure.
fn assert_expected_output_files(expectations: Expectations, rustc_invocation: impl Fn()) {
let must_exist = expectations.expected_files;
let can_exist = expectations.allowed_files;
let dir = expectations.test_dir;
let Expectations { expected_files: must_exist, allowed_files: can_exist, test_dir: dir } =
expectations;
fs_wrapper::create_dir(&dir);
rustc_invocation();