2017-07-11 07:30:10 -05:00
|
|
|
// At time of authorship, #[proc_macro_derive = "2500"] will emit an
|
|
|
|
// error when it occurs on a mod (apart from crate-level), but will
|
|
|
|
// not descend further into the mod for other occurrences of the same
|
|
|
|
// error.
|
|
|
|
//
|
2018-11-11 07:52:36 -06:00
|
|
|
// This file sits on its own because the "weird" occurrences here
|
2017-07-11 07:30:10 -05:00
|
|
|
// signal errors, making it incompatible with the "warnings only"
|
|
|
|
// nature of issue-43106-gating-of-builtin-attrs.rs
|
|
|
|
|
2019-01-01 17:21:05 -06:00
|
|
|
#[proc_macro_derive()]
|
2017-07-11 07:30:10 -05:00
|
|
|
//~^ ERROR the `#[proc_macro_derive]` attribute may only be used on bare functions
|
|
|
|
mod proc_macro_derive1 {
|
2019-01-01 17:21:05 -06:00
|
|
|
mod inner { #![proc_macro_derive()] }
|
2017-07-11 07:30:10 -05:00
|
|
|
// (no error issued here if there was one on outer module)
|
|
|
|
}
|
|
|
|
|
|
|
|
mod proc_macro_derive2 {
|
2019-01-01 17:21:05 -06:00
|
|
|
mod inner { #![proc_macro_derive()] }
|
2017-07-11 07:30:10 -05:00
|
|
|
//~^ ERROR the `#[proc_macro_derive]` attribute may only be used on bare functions
|
|
|
|
|
2019-01-01 17:21:05 -06:00
|
|
|
#[proc_macro_derive()] fn f() { }
|
2017-07-11 07:30:10 -05:00
|
|
|
//~^ ERROR the `#[proc_macro_derive]` attribute is only usable with crates of the `proc-macro`
|
|
|
|
|
2019-01-01 17:21:05 -06:00
|
|
|
#[proc_macro_derive()] struct S;
|
2017-07-11 07:30:10 -05:00
|
|
|
//~^ ERROR the `#[proc_macro_derive]` attribute may only be used on bare functions
|
|
|
|
|
2019-01-01 17:21:05 -06:00
|
|
|
#[proc_macro_derive()] type T = S;
|
2017-07-11 07:30:10 -05:00
|
|
|
//~^ ERROR the `#[proc_macro_derive]` attribute may only be used on bare functions
|
|
|
|
|
2019-01-01 17:21:05 -06:00
|
|
|
#[proc_macro_derive()] impl S { }
|
2017-07-11 07:30:10 -05:00
|
|
|
//~^ ERROR the `#[proc_macro_derive]` attribute may only be used on bare functions
|
|
|
|
}
|
2018-03-12 15:21:43 -05:00
|
|
|
|
|
|
|
fn main() {}
|