rust/tests/ui/attributes/unsafe/derive-unsafe-attributes.rs
carbotaniuman 49db8a5a99 Add toggle for parse_meta_item unsafe parsing
This makes it possible for the `unsafe(...)` syntax to only be
valid at the top level, and the `NestedMetaItem`s will automatically
reject `unsafe(...)`.
2024-07-30 18:28:43 -05:00

16 lines
513 B
Rust

#![feature(unsafe_attributes)]
#[derive(unsafe(Debug))]
//~^ ERROR: expected identifier, found keyword `unsafe`
//~| ERROR: traits in `#[derive(...)]` don't accept arguments
//~| ERROR: expected identifier, found keyword `unsafe`
//~| ERROR: expected identifier, found keyword `unsafe`
//~| ERROR: cannot find derive macro `r#unsafe` in this scope
//~| ERROR: cannot find derive macro `r#unsafe` in this scope
struct Foo;
#[unsafe(derive(Debug))] //~ ERROR: is not an unsafe attribute
struct Bar;
fn main() {}