-
Notifications
You must be signed in to change notification settings - Fork 150
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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Const generic arbitrary #288
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just to make sure i'm understanding, this change makes it so that Arbitrary
is inherited across the board for const generic arrays so the user doesn't need to use a macro?
if so seems good to me. one thing i've noticed though is the macro arbitrary!
seems to be used for these declarations internally instead. however, it seems pretty simple to just inherit the trait directly like you have here so i don't have a problem with that.
I don't think that's quite right: The It's roughly equivalent to : impl<A: Arbitrary> Arbitrary for [A; 1] { ... }
impl<A: Arbitrary> Arbitrary for [A; 2] { ... }
// ...
impl<A: Arbitrary> Arbitrary for [A; 32] { ... } except with less typing. The new code uses const generics to provide impls for Another way of thinking about it is that the previous code was a bit like this hypothetical syntax: impl<A: Arbitrary, const N: usize> Arbitrary for [A; N] where A >= 1, A <= 32 {} and this PR just removes that As for |
Thanks for the explanation, that all makes good sense to me :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good to me
In the previous ticket, I added
Strategy
impls for const generic arrays of strategies, but forgot aboutArbitrary
馃うThis one adds
Arbitrary
impls for const generic arrays of types which implArbitrary
.As with the previous PR, I don't think this is a breaking change.