]>
Commit | Line | Data |
---|---|---|
ea8adc8c XL |
1 | // `#![derive]` raises errors when it occurs at contexts other than ADT |
2 | // definitions. | |
3b2f2976 | 3 | |
3b2f2976 XL |
4 | #[derive(Debug)] |
5 | //~^ ERROR `derive` may only be applied to structs, enums and unions | |
6 | mod derive { | |
7 | mod inner { #![derive(Debug)] } | |
8 | //~^ ERROR `derive` may only be applied to structs, enums and unions | |
9 | ||
10 | #[derive(Debug)] | |
11 | //~^ ERROR `derive` may only be applied to structs, enums and unions | |
12 | fn derive() { } | |
13 | ||
14 | #[derive(Copy, Clone)] // (can't derive Debug for unions) | |
15 | union U { f: i32 } | |
16 | ||
17 | #[derive(Debug)] | |
18 | struct S; | |
19 | ||
20 | #[derive(Debug)] | |
21 | enum E { } | |
22 | ||
23 | #[derive(Debug)] | |
24 | //~^ ERROR `derive` may only be applied to structs, enums and unions | |
25 | type T = S; | |
26 | ||
27 | #[derive(Debug)] | |
28 | //~^ ERROR `derive` may only be applied to structs, enums and unions | |
29 | impl S { } | |
30 | } | |
0731742a XL |
31 | |
32 | fn main() {} |