rust-lang / rust-lang/rust-bindgen
Document somewhere that enums can be either c_int or c_uint
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 5.3k
- Forks
- 829
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 15
Description
Input C/C++ Header
enum TestEnum {
FOO,
BAR
};
Bindgen Invocation
$ bindgen input.h
Actual Results
On Windows:
/* automatically generated by rust-bindgen 0.56.0 */
pub const TestEnum_FOO: TestEnum = 0;
pub const TestEnum_BAR: TestEnum = 1;
pub type TestEnum = ::std::os::raw::c_int;
On Ubuntu:
/* automatically generated by rust-bindgen 0.56.0 */
pub const TestEnum_FOO: TestEnum = 0;
pub const TestEnum_BAR: TestEnum = 1;
pub type TestEnum = ::std::os::raw::c_uint;
Expected Results
This should be documented somewhere. All I found is this comment: https://github.com/rust-lang/rust-bindgen/issues/1096#issuecomment-365797349
Bindgen uses whatever enum type comes from clang, so if it's a u32, clang is picking a u32 type for it.
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
The report uses input.h and the bindgen input.h entry point, with generated Rust output differing between Windows and Ubuntu. Start by locating the project’s enum or code-generation documentation; document that bindgen follows Clang’s platform-selected enum type, including c_int versus c_uint, and verify the example’s behavior on both platforms.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c, cpp, rust
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100