Skip to content

Commit f12e92e

Browse files
Add
1 parent 9cb02c0 commit f12e92e

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

src/type-layout.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,9 @@ r[layout.repr.c.struct]
200200
r[layout.repr.c.struct.align]
201201
The alignment of the struct is the alignment of the most-aligned field in it.
202202

203+
r[layout.repr.c.struct.align-empty]
204+
Structs with no fields are guaranteed to have alignment of 1.
205+
203206
r[layout.repr.c.struct.size-field-offset]
204207
The size and offset of fields is determined by the following algorithm.
205208

@@ -249,8 +252,7 @@ impl UserStruct {
249252
// "The alignment of the struct is the alignment of the most-aligned
250253
// field in it."
251254
let max_alignment = fields.iter().map(|field| field.alignment).max();
252-
// max_alignment is None iff there are no fields, in which case the
253-
// overall alignment is 1 (the minimum).
255+
// "Structs with no fields are guaranteed to have alignment of 1."
254256
let alignment = max_alignment.unwrap_or(1);
255257

256258
// "Start with a current offset of 0 bytes."

0 commit comments

Comments
 (0)