-
Notifications
You must be signed in to change notification settings - Fork 698
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
Large bitfield causes compilation failures re: derive(Debug) #982
Comments
@highfive: assign me |
Hey @aeleos! Thanks for your interest in working on this issue. It's now assigned to you! |
@aeleos let me know if you have any questions about how the analyses work or whatever! :) |
Hey @fitzgen so I think I have it working. I ended up with this code right before the line where it iterates over the bitfields() function output.
When I was making this I ended up using the test-one.sh script to test my code, and I found that when I used the script it would fail for similar reasons. It would try to derive Default and fail because it isn't implemented larger than 32. I was able to fix it using the exact same code, just in derive_default.rs. Do you think it is worth including in the commit / pull request to fix this issue? |
Awesome!
Yep! I guess I didn't make myself clear enough with
but we need to do this check in all of the (Yes, we're starting to repeat ourselves a bit across these functions, so if you have ideas on how to help de-duplicate some of this code, additional PRs are very welcome 😸) |
Input C/C++ Header
Bindgen Invocation
Actual Results
Expected Results
We shouldn't
derive(Debug)
when a bitfield's allocation unit cannot derive debug.Our various
derive
analyses need to check if any bitfield allocation units are too large toderive
traits. We compute bitfield allocation units before thederive
analyses, so this shouldn't be very difficult.Here is where we keep the
Layout
for a bitfield allocation unit: https://github.com/rust-lang-nursery/rust-bindgen/blob/master/src/ir/comp.rs#L138https://github.com/rust-lang-nursery/rust-bindgen/blob/master/src/ir/analysis/derive_debug.rs#L270 is where we need to check that (and similar places for the other
derive
analyses).Happy to mentor anyone who wants to pick this up!
The text was updated successfully, but these errors were encountered: