Closed
Description
In writing bindings for C libraries which feature enums in their API, single-variant enums can and do occur. However, binding these by generating a matching Rust enum with only one variant is not currently possible, as rustc gives
error: unsupported representation for univariant enum
on code like
#[repr(C)]
enum Foo
{
Bar,
//Dummy,
}
Currently this can be worked-around by adding a dummy variant as shown, but that shouldn't be necessary as it requires handling in consumer code, e.g. matches.
CC @jld who added the very very useful ability to use #[repr(C)]
in the first place. :)