rust-bindgen icon indicating copy to clipboard operation
rust-bindgen copied to clipboard

Allow specifying certain types we shouldn't derive/impl Debug for

Open fitzgen opened this issue 9 years ago • 7 comments

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

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

  • [ ] Skipping any item explicitly marked not to be Debug in src/codegen/derive_debug.rs so that we don't generate an impl Debug for ... for these types when --impl-debug is passed.

  • [ ] Tests!

    • [ ] When --impl-debug is also supplied

    • [ ] When --impl-debug is not also supplied

    • [ ] When the no-debug type is transitively referenced by a whitelisted item

    • [ ] When the no-debug type is explicitly whitelisted

    • [ ] When the no-debug type is marked opaque

fitzgen avatar Sep 07 '17 21:09 fitzgen

cc @jdm

fitzgen avatar Sep 07 '17 21:09 fitzgen

Hey! I'd like to give this one a shot.

njayinthehouse avatar Oct 04 '17 14:10 njayinthehouse

@njayinthehouse Hi! Feel free to ask if you run into any questions!

pepyakin avatar Oct 04 '17 14:10 pepyakin

Hello, there seems no activity on this issue, I would like to give a try. @highfive: assign me

ivanovaleksey avatar Dec 08 '17 18:12 ivanovaleksey

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

highfive avatar Dec 08 '17 18:12 highfive

@ivanovaleksey hi! dont hestiate to ask questions, i will glad to answer!

pepyakin avatar Dec 08 '17 19:12 pepyakin

Already implemented

pvdrz avatar Nov 11 '22 18:11 pvdrz