diff options
| author | carbotaniuman <41451839+carbotaniuman@users.noreply.github.com> | 2024-07-02 23:52:16 -0500 | 
|---|---|---|
| committer | carbotaniuman <41451839+carbotaniuman@users.noreply.github.com> | 2024-07-29 21:00:09 -0500 | 
| commit | d8bc8761a5bb8456c0b7940434b3b3b4f0ed035c (patch) | |
| tree | 642fc005a468b7831627245b3c316936d8c58e45 /tests/ui/attributes/unsafe/proc-unsafe-attributes.rs | |
| parent | 368e2fd458a22d0cc133d0c254f2612ee999744f (diff) | |
| download | rust-d8bc8761a5bb8456c0b7940434b3b3b4f0ed035c.tar.gz rust-d8bc8761a5bb8456c0b7940434b3b3b4f0ed035c.zip | |
Deny unsafe on more builtin attributes
Diffstat (limited to 'tests/ui/attributes/unsafe/proc-unsafe-attributes.rs')
| -rw-r--r-- | tests/ui/attributes/unsafe/proc-unsafe-attributes.rs | 27 | 
1 files changed, 27 insertions, 0 deletions
| diff --git a/tests/ui/attributes/unsafe/proc-unsafe-attributes.rs b/tests/ui/attributes/unsafe/proc-unsafe-attributes.rs new file mode 100644 index 00000000000..caf6c6dc8ff --- /dev/null +++ b/tests/ui/attributes/unsafe/proc-unsafe-attributes.rs @@ -0,0 +1,27 @@ +#![feature(unsafe_attributes)] + +#[unsafe(proc_macro)] +//~^ ERROR: is not an unsafe attribute +//~| ERROR attribute is only usable with crates of the `proc-macro` crate type +pub fn a() {} + + +#[unsafe(proc_macro_derive(Foo))] +//~^ ERROR: is not an unsafe attribute +//~| ERROR attribute is only usable with crates of the `proc-macro` crate type +pub fn b() {} + +#[proc_macro_derive(unsafe(Foo))] +//~^ ERROR attribute is only usable with crates of the `proc-macro` crate type +pub fn c() {} + +#[unsafe(proc_macro_attribute)] +//~^ ERROR: is not an unsafe attribute +//~| ERROR attribute is only usable with crates of the `proc-macro` crate type +pub fn d() {} + +#[unsafe(allow(dead_code))] +//~^ ERROR: is not an unsafe attribute +pub fn e() {} + +fn main() {} | 
