From e3dd4c198762d44e9e95e000397e1534dfca54cf Mon Sep 17 00:00:00 2001 From: Jonathan Brouwer Date: Fri, 17 Oct 2025 16:45:49 +0200 Subject: [PATCH] Warn on `unused_attributes` in tests Signed-off-by: Jonathan Brouwer --- src/tools/compiletest/src/runtest.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs index e9dea95cafbd..ff275df9b31c 100644 --- a/src/tools/compiletest/src/runtest.rs +++ b/src/tools/compiletest/src/runtest.rs @@ -1838,8 +1838,9 @@ impl<'test> TestCx<'test> { // Add `-A unused` before `config` flags and in-test (`props`) flags, so that they can // overwrite this. + // Don't allow `unused_attributes` since these are usually actual mistakes, rather than just unused code. if let AllowUnused::Yes = allow_unused { - rustc.args(&["-A", "unused"]); + rustc.args(&["-A", "unused", "-W", "unused_attributes"]); } // Allow tests to use internal features.