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 {}
23 pub struct WithEmptyRustStruct {
26 pub _unit: EmptyRustStruct,
29 pub struct TransitivelyEmptyRustStruct {
30 field: EmptyRustStruct,
35 pub struct WithTransitivelyEmptyRustStruct {
38 pub _unit: TransitivelyEmptyRustStruct,
41 pub enum EmptyRustEnum {
46 pub struct WithEmptyRustEnum {
49 pub _unit: EmptyRustEnum,
52 #[rustc_layout(homogeneous_aggregate)]
53 pub type Test1 = BaseCase;
54 //~^ ERROR homogeneous_aggregate: Ok(Homogeneous(Reg { kind: Float, size: Size(4 bytes) }))
56 #[rustc_layout(homogeneous_aggregate)]
57 pub type Test2 = WithPhantomData;
58 //~^ ERROR homogeneous_aggregate: Ok(Homogeneous(Reg { kind: Float, size: Size(4 bytes) }))
60 #[rustc_layout(homogeneous_aggregate)]
61 pub type Test3 = WithEmptyRustStruct;
62 //~^ ERROR homogeneous_aggregate: Ok(Homogeneous(Reg { kind: Float, size: Size(4 bytes) }))
64 #[rustc_layout(homogeneous_aggregate)]
65 pub type Test4 = WithTransitivelyEmptyRustStruct;
66 //~^ ERROR homogeneous_aggregate: Ok(Homogeneous(Reg { kind: Float, size: Size(4 bytes) }))
68 #[rustc_layout(homogeneous_aggregate)]
69 pub type Test5 = WithEmptyRustEnum;
70 //~^ ERROR homogeneous_aggregate: Ok(Homogeneous(Reg { kind: Float, size: Size(4 bytes) }))