about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/doc/unstable-book/src/language-features/repr-align-enum.md16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/doc/unstable-book/src/language-features/repr-align-enum.md b/src/doc/unstable-book/src/language-features/repr-align-enum.md
index 1fd9bd20f3f..415c6ebe8b4 100644
--- a/src/doc/unstable-book/src/language-features/repr-align-enum.md
+++ b/src/doc/unstable-book/src/language-features/repr-align-enum.md
@@ -24,3 +24,19 @@ fn main() {
     assert_eq!(std::mem::align_of::<Aligned>(), 8);
 }
 ```
+
+This is equivalent to using an aligned wrapper struct everywhere:
+
+```rust
+#[repr(align(8))]
+struct Aligned(Unaligned);
+
+enum Unaligned {
+    Foo,
+    Bar { value: u32 },
+}
+
+fn main() {
+    assert_eq!(std::mem::align_of::<Aligned>(), 8);
+}
+```