diff options
| author | Sasha Pourcelot <sasha.pourcelot@protonmail.com> | 2025-08-23 19:45:00 +0200 |
|---|---|---|
| committer | Sasha Pourcelot <sasha.pourcelot@protonmail.com> | 2025-08-25 21:31:04 +0200 |
| commit | a8e9ca195e8345fc574420418d2fd3aed258f703 (patch) | |
| tree | 12ec4f975e39c3cf444b59078625ff439f8a2aee /tests/ui/lint | |
| parent | 93edf9f9b0bf284d8f8cbe52af5d0569d0cf5850 (diff) | |
| download | rust-a8e9ca195e8345fc574420418d2fd3aed258f703.tar.gz rust-a8e9ca195e8345fc574420418d2fd3aed258f703.zip | |
Use attribute name in message for "outer attr used as inner attr" errors
Diffstat (limited to 'tests/ui/lint')
5 files changed, 26 insertions, 5 deletions
diff --git a/tests/ui/lint/linker-warning.stderr b/tests/ui/lint/linker-warning.stderr index c678562ab54..ae5f6b3adec 100644 --- a/tests/ui/lint/linker-warning.stderr +++ b/tests/ui/lint/linker-warning.stderr @@ -1,4 +1,4 @@ -warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` +warning: crate-level attribute should be an inner attribute --> $DIR/linker-warning.rs:7:1 | LL | #[allow(linker_messages)] @@ -9,6 +9,10 @@ note: the lint level is defined here | LL | #![warn(unused_attributes)] | ^^^^^^^^^^^^^^^^^ +help: add a `!` + | +LL | #![allow(linker_messages)] + | + warning: unused attribute --> $DIR/linker-warning.rs:4:1 diff --git a/tests/ui/lint/lint-misplaced-attr.stderr b/tests/ui/lint/lint-misplaced-attr.stderr index abaf4620e6f..bcfda170080 100644 --- a/tests/ui/lint/lint-misplaced-attr.stderr +++ b/tests/ui/lint/lint-misplaced-attr.stderr @@ -10,11 +10,16 @@ note: the lint level is defined here LL | #![deny(unused_attributes)] | ^^^^^^^^^^^^^^^^^ -error: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` +error: crate-level attribute should be an inner attribute --> $DIR/lint-misplaced-attr.rs:10:1 | LL | #[crate_type = "bin"] fn main() {} | ^^^^^^^^^^^^^^^^^^^^^ + | +help: add a `!` + | +LL | #![crate_type = "bin"] fn main() {} + | + error: aborting due to 2 previous errors diff --git a/tests/ui/lint/unused/concat-in-crate-name-issue-137687.rs b/tests/ui/lint/unused/concat-in-crate-name-issue-137687.rs index 37fbf93ffa1..c507b6590c2 100644 --- a/tests/ui/lint/unused/concat-in-crate-name-issue-137687.rs +++ b/tests/ui/lint/unused/concat-in-crate-name-issue-137687.rs @@ -1,7 +1,7 @@ #![deny(unused)] #[crate_name = concat !()] -//~^ ERROR crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo] +//~^ ERROR crate-level attribute should be an inner attribute macro_rules! a { //~^ ERROR unused macro definition () => {}; diff --git a/tests/ui/lint/unused/concat-in-crate-name-issue-137687.stderr b/tests/ui/lint/unused/concat-in-crate-name-issue-137687.stderr index 4ffb55d493a..b06e65af7bc 100644 --- a/tests/ui/lint/unused/concat-in-crate-name-issue-137687.stderr +++ b/tests/ui/lint/unused/concat-in-crate-name-issue-137687.stderr @@ -11,12 +11,20 @@ LL | #![deny(unused)] | ^^^^^^ = note: `#[deny(unused_macros)]` implied by `#[deny(unused)]` -error: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` +error: crate-level attribute should be an inner attribute: add an exclamation mark: `#![crate_name]` --> $DIR/concat-in-crate-name-issue-137687.rs:3:1 | LL | #[crate_name = concat !()] | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | +note: This attribute does not have an `!`, which means it is applied to this macro def + --> $DIR/concat-in-crate-name-issue-137687.rs:5:1 + | +LL | / macro_rules! a { +LL | | +LL | | () => {}; +LL | | } + | |_^ = note: `#[deny(unused_attributes)]` implied by `#[deny(unused)]` error: aborting due to 2 previous errors diff --git a/tests/ui/lint/unused/unused-attr-macro-rules.stderr b/tests/ui/lint/unused/unused-attr-macro-rules.stderr index 9d61120463c..af64be8f6e9 100644 --- a/tests/ui/lint/unused/unused-attr-macro-rules.stderr +++ b/tests/ui/lint/unused/unused-attr-macro-rules.stderr @@ -1,4 +1,4 @@ -error: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` +error: crate-level attribute should be an inner attribute --> $DIR/unused-attr-macro-rules.rs:11:1 | LL | #[recursion_limit="1"] @@ -9,6 +9,10 @@ note: the lint level is defined here | LL | #![deny(unused_attributes)] | ^^^^^^^^^^^^^^^^^ +help: add a `!` + | +LL | #![recursion_limit="1"] + | + error: `#[macro_use]` attribute cannot be used on macro defs --> $DIR/unused-attr-macro-rules.rs:7:1 |
