]> git.proxmox.com Git - rustc.git/blob - src/test/ui/feature-gate/issue-43106-gating-of-derive.rs
New upstream version 1.50.0+dfsg1
[rustc.git] / src / test / ui / feature-gate / 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 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 }
31
32 fn main() {}