-
Notifications
You must be signed in to change notification settings - Fork 12.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[repr(C)] enum only accepts int constants #15270
Comments
The solution is It is bad that this was not marked as a breaking change. #15234 does list a breaking change, but not this one. |
@chris-morgan that is not the real solution, since |
@chris-morgan: bindgen creates c_uint (= u32 on my system) statics for enums with no negative entries and c_int (= i32 on my system) for enums with negative entries. So you can't just use i32 always. |
Some more problems with You can have enums with u64::MAX variants in C which will have a size of 8. This is complicated to get right in Rust because u64::MAX will overflow and give you a -1 variant on x86_64. On x86 it's outright impossible to get a repr(C) enum of size 8. |
The constants should simply be untyped like the |
This worked in 1e6b699 but not in a490871.
cc @huonw
The text was updated successfully, but these errors were encountered: