3 ms·
In vast majority of cases, C enums are used in the same way as Rust enums - i.e. only the named enum variants are supported by any code that touches enum values
by int_19h 8y ago
In vast majority of cases, C enums are used in the same way as Rust enums - i.e. only the named enum variants are supported by any code that touches enum values (and if you're lucky, it might check for other stuff and reject it explicitly, but more often people forget and things just don't work or silently misbehave). So in practice this behavior is correct.
For those very rare cases where someone used open-ended enums in their API, ascribing some meaning to unnamed values that must be exposed, you can always use i32 etc.