1 #![feature(rustc_attrs)]
3 // Regression test for #56877. We want to ensure that the presence of
4 // `PhantomData` does not prevent `Bar` from being considered a
5 // homogeneous aggregate.
14 pub struct WithPhantomData {
17 pub _unit: std::marker::PhantomData<()>,
20 pub struct EmptyRustStruct {
24 pub struct WithEmptyRustStruct {
27 pub _unit: EmptyRustStruct,
30 pub struct TransitivelyEmptyRustStruct {
31 field: EmptyRustStruct,
36 pub struct WithTransitivelyEmptyRustStruct {
39 pub _unit: TransitivelyEmptyRustStruct,
42 pub enum EmptyRustEnum {
47 pub struct WithEmptyRustEnum {
50 pub _unit: EmptyRustEnum,
53 #[rustc_layout(homogeneous_aggregate)]
54 pub type Test1 = BaseCase;
55 //~^ ERROR homogeneous_aggregate: Ok(Homogeneous(Reg { kind: Float, size: Size { raw: 4 } }))
57 #[rustc_layout(homogeneous_aggregate)]
58 pub type Test2 = WithPhantomData;
59 //~^ ERROR homogeneous_aggregate: Ok(Homogeneous(Reg { kind: Float, size: Size { raw: 4 } }))
61 #[rustc_layout(homogeneous_aggregate)]
62 pub type Test3 = WithEmptyRustStruct;
63 //~^ ERROR homogeneous_aggregate: Ok(Homogeneous(Reg { kind: Float, size: Size { raw: 4 } }))
65 #[rustc_layout(homogeneous_aggregate)]
66 pub type Test4 = WithTransitivelyEmptyRustStruct;
67 //~^ ERROR homogeneous_aggregate: Ok(Homogeneous(Reg { kind: Float, size: Size { raw: 4 } }))
69 #[rustc_layout(homogeneous_aggregate)]
70 pub type Test5 = WithEmptyRustEnum;
71 //~^ ERROR homogeneous_aggregate: Ok(Homogeneous(Reg { kind: Float, size: Size { raw: 4 } }))