From 8d2c69aad62d72897ee9f1edd54f6a80cef777a5 Mon Sep 17 00:00:00 2001 From: Daniel Scherzer Date: Tue, 5 May 2026 12:52:15 -0700 Subject: [PATCH 1/2] New rule `layout.repr.c.struct.align-empty` --- src/type-layout.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/type-layout.md b/src/type-layout.md index 2ee902aef0..a7d28ebdce 100644 --- a/src/type-layout.md +++ b/src/type-layout.md @@ -200,6 +200,9 @@ r[layout.repr.c.struct] r[layout.repr.c.struct.align] The alignment of the struct is the alignment of the most-aligned field in it. +r[layout.repr.c.struct.align-empty] +The alignment of a struct with no fields is 1. + r[layout.repr.c.struct.size-field-offset] The size and offset of fields is determined by the following algorithm. From c6d66b2fa3ca201b69de649099d59e5fa1ef487d Mon Sep 17 00:00:00 2001 From: Daniel Scherzer Date: Sun, 24 May 2026 10:59:27 -0700 Subject: [PATCH 2/2] Merge `layout.repr.c.struct.align-empty` into `layout.repr.c.struct.align` --- src/type-layout.md | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/type-layout.md b/src/type-layout.md index a7d28ebdce..a9f2b96f66 100644 --- a/src/type-layout.md +++ b/src/type-layout.md @@ -198,10 +198,7 @@ r[layout.repr.c.struct] #### `#[repr(C)]` Structs r[layout.repr.c.struct.align] -The alignment of the struct is the alignment of the most-aligned field in it. - -r[layout.repr.c.struct.align-empty] -The alignment of a struct with no fields is 1. +The alignment of the struct is the alignment of the most-aligned field in it, or 1 if there are no fields. r[layout.repr.c.struct.size-field-offset] The size and offset of fields is determined by the following algorithm.