Skip to content

Commit 95cb608

Browse files
authored
Merge pull request #619 from rust-lang-nursery/repr-align-enum-docs
Describe `#[repr(align(x))]` semantics on `enum`s
2 parents 1ed0941 + 4bc6227 commit 95cb608

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/type-layout.md

+4
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,10 @@ The `align` and `packed` modifiers cannot be applied on the same type and a
322322
`packed` type cannot transitively contain another `align`ed type. `align` and
323323
`packed` may only be applied to the [default] and [`C`] representations.
324324

325+
The `align` modifier can also be applied on an `enum`.
326+
When it is, the effect on the `enum`'s alignment is the same as if the `enum`
327+
was wrapped in a newtype `struct` with the same `align` modifier.
328+
325329
<div class="warning">
326330

327331
***Warning:*** Dereferencing an unaligned pointer is [undefined behavior] and

0 commit comments

Comments
 (0)