1 // This file tests repr(transparent)-related errors reported during typeck. Other errors
2 // that are reported earlier and therefore preempt these are tested in:
3 // - repr-transparent-other-reprs.rs
4 // - repr-transparent-other-items.rs
6 #![feature(repr_align)]
8 use std::marker::PhantomData;
11 struct NoFields; //~ ERROR needs exactly one non-zero-sized field
14 struct ContainsOnlyZst(()); //~ ERROR needs exactly one non-zero-sized field
17 struct ContainsOnlyZstArray([bool; 0]); //~ ERROR needs exactly one non-zero-sized field
20 struct ContainsMultipleZst(PhantomData<*const i32>, NoFields);
21 //~^ ERROR needs exactly one non-zero-sized field
24 struct MultipleNonZst(u8, u8); //~ ERROR needs exactly one non-zero-sized field
26 trait Mirror { type It: ?Sized; }
27 impl<T: ?Sized> Mirror for T { type It = Self; }
30 pub struct StructWithProjection(f32, <f32 as Mirror>::It);
31 //~^ ERROR needs exactly one non-zero-sized field
34 struct NontrivialAlignZst(u32, [u16; 0]); //~ ERROR alignment larger than 1
37 struct ZstAlign32<T>(PhantomData<T>);
40 struct GenericAlign<T>(ZstAlign32<T>, u32); //~ ERROR alignment larger than 1