Skip to content

Commit 597d727

Browse files
Centrilehuss
andauthored
Apply suggestions from Centril
Co-Authored-By: ehuss <eric@huss.org>
1 parent a5852dd commit 597d727

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

src/type-layout.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,8 @@ struct ThreeInts {
128128
```
129129

130130
The alignment may be raised or lowered with the `align` and `packed` modifiers
131-
respectively. They alter the representation specified in the attribute:
131+
respectively. They alter the representation specified in the attribute.
132+
If no representation is specified, the default one is altered.
132133

133134
```rust
134135
// Default representation, alignment lowered to 2.
@@ -156,7 +157,7 @@ struct AlignedStruct {
156157
The representation of a type can change the padding between fields, but does
157158
not change the layout of the fields themselves. For example, a struct with a
158159
`C` representation that contains a struct `Inner` with the default
159-
representation will not change the layout of Inner.
160+
representation will not change the layout of `Inner`.
160161

161162
### The Default Representation
162163

@@ -317,13 +318,13 @@ only be applied to the default and `C` representations.
317318
The `packed` modifier can be used on `struct`s and `union`s to lower the
318319
alignment of the type to a given value.
319320

320-
The packing value is specified as an integer parameter in the form of
321+
The packing value (hence: "value") is specified as an integer parameter in the form of
321322
`#[repr(packed(x))]`. If no value is given, as in `#[repr(packed)]`, then the
322-
packing value is 1. The packing value must be a power of two from 1 up to
323+
value is 1. The value must be a power of two from 1 up to
323324
2<sup>29</sup>.
324325

325-
The `packed` modifier lowers the type's alignment to the specified packing. If
326-
the specified packing is greater to the alignment of the type without the
326+
The `packed` modifier lowers the type's alignment to the specified value. If
327+
the specified value is greater than the type's alignment without the
327328
`packed` modifier, then the alignment and layout is unaffected. The alignments
328329
of each field, for the purpose of positioning fields, is the smaller of the
329330
specified packing and the alignment of the field's type.

0 commit comments

Comments
 (0)