rust-lang / rust-lang/rust-bindgen
Macro defining a constant with unsigned long suffix generates unsigned integer
Open
Nobody has claimed this yet.
enhancement
- Dominant language
- Rust
- Stars
- 5.3k
- Forks
- 829
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 15
Description
Input C/C++ Header
#define CK_INVALID_HANDLE (0UL)
Bindgen Invocation
bindgen::Builder::default()
.header("input.h")
.generate()
.expect("Unable to generate bindings");
Actual Results
pub const CK_INVALID_HANDLE: ::std::os::raw::c_uint = 0;
Expected Results
pub const CK_INVALID_HANDLE: ::std::os::raw::c_ulong = 0;
The U (unsigned) prefix is taken into account, but not the L (long) one.
This causes types and casts problems.
Debugging logs:
bindgen.txt
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 reproducer is the C/C++ header macro #define CK_INVALID_HANDLE (0UL) and the bindgen Builder invocation in the issue; begin by running that input through bindgen and tracing how the generated constant type is chosen. Done means the generated declaration uses ::std::os::raw::c_ulong while preserving the existing value.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, rust
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 48/100