]> git.lizzy.rs Git - rust.git/blob - tests/ui/conflicting-repr-hints.rs
Auto merge of #106825 - weihanglo:update-cargo, r=weihanglo
[rust.git] / tests / ui / conflicting-repr-hints.rs
1 #![allow(dead_code)]
2
3 #[repr(C)]
4 enum A {
5     A,
6 }
7
8 #[repr(u64)]
9 enum B {
10     B,
11 }
12
13 #[repr(C, u64)] //~ ERROR conflicting representation hints
14 //~^ WARN this was previously accepted
15 enum C {
16     C,
17 }
18
19 #[repr(u32, u64)] //~ ERROR conflicting representation hints
20 //~^ WARN this was previously accepted
21 enum D {
22     D,
23 }
24
25 #[repr(C, packed)]
26 struct E(i32);
27
28 #[repr(packed, align(8))]
29 struct F(i32); //~ ERROR type has conflicting packed and align representation hints
30
31 #[repr(packed)]
32 #[repr(align(8))]
33 struct G(i32); //~ ERROR type has conflicting packed and align representation hints
34
35 #[repr(align(8))]
36 #[repr(packed)]
37 struct H(i32); //~ ERROR type has conflicting packed and align representation hints
38
39 #[repr(packed, packed(2))]
40 struct I(i32); //~ ERROR type has conflicting packed representation hints
41
42 #[repr(packed(2))]
43 #[repr(packed)]
44 struct J(i32); //~ ERROR type has conflicting packed representation hints
45
46 #[repr(packed, packed(1))]
47 struct K(i32);
48
49 #[repr(packed, align(8))]
50 union X {
51     //~^ ERROR type has conflicting packed and align representation hints
52     i: i32,
53 }
54
55 #[repr(packed)]
56 #[repr(align(8))]
57 union Y {
58     //~^ ERROR type has conflicting packed and align representation hints
59     i: i32,
60 }
61
62 #[repr(align(8))]
63 #[repr(packed)]
64 union Z {
65     //~^ ERROR type has conflicting packed and align representation hints
66     i: i32,
67 }
68
69 #[repr(packed, align(0x100))]
70 pub struct S(u16); //~ ERROR type has conflicting packed and align representation hints
71
72 #[repr(packed, align(0x100))]
73 pub union U { //~ ERROR type has conflicting packed and align representation hints
74     u: u16
75 }
76
77 static B: U = U { u: 0 };
78 static A: S = S(0);
79
80 fn main() {}