Skip to content

Commit 9f871ce

Browse files
authored
Merge pull request #458 from RalfJung/enum-repr-sign
repr(int) enums: both size and sign matter
2 parents e94e24a + 16d2f21 commit 9f871ce

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/other-reprs.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ says they should still consume a byte of space.
4242
difference from a struct is that the fields aren’t named.
4343

4444
* `repr(C)` is equivalent to one of `repr(u*)` (see the next section) for
45-
fieldless enums. The chosen size is the default enum size for the target platform's C
45+
fieldless enums. The chosen size and sign is the default enum size and sign for the target platform's C
4646
application binary interface (ABI). Note that enum representation in C is implementation
4747
defined, so this is really a "best guess". In particular, this may be incorrect
4848
when the C code of interest is compiled with certain flags.
@@ -79,7 +79,7 @@ More details are in the [RFC 1758][rfc-transparent] and the [RFC 2645][rfc-trans
7979

8080
## repr(u*), repr(i*)
8181

82-
These specify the size to make a fieldless enum. If the discriminant overflows
82+
These specify the size and sign to make a fieldless enum. If the discriminant overflows
8383
the integer it has to fit in, it will produce a compile-time error. You can
8484
manually ask Rust to allow this by setting the overflowing element to explicitly
8585
be 0. However Rust will not allow you to create an enum where two variants have
@@ -89,7 +89,7 @@ The term "fieldless enum" only means that the enum doesn't have data in any
8989
of its variants. A fieldless enum without a `repr(u*)` or `repr(C)` is
9090
still a Rust native type, and does not have a stable ABI representation.
9191
Adding a `repr` causes it to be treated exactly like the specified
92-
integer size for ABI purposes.
92+
integer type for ABI purposes.
9393

9494
If the enum has fields, the effect is similar to the effect of `repr(C)`
9595
in that there is a defined layout of the type. This makes it possible to

0 commit comments

Comments
 (0)