-
Notifications
You must be signed in to change notification settings - Fork 723
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
Generating derives for Hash, Default and Debug for an Union #1285
Comments
This should be trivial to fix btw, see I'm happy to mentor this if you'r blocked on this or what not. |
Rust newcomer here, but I was bitten by this bug in my first bindgen test. :) Anyways, I decided to give it a debug shot. I think the bug is related to whitelisting combined with anonymous unions, and I suspect the bug is in the I'm not sure if the correct fix is to make sure anonymous compounds are always whitelisted, or if the test in |
Btw, I wouldn’t mind continuing working on this if it isn’t too complicated to fix, but I’d need some advice on the question above. |
…hitelisting. Fixes rust-lang#1285.
It seems inner types need to be whitelisted even when --no-recursive-whitelisting is specified. In addition to the inner types being missed by I made an attempt to fix this on my fork, along with a test case. Should I file a PR or would perhaps the maintainers like to make an architectural review first (@emilio ?) I don't really feel like I have the big picture of everything... :) |
Hmm, ok, I see what happens. So what's going on is that we generate the inner types unconditionally if the outer type is whitelisted... Maybe we should just avoid blacklisting inner types in the first place? Given it's effectively not honored anyway. In any case, that seems like a reasonable fix to me, modulo a minor nit (I'd just replace the function body with Basically in order to compute |
…telisting. This fixes issue rust-lang#1285 where inner types were code generated but not properly processed by the derive analysis.
Thanks for your feedback. I've added some more doc and renamed the predicate for clarity. Please see my pull request. |
@emilio thanks for offering to mentor this, but I'm rather busy. I'm glad @marty-se has stepped in. Thanks! (As an aside, I get around these blockers by running bindgen inside a shell script bindgen-wrapper that lets me post-process stuff like this). |
Whitelist inner types of whitelisted types even with no-recursive-whitelisting. This fixes issue #1285 where inner types were code generated but not properly processed by the derive analysis.
This was fixed by #1294. |
Derives Hash, Default and Debug for an Union, which won't compile:
error: this trait cannot be derived for unions
.Input C/C++ Header
Bindgen Invocation
Actual Results
The text was updated successfully, but these errors were encountered: