Skip to content

Commit b82c524

Browse files
committed
Add double unsafe test
1 parent 68719e0 commit b82c524

File tree

2 files changed

+36
-0
lines changed

2 files changed

+36
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#![feature(unsafe_attributes)]
2+
3+
#[unsafe(unsafe(no_mangle))]
4+
//~^ ERROR expected identifier, found keyword `unsafe`
5+
//~| ERROR cannot find attribute `r#unsafe` in this scope
6+
//~| ERROR `r#unsafe` is not an unsafe attribute
7+
fn a() {}
8+
9+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
error: expected identifier, found keyword `unsafe`
2+
--> $DIR/double-unsafe-attributes.rs:3:10
3+
|
4+
LL | #[unsafe(unsafe(no_mangle))]
5+
| ^^^^^^ expected identifier, found keyword
6+
|
7+
help: escape `unsafe` to use it as an identifier
8+
|
9+
LL | #[unsafe(r#unsafe(no_mangle))]
10+
| ++
11+
12+
error: cannot find attribute `r#unsafe` in this scope
13+
--> $DIR/double-unsafe-attributes.rs:3:10
14+
|
15+
LL | #[unsafe(unsafe(no_mangle))]
16+
| ^^^^^^
17+
18+
error: `r#unsafe` is not an unsafe attribute
19+
--> $DIR/double-unsafe-attributes.rs:3:3
20+
|
21+
LL | #[unsafe(unsafe(no_mangle))]
22+
| ^^^^^^
23+
|
24+
= note: extraneous unsafe is not allowed in attributes
25+
26+
error: aborting due to 3 previous errors
27+

0 commit comments

Comments
 (0)