rust-lang / rust-lang/rust-bindgen
Improve codegen for C style enums
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 5.3k
- Forks
- 829
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 15
Description
Because C style enums are loosely typed and aren't typed they tend to be expressed in C more loosely than they are actually used.
For example, one might have an enum like:
https://github.com/zyantific/zydis/blob/4dd632463c122ee85ba9c5f0c1e56ac748bf246e/include/Zydis/DecoderTypes.h#L478
but that enum is stored in a ZydisCPUFlagAction/uint8_t (https://github.com/zyantific/zydis/blob/4dd632463c122ee85ba9c5f0c1e56ac748bf246e/include/Zydis/DecoderTypes.h#L473, https://github.com/zyantific/zydis/blob/4dd632463c122ee85ba9c5f0c1e56ac748bf246e/include/Zydis/DecoderTypes.h#L816).
It would be nice to be able map the ZydisCPUFlagAction type to the ZydisCPUFlagActions enum somehow.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Read the linked enum and storage declarations in include/Zydis/DecoderTypes.h at lines 473, 478, and 816, then trace how bindgen currently represents these C enums in generated Rust. Define how a storage type such as ZydisCPUFlagAction should map to its related ZydisCPUFlagActions enum, and verify the generated bindings for this example.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c, rust
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100