Add a regression test for unsafe nonexistent attributes
This commit is contained in:
parent
6e3a015400
commit
892bd18ad8
2 changed files with 26 additions and 0 deletions
10
tests/ui/attributes/unsafe/unsafe-nonexistent-attribute.rs
Normal file
10
tests/ui/attributes/unsafe/unsafe-nonexistent-attribute.rs
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
// This is a regression test for https://github.com/rust-lang/rust/issues/148453
|
||||
// We want the `cannot find attribute` error to appear before `is not an unsafe attribute`
|
||||
//@ edition: 2024
|
||||
|
||||
#[unsafe(does_not_exist)]
|
||||
//~^ ERROR cannot find attribute
|
||||
//~| ERROR is not an unsafe attribute
|
||||
fn aa() {}
|
||||
|
||||
fn main() {}
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
error: cannot find attribute `does_not_exist` in this scope
|
||||
--> $DIR/unsafe-nonexistent-attribute.rs:5:10
|
||||
|
|
||||
LL | #[unsafe(does_not_exist)]
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
||||
error: `does_not_exist` is not an unsafe attribute
|
||||
--> $DIR/unsafe-nonexistent-attribute.rs:5:3
|
||||
|
|
||||
LL | #[unsafe(does_not_exist)]
|
||||
| ^^^^^^ this is not an unsafe attribute
|
||||
|
|
||||
= note: extraneous unsafe is not allowed in attributes
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue