Skip to content

Commit e8a9c67

Browse files
committed
Clarify size of union
1 parent f6a7ee3 commit e8a9c67

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

reference/src/layout/unions.md

+5-4
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,11 @@ overlap. This can be visualized as follows:
2525
2626
The individual fields (`[field{i}_ty_]`) are blocks of fixed size determined by
2727
the field's layout. The only degrees of freedom the compiler has when computing
28-
the layout of a union are the size of the union and the offset of each union
29-
field within its variant. How these are picked depends on certain constraints,
30-
lik for example, the alignment requirements of the fields, the `#[repr]`
31-
attribute of the `union`, etc.
28+
the layout of a union are the size of the union, which can be larger than the
29+
size of its largest field, and the offset of each union field within its
30+
variant. How these are picked depends on certain constraints, lik for example,
31+
the alignment requirements of the fields, the `#[repr]` attribute of the
32+
`union`, etc.
3233

3334
### Unions with default layout ("`repr(Rust)`")
3435

0 commit comments

Comments
 (0)