Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document the enum changes in RFC 2195 #879

Merged
merged 10 commits into from
Sep 4, 2020
6 changes: 4 additions & 2 deletions src/type-layout.md
Original file line number Diff line number Diff line change
Expand Up @@ -440,12 +440,14 @@ struct MyVariantD(MyEnumDiscriminant);

> Note: `union`s with non-`Copy` fields are unstable, see [55149].

Combining the `repr(C)` and a primitive representation is only defined for enums
with fields. The primitive representation modifies the `repr(C)` by changing the
For enums with fields, it is also possible to combining `repr(C)` and a
poliorcetics marked this conversation as resolved.
Show resolved Hide resolved
primitive representation. This modifies the [`repr(C)`] by changing the
poliorcetics marked this conversation as resolved.
Show resolved Hide resolved
representation of the discriminant enum to have the representation of the chosen
primitive representation. So, if you chose the `u8` representation, then the
poliorcetics marked this conversation as resolved.
Show resolved Hide resolved
discriminant enum would have a size and alignment of 1 byte.

[`repr(C)`]: #reprc-enums-with-fields

### The alignment modifiers

The `align` and `packed` modifiers can be used to respectively raise or lower
Expand Down