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

Consider support for rand 0.5 #47

Closed
cuviper opened this issue May 16, 2018 · 2 comments · Fixed by #48
Closed

Consider support for rand 0.5 #47

cuviper opened this issue May 16, 2018 · 2 comments · Fixed by #48

Comments

@cuviper
Copy link
Member

cuviper commented May 16, 2018

Currently num-bigint 0.2 is targeting rustc 1.15, with optional features for rand 0.4. However, rand 0.5 is coming soon, requiring rustc 1.22, so we should think how to support that (if at all). Options I see:

  1. Stick with rand 0.4 only.
  2. Wait for rand 0.5 before releasing num-bigint 0.2, and only support that.
    • Any users with less than rustc 1.22 won't be able to use the feature.
  3. Go ahead and release with rand 0.4 support, and later update to a range like >=0.4, <0.6
    • The current rand 0.5.0-pre.2 is still compatible -- we really only use Rng::gen().
    • We did this with rand 0.3/0.4 in num-bigint 0.1. Sometimes Cargo handled this fine, but sometimes it required hacks to get it to use an older version.
    • We don't enable rand by default anymore, so some of that pain will be minimized. Only users who actually want rand will enable it, and their own choice of rand version should influence Cargo's resolution.
@cuviper cuviper added this to the num-bigint-0.2 milestone May 16, 2018
@cuviper
Copy link
Member Author

cuviper commented May 21, 2018

Rand 0.5.0 was released today!

@cuviper
Copy link
Member Author

cuviper commented May 21, 2018

I'm leaning towards option 2, just supporting rand 0.5, and then we can implement some of the new distributions, especially SampleUniform. We can still keep RandBigInt unchanged though.

bors bot added a commit that referenced this issue May 23, 2018
48: Update to rand 0.5 r=cuviper a=cuviper

This closes #47, choosing to *only* support rand 0.5 (and only for their supported rustc 1.22+).

The `RandBigInt` trait still exists as an extension to all `Rng` types.  It's no longer defined at all when the "rand" feature is not enabled.  That was a misbehavior before, as enabling "rand" adds a blanket implementation, which would be a breaking change just by toggling the feature.

`BigUint` and `BigInt` now implement `SampleUniform` too, which lets them work natively with `Rng::gen_range`, `Rng::sample`, and `Uniform` in general.

Co-authored-by: Josh Stone <cuviper@gmail.com>
@bors bors bot closed this as completed in #48 May 23, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant