rust-lang / rust-lang/rust-bindgen
bad type recognition, despite explicit suffix
Open
Nobody has claimed this yet.
A-macros
bug
- Dominant language
- Rust
- Stars
- 5.3k
- Forks
- 829
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 15
Description
This code:
#define CELL_WIDEASIAN_MASK 0x8000000000000000ull
#define CELL_NOBACKGROUND_MASK 0x0400000000000000ull
results in:
pub const CELL_WIDEASIAN_MASK: i64 = -9223372036854775808;
pub const CELL_NOBACKGROUND_MASK: u64 = 288230376151711744;
It seems bindgen just notices the leftmost bit on, and decides to turn it into an i64 despite the ull suffix that clearly indicates it should be a u64.
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
Reproduce the issue using the two C macro definitions in the report and inspect the generated Rust bindings. Trace how bindgen determines integer constant types, then add or update coverage so the explicit ull suffix produces a u64 constant while preserving the existing result for the other value.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c, rust
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100