@@ -223,6 +223,7 @@ A type is zero sized (a ZST) if its size is 0. Such types have at most one possi
223223- ` repr(Rust) ` [ structs] with no fields or where all fields are zero-sized (see [ layout.repr.rust.struct-zst] ).
224224- ` repr(C) ` [ structs] with no fields or where all fields are zero-sized (see [ layout.repr.c.struct.size-field-offset] ).
225225- ` repr(transparent) ` [ structs] with no fields or where all fields are zero-sized (see [ layout.repr.transparent.layout-abi] ).
226+ - ` repr(Rust) ` [ enums] with a single struct-like variant with no fields or where all fields are zero-sized (see [ layout.repr.rust.enum-struct-like-zst] )
226227- [ Arrays] of zero-sized types (see [ layout.array] ).
227228- [ Arrays] of length zero (see [ layout.array] ).
228229- [ Unions] of zero-sized types (see [ items.union.common-storage] ).
@@ -261,6 +262,9 @@ union U {
261262 f2 : [(); 10 ],
262263 f3 : [u8 ; 0 ],
263264}
265+ enum E2 {
266+ V1 { f1 : (), f2 : [(); 10 ] },
267+ }
264268assert_eq! (0 , size_of :: <()>());
265269assert_eq! (0 , size_of_val (& f ));
266270assert_eq! (0 , size_of_val (& S ));
@@ -275,6 +279,7 @@ assert_eq!(0, size_of::<T2>());
275279assert_eq! (0 , size_of :: <[(); 10 ]>());
276280assert_eq! (0 , size_of :: <[u8 ; 0 ]>());
277281assert_eq! (0 , size_of :: <U >());
282+ assert_eq! (0 , size_of :: <E2 >());
278283```
279284
280285[ `extern` blocks ] : items.extern
0 commit comments