-
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
Derive + blacklisted types #950
Derive + blacklisted types #950
Conversation
Presumably they are blacklisted because we can't understand them properly, so be pessimistic about what we can derive for it. Fixes rust-lang#944.
r? @emilio |
Although bindgen shouldn't put any assumption on blacklisted type, it could potentially be a trouble to ban all the derivation on them as well. (I haven't tried, but Probably we can allow people to specify which blacklisted type can derive what trait. Maybe I should try this patch first and see if it really becomes a problem. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks ok to me, but probably we should give it a try on mozjs / stylo.
This makes it so that whitelisted items and edges outgoing from them are black, while non-whitelisted items and their edges are gray.
We already have a test for more complicated template instantiations and blacklisting and their affects on deriving `Hash`, but it is good to have sanity tests for the simple cases too.
ff21cdb
to
641337d
Compare
This patch works fine with mozjs. |
With Stylo, I get the following error:
on this struct: #[repr(C)]
#[derive(Debug, Copy)]
pub union OwningNodeOrString_Value {
pub _bindgen_opaque_blob: [u64; 2usize],
} But let me double check that against master and see whether or not that same error occurs. |
Hm yeah with master I get tons of "copy could not be implemented for this type". |
Here is a minimal test case: // bindgen-flags: --opaque-type DoggoOrNull
class Doggo {};
class None {};
union DoggoOrNull {
Doggo doggo;
None none;
}; Testing if this is also a bug on master or not. |
It kind of seems to me that we shouldn't be emitting |
You need to make bindgen target 1.0 for building stylo. |
Ok, so I targeted 1.0 and still getting errors that seem unrelated to deriving:
But I verified that Anyways, I don't think these errors are related to this PR, and it fixes other errors that get hit when trying to build Stylo with master (the copy deriving) so I think we should land this. |
Unions don't support deriving these things, even if there is only one variant (the opaque layout field).
@bors-servo r=emilio |
📌 Commit 74e2aea has been approved by |
…emilio Derive + blacklisted types * [X] document blacklisting + derive interaction * [X] derive `Copy` * [X] derive `Debug` * [X] `--impl-debug` * [x] derive `Default` * [x] derive `Hash` * [x] derive `PartialEq`
☀️ Test successful - status-travis |
Copy
Debug
--impl-debug
Default
Hash
PartialEq