Add double unsafe test
This commit is contained in:
parent
68719e0bda
commit
b82c524996
9
tests/ui/attributes/unsafe/double-unsafe-attributes.rs
Normal file
9
tests/ui/attributes/unsafe/double-unsafe-attributes.rs
Normal file
@ -0,0 +1,9 @@
|
||||
#![feature(unsafe_attributes)]
|
||||
|
||||
#[unsafe(unsafe(no_mangle))]
|
||||
//~^ ERROR expected identifier, found keyword `unsafe`
|
||||
//~| ERROR cannot find attribute `r#unsafe` in this scope
|
||||
//~| ERROR `r#unsafe` is not an unsafe attribute
|
||||
fn a() {}
|
||||
|
||||
fn main() {}
|
27
tests/ui/attributes/unsafe/double-unsafe-attributes.stderr
Normal file
27
tests/ui/attributes/unsafe/double-unsafe-attributes.stderr
Normal file
@ -0,0 +1,27 @@
|
||||
error: expected identifier, found keyword `unsafe`
|
||||
--> $DIR/double-unsafe-attributes.rs:3:10
|
||||
|
|
||||
LL | #[unsafe(unsafe(no_mangle))]
|
||||
| ^^^^^^ expected identifier, found keyword
|
||||
|
|
||||
help: escape `unsafe` to use it as an identifier
|
||||
|
|
||||
LL | #[unsafe(r#unsafe(no_mangle))]
|
||||
| ++
|
||||
|
||||
error: cannot find attribute `r#unsafe` in this scope
|
||||
--> $DIR/double-unsafe-attributes.rs:3:10
|
||||
|
|
||||
LL | #[unsafe(unsafe(no_mangle))]
|
||||
| ^^^^^^
|
||||
|
||||
error: `r#unsafe` is not an unsafe attribute
|
||||
--> $DIR/double-unsafe-attributes.rs:3:3
|
||||
|
|
||||
LL | #[unsafe(unsafe(no_mangle))]
|
||||
| ^^^^^^
|
||||
|
|
||||
= note: extraneous unsafe is not allowed in attributes
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
|
Loading…
Reference in New Issue
Block a user