Skip to content

Allow specifying certain types we shouldn't derive/impl Hash for #964

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

Closed
8 tasks
fitzgen opened this issue Sep 7, 2017 · 8 comments
Closed
8 tasks

Allow specifying certain types we shouldn't derive/impl Hash for #964

fitzgen opened this issue Sep 7, 2017 · 8 comments

Comments

@fitzgen
Copy link
Member

fitzgen commented Sep 7, 2017

Add --no-hash <regex> and Builder::no_hash(String) to supply regexes for matching against types that we should not derive or implement Hash for.

Adding this feature involves:

  • Adding a new RegexSet member to bindgen::Builder (similar to the whitelisted_types set).

  • A Builder method to add strings to that RegexSet.

  • Plumbing in src/options.rs to convert --no-hash <regex> CLI flags into invocations of the builder method.

  • Making the MonotoneFramework::constrain function in src/ir/analysis/derive_hash.rs check if the given item is explicitly marked not to be Hash, and if so, inserting it into the self.cannot_derive_hash set via return self.insert(id).

  • Tests!

    • When the no-hash type is transitively referenced by a whitelisted item

    • When the no-hash type is explicitly whitelisted

    • When the no-hash type is marked opaque

@treiff
Copy link
Contributor

treiff commented Sep 15, 2017

I'll give this a shot. @highfive: assign me

@highfive
Copy link

Hey @treiff! Thanks for your interest in working on this issue. It's now assigned to you!

@fitzgen
Copy link
Member Author

fitzgen commented Sep 25, 2017

@treiff making any progress here? Anything that I can help with?

@treiff
Copy link
Contributor

treiff commented Sep 26, 2017

Hey @fitzgen, sorry for the delay. I had made a little progress, however I've got a bunch going on with work and don't think I'm actually going to have the time to give this the attention it needs. Probably best you un-assign me.

Thanks for the follow up reminder.

@fitzgen
Copy link
Member Author

fitzgen commented Sep 26, 2017

No problem!

@ghost
Copy link

ghost commented Oct 26, 2017

@highfive: assign me

@highfive
Copy link

Hey @seemyvest! Thanks for your interest in working on this issue. It's now assigned to you!

@ghost ghost mentioned this issue Oct 26, 2017
8 tasks
bors-servo pushed a commit that referenced this issue Oct 27, 2017
Add --no-hash <regex> flag

Issue #964

- [x] Adding a new RegexSet member to bindgen::Builder (similar to the whitelisted_types set).

- [x] A Builder method to add strings to that RegexSet.

- [x] Plumbing in src/options.rs to convert --no-hash <regex> CLI flags into invocations of the builder method.

- [x] Making the MonotoneFramework::constrain function in src/ir/analysis/derive_hash.rs check if the given item is explicitly marked not to be Hash, and if so, inserting it into the self.cannot_derive_hash set via return self.insert(id).

- [x] Tests!

  - [x] When the no-hash type is transitively referenced by a whitelisted item

  - [x] When the no-hash type is explicitly whitelisted

  - [x] When the no-hash type is marked opaque

r? @fitzgen
@emilio
Copy link
Contributor

emilio commented Oct 28, 2017

Fixed by #1105

@emilio emilio closed this as completed Oct 28, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants