rust-bindgen icon indicating copy to clipboard operation
rust-bindgen copied to clipboard

`--with-derive-custom-struct` doesn't apply to `__BindgenBitfieldUnit`

Open BennoLossin opened this issue 9 months ago • 1 comments

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.

BennoLossin avatar Apr 20 '25 11:04 BennoLossin

A bit more context: I found this behavior when trying to add #[derive(MaybeZeroable)] to all structs in the bindings crate of Rust-for-Linux.

Cc @ojeda

BennoLossin avatar Apr 20 '25 11:04 BennoLossin