File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -200,6 +200,9 @@ r[layout.repr.c.struct]
200200r[ layout.repr.c.struct.align]
201201The 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+
203206r[ layout.repr.c.struct.size-field-offset]
204207The 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."
You can’t perform that action at this time.
0 commit comments