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

Migrate run-make/allow-warnings-cmdline-stability to rmake.rs #125573

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
11 changes: 11 additions & 0 deletions src/tools/run-make-support/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,17 @@ pub fn recursive_diff(dir1: impl AsRef<Path>, dir2: impl AsRef<Path>) {
}
}

/// Check that `haystack` does not contain `needle`. Panic otherwise.
pub fn assert_not_contains(haystack: &str, needle: &str) {
if haystack.contains(needle) {
eprintln!("=== HAYSTACK ===");
eprintln!("{}", haystack);
eprintln!("=== NEEDLE ===");
eprintln!("{}", needle);
panic!("needle was unexpectedly found in haystack");
}
}

/// Implement common helpers for command wrappers. This assumes that the command wrapper is a struct
/// containing a `cmd: Command` field and a `output` function. The provided helpers are:
///
Expand Down
1 change: 0 additions & 1 deletion src/tools/tidy/src/allowed_run_make_makefiles.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
run-make/allocator-shim-circular-deps/Makefile
run-make/allow-non-lint-warnings-cmdline/Makefile
run-make/allow-warnings-cmdline-stability/Makefile
run-make/archive-duplicate-names/Makefile
run-make/atomic-lock-free/Makefile
run-make/bare-outfile/Makefile
Expand Down
16 changes: 0 additions & 16 deletions tests/run-make/allow-warnings-cmdline-stability/Makefile

This file was deleted.

11 changes: 11 additions & 0 deletions tests/run-make/allow-warnings-cmdline-stability/rmake.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// Test that `-Awarnings` suppresses warnings for unstable APIs.

use run_make_support::{assert_not_contains, rustc};

fn main() {
rustc().input("bar.rs").run();
let output = rustc().input("foo.rs").arg("-Awarnings").run();

assert_not_contains(&String::from_utf8(output.stdout).unwrap(), "warning");
assert_not_contains(&String::from_utf8(output.stderr).unwrap(), "warning");
}
Loading