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

Enum discriminants should be taken from the end of the input string, like lengths #35

Open
fitzgen opened this issue Mar 10, 2020 · 1 comment
Labels
derive Issues related to the derive(Arbitrary) macro

Comments

@fitzgen
Copy link
Member

fitzgen commented Mar 10, 2020

The same rationale for why we take lengths from the end of the input byte string applies to discriminants: depending on the discriminant chosen, it changes which subsequent arbitrary calls are made and how many bytes are needed. It generally seems best to have "control flow"-y choices that affect shape be taken from the end of the input string and "filler" data taken from the start.

To do this we'll need to expose our internal int_in_range that takes from the end. Not sure what to call it, or how to explain why there are two variants in the documentation well...

@fitzgen fitzgen added the derive Issues related to the derive(Arbitrary) macro label Mar 10, 2020
@Manishearth
Copy link
Member

We should do this for dataful enums, C-like enums should still just fetch a number from the cursor position.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
derive Issues related to the derive(Arbitrary) macro
Projects
None yet
Development

No branches or pull requests

2 participants