mirror of
https://github.com/rust-lang/rust.git
synced 2025-06-19 11:07:32 +00:00

This makes it possible for the `unsafe(...)` syntax to only be valid at the top level, and the `NestedMetaItem`s will automatically reject `unsafe(...)`.
38 lines
1.1 KiB
Rust
38 lines
1.1 KiB
Rust
#![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
|
|
//~| ERROR: expected identifier, found keyword `unsafe`
|
|
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() {}
|
|
|
|
#[unsafe(allow(unsafe(dead_code)))]
|
|
//~^ ERROR: is not an unsafe attribute
|
|
//~| ERROR: malformed lint attribute input
|
|
//~| ERROR: malformed lint attribute input
|
|
//~| ERROR: expected identifier, found keyword `unsafe`
|
|
//~| ERROR: malformed lint attribute input
|
|
//~| ERROR: malformed lint attribute input
|
|
pub fn f() {}
|
|
|
|
fn main() {}
|