]> git.lizzy.rs Git - rust.git/blob - src/test/ui/feature-gates/issue-43106-gating-of-derive.rs
parser will not give wrong help message for 'public'
[rust.git] / src / test / ui / feature-gates / issue-43106-gating-of-derive.rs
1 // `#![derive]` raises errors when it occurs at contexts other than ADT
2 // definitions.
3
4 #[derive(Debug)]
5 //~^ ERROR `derive` may only be applied to `struct`s, `enum`s and `union`s
6 mod derive {
7     mod inner { #![derive(Debug)] }
8     //~^ ERROR `derive` may only be applied to `struct`s, `enum`s and `union`s
9     //~| ERROR inner macro attributes are unstable
10
11     #[derive(Debug)]
12     //~^ ERROR `derive` may only be applied to `struct`s, `enum`s and `union`s
13     fn derive() { }
14
15     #[derive(Copy, Clone)] // (can't derive Debug for unions)
16     union U { f: i32 }
17
18     #[derive(Debug)]
19     struct S;
20
21     #[derive(Debug)]
22     enum E { }
23
24     #[derive(Debug)]
25     //~^ ERROR `derive` may only be applied to `struct`s, `enum`s and `union`s
26     type T = S;
27
28     #[derive(Debug)]
29     //~^ ERROR `derive` may only be applied to `struct`s, `enum`s and `union`s
30     impl S { }
31 }
32
33 fn main() {}