]>
Commit | Line | Data |
---|---|---|
3b2f2976 XL |
1 | // Copyright 2017 The Rust Project Developers. See the COPYRIGHT |
2 | // file at the top-level directory of this distribution and at | |
3 | // http://rust-lang.org/COPYRIGHT. | |
4 | // | |
5 | // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or | |
6 | // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license | |
7 | // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your | |
8 | // option. This file may not be copied, modified, or distributed | |
9 | // except according to those terms. | |
10 | ||
11 | // At time of authorship, #[proc_macro_derive = "2500"] will emit an | |
12 | // error when it occurs on a mod (apart from crate-level), but will | |
13 | // not descend further into the mod for other occurrences of the same | |
14 | // error. | |
15 | // | |
16 | // This file sits on its own because the the "weird" occurrences here | |
17 | // signal errors, making it incompatible with the "warnings only" | |
18 | // nature of issue-43106-gating-of-builtin-attrs.rs | |
19 | ||
20 | #[proc_macro_derive = "2500"] | |
21 | //~^ ERROR the `#[proc_macro_derive]` attribute may only be used on bare functions | |
22 | mod proc_macro_derive1 { | |
23 | mod inner { #![proc_macro_derive="2500"] } | |
24 | // (no error issued here if there was one on outer module) | |
25 | } | |
26 | ||
27 | mod proc_macro_derive2 { | |
28 | mod inner { #![proc_macro_derive="2500"] } | |
29 | //~^ ERROR the `#[proc_macro_derive]` attribute may only be used on bare functions | |
30 | ||
31 | #[proc_macro_derive = "2500"] fn f() { } | |
32 | //~^ ERROR the `#[proc_macro_derive]` attribute is only usable with crates of the `proc-macro` | |
33 | ||
34 | #[proc_macro_derive = "2500"] struct S; | |
35 | //~^ ERROR the `#[proc_macro_derive]` attribute may only be used on bare functions | |
36 | ||
37 | #[proc_macro_derive = "2500"] type T = S; | |
38 | //~^ ERROR the `#[proc_macro_derive]` attribute may only be used on bare functions | |
39 | ||
40 | #[proc_macro_derive = "2500"] impl S { } | |
41 | //~^ ERROR the `#[proc_macro_derive]` attribute may only be used on bare functions | |
42 | } | |
0531ce1d XL |
43 | |
44 | fn main() {} |