Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/tools/run-make-support/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if we need to stuff these generics everywhere, as it makes the compilation of each run-make test slightly slower. But if the function was already generic before, it doesn't really change anything, so should be fine here.

let expected = expected.as_ref();
path.as_ref()
.file_name()
.is_some_and(|name| !expected.contains(&name.to_str().unwrap().to_owned()))
Expand Down
5 changes: 2 additions & 3 deletions tests/run-make/output-type-permutations/rmake.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,8 @@ use std::path::PathBuf;
// `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();
Expand Down
Loading