rust-lang / rust-lang/rust-bindgen
Incorrect bitstream length
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 5.3k
- Forks
- 829
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 15
Description
See the attached rust crate, which generates a binding for a simple structure in a c99 h file.
When the cargo build command is run, build.rs generates a binding file, which is included in lib.rs
the binding file creates struct resource which has two bitfields. the second is
pub _bitfield_2: __BindgenBitfieldUnit<[u8; 7usize]>,
i believe that bitfield should be 6 bytes wide (containing struct members r, s, t, u, v, w, x, y, and z, and totaling 48 bits). that bitfield is 7 bytes wide which causes the build to fail. is this a bug in bindgen or have i missed something?
Thank you for your attention.
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 with the attached crate, especially build.rs and lib.rs, and run cargo build to reproduce the generated binding and failure. Inspect how bindgen represents the resource bitfields, then compare the generated __BindgenBitfieldUnit width with the C99 structure's 48-bit second field; done means the binding is generated with the correct size and the crate builds.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c, rust
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100