File tree Expand file tree Collapse file tree 2 files changed +33
-2
lines changed Expand file tree Collapse file tree 2 files changed +33
-2
lines changed Original file line number Diff line number Diff line change @@ -56,6 +56,10 @@ union P3 { x: F32x4 } //~ ERROR: layout_of
5656#[ repr( packed( 1 ) ) ]
5757union P4 { x : E } //~ ERROR: layout_of
5858
59+ #[ rustc_layout( debug) ]
60+ #[ repr( packed( 1 ) ) ]
61+ union P5 { zst : [ u16 ; 0 ] , byte : u8 } //~ ERROR: layout_of
62+
5963#[ rustc_layout( debug) ]
6064type X = std:: mem:: MaybeUninit < u8 > ; //~ ERROR: layout_of
6165
Original file line number Diff line number Diff line change @@ -461,6 +461,33 @@ error: layout_of(P4) = Layout {
461461LL | union P4 { x: E }
462462 | ^^^^^^^^
463463
464+ error: layout_of(P5) = Layout {
465+ size: Size(1 bytes),
466+ align: AbiAndPrefAlign {
467+ abi: Align(1 bytes),
468+ pref: $PREF_ALIGN,
469+ },
470+ abi: Scalar(
471+ Union {
472+ value: Int(
473+ I8,
474+ false,
475+ ),
476+ },
477+ ),
478+ fields: Union(
479+ 2,
480+ ),
481+ largest_niche: None,
482+ variants: Single {
483+ index: 0,
484+ },
485+ }
486+ --> $DIR/debug.rs:61:1
487+ |
488+ LL | union P5 { zst: [u16; 0], byte: u8 }
489+ | ^^^^^^^^
490+
464491error: layout_of(std::mem::MaybeUninit<u8>) = Layout {
465492 size: Size(1 bytes),
466493 align: AbiAndPrefAlign {
@@ -483,10 +510,10 @@ error: layout_of(std::mem::MaybeUninit<u8>) = Layout {
483510 index: 0,
484511 },
485512 }
486- --> $DIR/debug.rs:60 :1
513+ --> $DIR/debug.rs:64 :1
487514 |
488515LL | type X = std::mem::MaybeUninit<u8>;
489516 | ^^^^^^
490517
491- error: aborting due to 13 previous errors
518+ error: aborting due to 14 previous errors
492519
You can’t perform that action at this time.
0 commit comments