Skip to content

Commit 9c0e24b

Browse files
authored
Merge pull request #1568 from compiler-errors/repr-transparent
Tweak `repr(transparent)` to mention requiring *at most* one non-1-ZST
2 parents b1fced7 + 8154cd1 commit 9c0e24b

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/type-layout.md

+3-4
Original file line numberDiff line numberDiff line change
@@ -585,12 +585,11 @@ was wrapped in a newtype `struct` with the same `align` modifier.
585585
586586
The `transparent` representation can only be used on a [`struct`][structs]
587587
or an [`enum`][enumerations] with a single variant that has:
588-
589-
- a single field with non-zero size, and
590-
- any number of fields with size 0 and alignment 1 (e.g. [`PhantomData<T>`]).
588+
- any number of fields with size 0 and alignment 1 (e.g. [`PhantomData<T>`]), and
589+
- at most one other field.
591590
592591
Structs and enums with this representation have the same layout and ABI
593-
as the single non-zero sized field.
592+
as the only non-size 0 non-alignment 1 field, if present, or unit otherwise.
594593
595594
This is different than the `C` representation because
596595
a struct with the `C` representation will always have the ABI of a `C` `struct`

0 commit comments

Comments
 (0)