1
Fork 0

Rollup merge of #125573 - GuillaumeGomez:migrate-allow-warnings-cmdline-stability, r=jieyouxu

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

Part of https://github.com/rust-lang/rust/issues/121876.

r? ``@jieyouxu``
This commit is contained in:
Matthias Krüger 2024-05-28 18:04:32 +02:00 committed by GitHub
commit 78b4cafa6e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 22 additions and 17 deletions

View file

@ -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:
///

View file

@ -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

View file

@ -1,16 +0,0 @@
# ignore-cross-compile
include ../tools.mk
# Test that -A warnings makes the 'empty trait list for derive' warning go away
DEP=$(shell $(RUSTC) bar.rs)
OUT=$(shell $(RUSTC) foo.rs -A warnings 2>&1 | grep "warning" )
all: foo bar
test -z '$(OUT)'
# These are just to ensure that the above commands actually work
bar:
$(RUSTC) bar.rs
foo: bar
$(RUSTC) foo.rs -A warnings

View file

@ -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");
}