Warnings-as-errors in check-builtin-attr-ice.rs.

This adds two new warnings, both of which print the attribute
incorrectly as `#[]`. The next commit will fix this.
This commit is contained in:
Nicholas Nethercote 2025-04-09 21:11:12 +10:00
parent 78f2104e33
commit 4be670f89b
2 changed files with 26 additions and 4 deletions

View file

@ -39,13 +39,17 @@
// Notably, `should_panic` is a `AttributeType::Normal` attribute that is checked separately.
#![deny(unused_attributes)]
struct Foo {
#[should_panic::skip]
//~^ ERROR failed to resolve
//~| ERROR `#[]` only has an effect on functions
pub field: u8,
#[should_panic::a::b::c]
//~^ ERROR failed to resolve
//~| ERROR `#[]` only has an effect on functions
pub field2: u8,
}

View file

@ -1,21 +1,39 @@
error[E0433]: failed to resolve: use of unresolved module or unlinked crate `should_panic`
--> $DIR/check-builtin-attr-ice.rs:43:7
--> $DIR/check-builtin-attr-ice.rs:45:7
|
LL | #[should_panic::skip]
| ^^^^^^^^^^^^ use of unresolved module or unlinked crate `should_panic`
error[E0433]: failed to resolve: use of unresolved module or unlinked crate `should_panic`
--> $DIR/check-builtin-attr-ice.rs:47:7
--> $DIR/check-builtin-attr-ice.rs:50:7
|
LL | #[should_panic::a::b::c]
| ^^^^^^^^^^^^ use of unresolved module or unlinked crate `should_panic`
error[E0433]: failed to resolve: use of unresolved module or unlinked crate `deny`
--> $DIR/check-builtin-attr-ice.rs:55:7
--> $DIR/check-builtin-attr-ice.rs:59:7
|
LL | #[deny::skip]
| ^^^^ use of unresolved module or unlinked crate `deny`
error: aborting due to 3 previous errors
error: `#[]` only has an effect on functions
--> $DIR/check-builtin-attr-ice.rs:45:5
|
LL | #[should_panic::skip]
| ^^^^^^^^^^^^^^^^^^^^^
|
note: the lint level is defined here
--> $DIR/check-builtin-attr-ice.rs:42:9
|
LL | #![deny(unused_attributes)]
| ^^^^^^^^^^^^^^^^^
error: `#[]` only has an effect on functions
--> $DIR/check-builtin-attr-ice.rs:50:5
|
LL | #[should_panic::a::b::c]
| ^^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to 5 previous errors
For more information about this error, try `rustc --explain E0433`.