rust-lang / rust-lang/rust-bindgen
if size_t_is_usize is set to true, and bindgen handles a size_t, and size_t ≠ uintptr_t, bindgen should abort
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 5.3k
- Forks
- 829
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 15
Description
Many projects (including nettle-sys, linux-kernel-module-rust, nodejs-sys, bcc-sys) are moving to revert to the pre-0.53 behavior that maps size_t and usize. These projects (and many others if #1902 is merged) will fail subtly if they use bindgen over a C API that includes size_t on a weird niche platform where size_t ≠ uintptr_t. if bindgen detects that this situation is happening, it should produce an error.
the three conditions that should produce an error (all conditions must be present) are:
size_t_is_usizeis set totrue- The source C API includes a
size_t - The platform's
size_tis not the same underlying type asuintptr_t
(see also #1901 and #1671 for background)
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
Start by reviewing bindgen's size_t_is_usize option and its size_t handling, then read issues #1902, #1901, and #1671 for the surrounding behavior. Done means bindgen reports an error only when the option is true, the C API uses size_t, and size_t differs from uintptr_t on the target platform.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100