Skip to content

Commit c2e6c9a

Browse files
committed
Fields must fit in the struct
1 parent 91f1444 commit c2e6c9a

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/type-layout.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,7 @@ The only data layout guarantees made by this representation are those required f
168168

169169
1. The offset of a field is divisible by that field's alignment.
170170
2. The alignment of the type is at least the maximum alignment of its fields.
171+
3. For any field, its offset plus its size is at most the size of the struct.
171172

172173
r[layout.repr.rust.layout.struct]
173174
For [structs], it is further guaranteed that the fields do not overlap. That is, the fields can be ordered such that the offset plus the size of any field is less than or equal to the offset of the next field in the ordering. The ordering does not have to be the same as the order in which the fields are specified in the declaration of the type.

0 commit comments

Comments
 (0)