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

Add support for arrays powered by const generics without unsafe or libs #311

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Mathspy
Copy link

@Mathspy Mathspy commented Jun 7, 2022

Closes #187

Alternative to #282 that does not use unsafe

This seems to have been a heavily requested feature since 2017 now but the hold back was that implementing array support via macros heavily impacts compile times, is limited to some predefined arbitrary length and bloats the docs with unnecessary clutters. The wait was for const generic stabilization which is finally upon us, so we can utilize that and add array support!

Also lol while I was writing the shrink implementation I was like uff too much cloning there's probably a way to write this better that Sushi will tell me about, then while opening this PR I decided to double check there are no PRs open that already do this, which is when I found #282 and saw the exact same implementation I reached. Now I feel much less bad about the implementation

@Mathspy Mathspy changed the title Add support for arrays powered by const generics Add support for arrays powered by const generics without unsafe or libs Jun 7, 2022
@arkeet
Copy link

arkeet commented Jun 27, 2022

I was looking to add this as well and came up with exactly the same implementation before seeing there was already a PR. Would be nice to see this get in.

@cloudhead
Copy link

FWIW I've published a fork of this library called qcheck under here: https://github.com/cloudhead/qcheck

It includes this change as well as a bunch of others that made sense to include.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement Arbitrary for [T: Arbitrary; N]
3 participants