]> git.proxmox.com Git - rustc.git/blob - src/test/ui/repr/repr-transparent-non-exhaustive.rs
Update unsuspicious file list
[rustc.git] / src / test / ui / repr / repr-transparent-non-exhaustive.rs
1 #![deny(repr_transparent_external_private_fields)]
2
3 // aux-build: repr-transparent-non-exhaustive.rs
4 extern crate repr_transparent_non_exhaustive;
5
6 use repr_transparent_non_exhaustive::{
7 Private,
8 NonExhaustive,
9 NonExhaustiveEnum,
10 NonExhaustiveVariant,
11 ExternalIndirection,
12 };
13
14 pub struct InternalPrivate {
15 _priv: (),
16 }
17
18 #[non_exhaustive]
19 pub struct InternalNonExhaustive;
20
21 pub struct InternalIndirection<T> {
22 x: T,
23 }
24
25 pub type Sized = i32;
26
27 #[repr(transparent)]
28 pub struct T1(Sized, InternalPrivate);
29 #[repr(transparent)]
30 pub struct T2(Sized, InternalNonExhaustive);
31 #[repr(transparent)]
32 pub struct T3(Sized, InternalIndirection<(InternalPrivate, InternalNonExhaustive)>);
33 #[repr(transparent)]
34 pub struct T4(Sized, ExternalIndirection<(InternalPrivate, InternalNonExhaustive)>);
35
36 #[repr(transparent)]
37 pub struct T5(Sized, Private);
38 //~^ ERROR zero-sized fields in `repr(transparent)` cannot contain external non-exhaustive types
39 //~| WARN this was previously accepted by the compiler
40
41 #[repr(transparent)]
42 pub struct T6(Sized, NonExhaustive);
43 //~^ ERROR zero-sized fields in `repr(transparent)` cannot contain external non-exhaustive types
44 //~| WARN this was previously accepted by the compiler
45
46 #[repr(transparent)]
47 pub struct T7(Sized, NonExhaustiveEnum);
48 //~^ ERROR zero-sized fields in `repr(transparent)` cannot contain external non-exhaustive types
49 //~| WARN this was previously accepted by the compiler
50
51 #[repr(transparent)]
52 pub struct T8(Sized, NonExhaustiveVariant);
53 //~^ ERROR zero-sized fields in `repr(transparent)` cannot contain external non-exhaustive types
54 //~| WARN this was previously accepted by the compiler
55
56 #[repr(transparent)]
57 pub struct T9(Sized, InternalIndirection<Private>);
58 //~^ ERROR zero-sized fields in `repr(transparent)` cannot contain external non-exhaustive types
59 //~| WARN this was previously accepted by the compiler
60
61 #[repr(transparent)]
62 pub struct T10(Sized, InternalIndirection<NonExhaustive>);
63 //~^ ERROR zero-sized fields in `repr(transparent)` cannot contain external non-exhaustive types
64 //~| WARN this was previously accepted by the compiler
65
66 #[repr(transparent)]
67 pub struct T11(Sized, InternalIndirection<NonExhaustiveEnum>);
68 //~^ ERROR zero-sized fields in `repr(transparent)` cannot contain external non-exhaustive types
69 //~| WARN this was previously accepted by the compiler
70
71 #[repr(transparent)]
72 pub struct T12(Sized, InternalIndirection<NonExhaustiveVariant>);
73 //~^ ERROR zero-sized fields in `repr(transparent)` cannot contain external non-exhaustive types
74 //~| WARN this was previously accepted by the compiler
75
76 #[repr(transparent)]
77 pub struct T13(Sized, ExternalIndirection<Private>);
78 //~^ ERROR zero-sized fields in `repr(transparent)` cannot contain external non-exhaustive types
79 //~| WARN this was previously accepted by the compiler
80
81 #[repr(transparent)]
82 pub struct T14(Sized, ExternalIndirection<NonExhaustive>);
83 //~^ ERROR zero-sized fields in `repr(transparent)` cannot contain external non-exhaustive types
84 //~| WARN this was previously accepted by the compiler
85
86 #[repr(transparent)]
87 pub struct T15(Sized, ExternalIndirection<NonExhaustiveEnum>);
88 //~^ ERROR zero-sized fields in `repr(transparent)` cannot contain external non-exhaustive types
89 //~| WARN this was previously accepted by the compiler
90
91 #[repr(transparent)]
92 pub struct T16(Sized, ExternalIndirection<NonExhaustiveVariant>);
93 //~^ ERROR zero-sized fields in `repr(transparent)` cannot contain external non-exhaustive types
94 //~| WARN this was previously accepted by the compiler
95
96 fn main() {}