Skip to content
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

rust_enums missing #430

Closed
jethrogb opened this issue Jan 24, 2017 · 3 comments · Fixed by #2004
Closed

rust_enums missing #430

jethrogb opened this issue Jan 24, 2017 · 3 comments · Fixed by #2004

Comments

@jethrogb
Copy link
Contributor

I would like my C enums to be defined as individual constants instead of a Rust enum. C enum values can hold any integer which breaks when they're interpreted as Rust enums across FFI boundaries. bitfield_enum is not sufficient since this introduces a wrapper type. Using bindgen 0.20 would introduce a public API change for my -sys crates.

@emilio
Copy link
Contributor

emilio commented Jan 24, 2017

Again, this should be easy to do, we have options to make some enum variants constant already (see #393), so it'd be a matter of expanding that codepath.

@jethrogb
Copy link
Contributor Author

Ah, interesting. I just tried that out a little bit and noticed that returning EnumVariantCustomBehavior::Constify for a bitfield_enum is broken.

@emilio
Copy link
Contributor

emilio commented Jan 24, 2017

Yeah, I can believe so. It doesn't make a lot of sense doing that though (bitfield enums already generate constants), so probably we should just ignore that

bors-servo pushed a commit that referenced this issue Jan 24, 2017
codegen: Respect original repr for bitfield-like enums, add a constifying variant.

r? @fitzgen

Fixes #430
jethrogb pushed a commit to jethrogb/rust-bindgen that referenced this issue Mar 10, 2021
jethrogb pushed a commit to jethrogb/rust-bindgen that referenced this issue Mar 10, 2021
jethrogb pushed a commit to jethrogb/rust-bindgen that referenced this issue Mar 10, 2021
jethrogb pushed a commit to jethrogb/rust-bindgen that referenced this issue Mar 10, 2021
jethrogb pushed a commit to jethrogb/rust-bindgen that referenced this issue Mar 11, 2021
jethrogb pushed a commit to jethrogb/rust-bindgen that referenced this issue Mar 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants