Skip to content

Commit 5bc2515

Browse files
committed
also allow enums where all discriminant values fit an unsigned int
1 parent 44c79c8 commit 5bc2515

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/type-layout.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,8 @@ r[layout.repr.c.enum]
345345
#### `#[repr(C)]` Field-less Enums
346346

347347
For [field-less enums], the `C` representation requires the discriminant values to
348-
be representable by the `int` type in the target platform's C ABI.
348+
either all be representable by the `int` type in the target platform's C ABI,
349+
or to all be representable by the `unsigned int` type.
349350
Nevertheless, the type of the discriminant is `isize`.
350351
The size and alignment of the enum then match that of a C enum with the same
351352
discriminant values (and without a fixed underlying type).

0 commit comments

Comments
 (0)