Skip to content

Commit ccce616

Browse files
committed
Ralf feedback
1 parent 83e9f3d commit ccce616

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

reference/src/layout/unions.md

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ overlap. This can be visualized as follows:
1818
[ <---> [field2_ty] <---> ]
1919
```
2020

21-
> **Figure: union field layout**: Each row in the picture shows the layout of
22-
> the union for each of its fields, where the square brackets `[]` depict an
23-
> array of bytes, `<-...->` denotes different amount of [padding], and
24-
> `[field{i}_ty]` is the bytes of the type of the `i`-th union field.
21+
**Figure 1** (union-field layout): Each row in the picture shows the layout of
22+
the union for each of its variants. The `<-...->` and `[ ... ]` denote the
23+
differently-sized gaps and fields, respectively and the `[field{i}_ty]` are the
24+
bytes of the type of the `i`-th union field.
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
@@ -59,11 +59,8 @@ you have to use `#[repr(C)]`.
5959

6060
#### Layout of unions with a single non-zero-sized field
6161

62-
The layout of unions with a single non-zero-sized field is the same as the
63-
layout of that field if:
64-
65-
* all zero-sized fields are [1-ZST], and
66-
* the non-zero sized field has no padding bits.
62+
The layout of unions with a single single non-[1-ZST]-field" is the same as the
63+
layout of that field if it has no [padding] bytes.
6764

6865
For example, here:
6966

0 commit comments

Comments
 (0)