rust-lang / rust-lang/rust-bindgen
`--with-derive-custom-struct` doesn't apply to `__BindgenBitfieldUnit`
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 5.3k
- Forks
- 829
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 15
Description
Invoking bindgen with --with-derive-custom-struct .*=Foo does not add #[derive(Foo)] to __BindgenBitfieldUnit.
I'd like all structs (& unions) to be marked with the derive macro, as it only implements the trait when all fields also implement it.
My current solution is to just manually implement the trait for __BindgenBitfieldUnit, which is fine, but not stable when you decide to rework how bitfields are represented.
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 tracing how --with-derive-custom-struct .*=Foo is applied to generated structs, then inspect generation of __BindgenBitfieldUnit. Add a regression test covering this bitfield type and verify that the requested derive appears on it; done means the custom derive applies consistently to the generated unit.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100