Skip to content
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

Allow specifying certain types we shouldn't derive/impl Copy for #962

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

Allow specifying certain types we shouldn't derive/impl Copy for #962

fitzgen opened this issue Sep 7, 2017 · 2 comments

Comments

@fitzgen
Copy link
Member

fitzgen commented Sep 7, 2017

Add --no-copy <regex> and Builder::no_copy(String) to supply regexes for matching against types that we should not derive or implement Copy 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-copy <regex> CLI flags into invocations of the builder method.

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

  • Tests!

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

    • When the no-copy type is explicitly whitelisted

    • When the no-copy type is marked opaque

@hallfox
Copy link
Contributor

hallfox commented Oct 15, 2017

Hi! I'd like to take a crack at this.

@fitzgen
Copy link
Member Author

fitzgen commented Oct 17, 2017

Great! Let me know if you have any questions :)

hallfox added a commit to hallfox/rust-bindgen that referenced this issue Oct 25, 2017
hallfox added a commit to hallfox/rust-bindgen that referenced this issue Oct 25, 2017
generated bindings from test headers
bors-servo pushed a commit that referenced this issue Oct 26, 2017
Resolve #962 - implement --no-copy with tests

Allows types to not have the copy trait automatically derived.
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

2 participants