Skip to content

Commit 987d5fe

Browse files
Add a regression test for unsafe nonexistent attributes
1 parent c3e62dc commit 987d5fe

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// This is a regression test for https://github.com/rust-lang/rust/issues/148453
2+
// We want the `cannot find attribute` error to appear before `is not an unsafe attribute`
3+
//@ edition: 2024
4+
5+
#[unsafe(does_not_exist)]
6+
//~^ ERROR cannot find attribute
7+
//~| ERROR is not an unsafe attribute
8+
fn aa() {}
9+
10+
fn main() {}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
error: cannot find attribute `does_not_exist` in this scope
2+
--> $DIR/unsafe-nonexistent-attribute.rs:5:10
3+
|
4+
LL | #[unsafe(does_not_exist)]
5+
| ^^^^^^^^^^^^^^
6+
7+
error: `does_not_exist` is not an unsafe attribute
8+
--> $DIR/unsafe-nonexistent-attribute.rs:5:3
9+
|
10+
LL | #[unsafe(does_not_exist)]
11+
| ^^^^^^ this is not an unsafe attribute
12+
|
13+
= note: extraneous unsafe is not allowed in attributes
14+
15+
error: aborting due to 2 previous errors
16+

0 commit comments

Comments
 (0)