Skip to content

Commit f3476a2

Browse files
committed
don't guarantee at least one byte
1 parent d9598f5 commit f3476a2

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

reference/src/representation/enums.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,10 +100,13 @@ alignment 1).
100100

101101
### Layout of a fieldless enum
102102

103-
If there is no `#[repr]` attached to a fieldless enum, it is
104-
guaranteed to be represented as an integer of sufficient size to store
105-
the discriminants for all possible variants. The size is selected by
106-
the compiler but must be at least a `u8`.
103+
If there is no `#[repr]` attached to a fieldless enum, the compiler
104+
will represent it using an integer of sufficient size to store the
105+
discriminants for all possible variants -- note that if there is only
106+
one variant, then 0 bits are required, so it is possible that the enum
107+
may have zero size. In the absence of a `#[repr]` annotation, the
108+
number of bits used by the compiler are not defined and are subject to
109+
change.
107110

108111
When a `#[repr(Int)]`-style annotation is attached to a fieldless enum
109112
(one without any data for its variants), it will cause the enum to be

0 commit comments

Comments
 (0)