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 specific enum variants to be avoided. #24
Conversation
This adds an attribute called `#[ignore_variant]`, usable on enums which instructs Fuzzcheck to not construct that variant of the enumeration.
Amazing, thank you! I can't review it properly yet, but I think it looks good. A couple of quick comments/questions:
enum A<T, U> {
#[ignore_variant]
X, // empty variant ignored
#[ignore_variant]
Y(u8, u16) // variant with multiple fields ignored
#[ignore_variant]
Z { t: T, u: U } // variant with named parameters, variant with fields using generic type parameters
// etc. ?
// + maybe see what happens when all variants are ignored? not sure what the correct behaviour should be in that case
} Regarding the edge cases with generic types, I really think it's ok if it is not solved yet. I already have some problems with the generic bounds and it may need a more thorough refactor rather than a quick fix. Anyway, I am happy to merge it whenever you want, just let me know if you're satisfied with it as it is, if you'd like to continue working on it, or if you'd prefer me to continue doing some work on it :) |
- also fix a bug where the macro was emitting too many commas
Sorry for the delay! Thank you for the review :)
Yes, it was just because I thought it was easier to write that way.
Yeah I feel like the generic bounds may be a bit of work.
I tried registering the attributes, but for some reason it didn't work. I'll try to investigate further.
working on that (I seem to have broken a few things) |
Hello again! I'm just letting you know that I plan to release an update to fuzzcheck in a couple weeks or so and plan to merge this pull request by then :) You do not need to do anything. |
It's merged! I also fixed a couple of minor issues (attribute registration with derived macro, misnamed argument in Thanks again :) I am really happy about it 😄 |
Thank you too :) |
This adds an attribute called
#[ignore_variant]
, usable on enumswhich instructs Fuzzcheck to not construct that variant of the
enumeration.
I haven't yet solved this for generic types.