Skip to content

--with-derive-custom-struct doesn't apply to __BindgenBitfieldUnit #3196

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
y86-dev opened this issue Apr 20, 2025 · 1 comment
Open

--with-derive-custom-struct doesn't apply to __BindgenBitfieldUnit #3196

y86-dev opened this issue Apr 20, 2025 · 1 comment
Labels
rust-for-linux Issues relevant to the Rust for Linux project

Comments

@y86-dev
Copy link

y86-dev commented Apr 20, 2025

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.

@y86-dev
Copy link
Author

y86-dev commented Apr 20, 2025

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

@ojeda ojeda added the rust-for-linux Issues relevant to the Rust for Linux project label Apr 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
rust-for-linux Issues relevant to the Rust for Linux project
Projects
None yet
Development

No branches or pull requests

2 participants