Skip to content

Allow specifying certain types we shouldn't derive/impl Default for #963

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 · 5 comments
Closed
8 tasks

Comments

@fitzgen
Copy link
Member

fitzgen commented Sep 7, 2017

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

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

  • Tests!

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

    • When the no-default type is explicitly whitelisted

    • When the no-default type is marked opaque

@GyrosOfWar
Copy link

Hi! I'd like to do this.

@highfive: assign me

@highfive
Copy link

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

@fitzgen
Copy link
Member Author

fitzgen commented Sep 21, 2017

@GyrosOfWar let me know if you have any questions :)

This should be pretty similar to the --no-partialeq PR that just landed, so you can take a look at that for guidance: #996

@GyrosOfWar
Copy link

Yeah, I've found that one already. Should be pretty straightforward. I've joined the Gitter room, so I'll ask there if I need anything.

@pvdrz
Copy link
Contributor

pvdrz commented Nov 11, 2022

Already implemented

@pvdrz pvdrz closed this as completed Nov 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants