1 // At time of authorship, #[proc_macro_derive = "2500"] will emit an
2 // error when it occurs on a mod (apart from crate-level), but will
3 // not descend further into the mod for other occurrences of the same
6 // This file sits on its own because the "weird" occurrences here
7 // signal errors, making it incompatible with the "warnings only"
8 // nature of issue-43106-gating-of-builtin-attrs.rs
10 #[proc_macro_derive()]
11 //~^ ERROR the `#[proc_macro_derive]` attribute may only be used on bare functions
12 mod proc_macro_derive1 {
13 mod inner { #![proc_macro_derive()] }
14 // (no error issued here if there was one on outer module)
17 mod proc_macro_derive2 {
18 mod inner { #![proc_macro_derive()] }
19 //~^ ERROR the `#[proc_macro_derive]` attribute may only be used on bare functions
21 #[proc_macro_derive()] fn f() { }
22 //~^ ERROR the `#[proc_macro_derive]` attribute is only usable with crates of the `proc-macro`
24 #[proc_macro_derive()] struct S;
25 //~^ ERROR the `#[proc_macro_derive]` attribute may only be used on bare functions
27 #[proc_macro_derive()] type T = S;
28 //~^ ERROR the `#[proc_macro_derive]` attribute may only be used on bare functions
30 #[proc_macro_derive()] impl S { }
31 //~^ ERROR the `#[proc_macro_derive]` attribute may only be used on bare functions