]>
Commit | Line | Data |
---|---|---|
ea8adc8c XL |
1 | // `#![derive]` raises errors when it occurs at contexts other than ADT |
2 | // definitions. | |
3b2f2976 | 3 | |
3b2f2976 | 4 | #[derive(Debug)] |
136023e0 | 5 | //~^ ERROR `derive` may only be applied to `struct`s, `enum`s and `union`s |
3b2f2976 XL |
6 | mod derive { |
7 | mod inner { #![derive(Debug)] } | |
136023e0 | 8 | //~^ ERROR `derive` may only be applied to `struct`s, `enum`s and `union`s |
6a06907d | 9 | //~| ERROR inner macro attributes are unstable |
3b2f2976 XL |
10 | |
11 | #[derive(Debug)] | |
136023e0 | 12 | //~^ ERROR `derive` may only be applied to `struct`s, `enum`s and `union`s |
3b2f2976 XL |
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)] | |
136023e0 | 25 | //~^ ERROR `derive` may only be applied to `struct`s, `enum`s and `union`s |
3b2f2976 XL |
26 | type T = S; |
27 | ||
28 | #[derive(Debug)] | |
136023e0 | 29 | //~^ ERROR `derive` may only be applied to `struct`s, `enum`s and `union`s |
3b2f2976 XL |
30 | impl S { } |
31 | } | |
0731742a XL |
32 | |
33 | fn main() {} |