-
Notifications
You must be signed in to change notification settings - Fork 321
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(int)
enums are currently broken
#261
Comments
FWIW, this was working in The commit that broke it is almost certainly rust-lang/rust@4f6f4eb, which re-enabled field reordering. |
Assuming rust-lang/rust#56887 is the right fix (which I suspect it is, but I'm not a rustc developer) I'd prefer to keep this for now and try to uplift that patch instead in rust stable / beta instead of disabling them on cbindgen. |
So just to clarify, is this is an issue with rustc reordering fields when it shouldn't or in cbindgen misunderstanding |
The former. |
Update: rust-lang/rust#56887 got merged so this will be working again in newer compilers. |
See rust-lang/rust#56619
Here's an example,
lib.rs
:Foo
is actually laid out as:...with
b
anda
of theA
variant reversed. Meanwhilecbindgen
happily produces a binding with those fields in the wrong order:A decent temporary fix would be to temporarily disable
repr(int)
enums with variants containing multiple fields of different types untilrustc
fixes this; if every field is the same type the ordering isn't changed. Similarly single-field variants are also fine because they can't be reordered.The text was updated successfully, but these errors were encountered: