]> git.proxmox.com Git - rustc.git/blame_incremental - src/test/ui/repr/repr-transparent-non-exhaustive.rs
Update unsuspicious file list
[rustc.git] / src / test / ui / repr / repr-transparent-non-exhaustive.rs
... / ...
CommitLineData
1#![deny(repr_transparent_external_private_fields)]
2
3// aux-build: repr-transparent-non-exhaustive.rs
4extern crate repr_transparent_non_exhaustive;
5
6use repr_transparent_non_exhaustive::{
7 Private,
8 NonExhaustive,
9 NonExhaustiveEnum,
10 NonExhaustiveVariant,
11 ExternalIndirection,
12};
13
14pub struct InternalPrivate {
15 _priv: (),
16}
17
18#[non_exhaustive]
19pub struct InternalNonExhaustive;
20
21pub struct InternalIndirection<T> {
22 x: T,
23}
24
25pub type Sized = i32;
26
27#[repr(transparent)]
28pub struct T1(Sized, InternalPrivate);
29#[repr(transparent)]
30pub struct T2(Sized, InternalNonExhaustive);
31#[repr(transparent)]
32pub struct T3(Sized, InternalIndirection<(InternalPrivate, InternalNonExhaustive)>);
33#[repr(transparent)]
34pub struct T4(Sized, ExternalIndirection<(InternalPrivate, InternalNonExhaustive)>);
35
36#[repr(transparent)]
37pub 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)]
42pub 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)]
47pub 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)]
52pub 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)]
57pub 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)]
62pub 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)]
67pub 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)]
72pub 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)]
77pub 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)]
82pub 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)]
87pub 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)]
92pub 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
96fn main() {}