File tree Expand file tree Collapse file tree 1 file changed +6
-9
lines changed Expand file tree Collapse file tree 1 file changed +6
-9
lines changed Original file line number Diff line number Diff line change @@ -18,10 +18,10 @@ overlap. This can be visualized as follows:
18
18
[ <---> [field2_ty] <---> ]
19
19
```
20
20
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.
25
25
26
26
The individual fields (` [field{i}_ty_] ` ) are blocks of fixed size determined by
27
27
the field's [ layout] . The only degrees of freedom the compiler has when
@@ -59,11 +59,8 @@ you have to use `#[repr(C)]`.
59
59
60
60
#### Layout of unions with a single non-zero-sized field
61
61
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.
67
64
68
65
For example, here:
69
66
You can’t perform that action at this time.
0 commit comments