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.7 #75

Closed
Darksonn opened this issue Dec 22, 2018 · 9 comments
Closed

Consider support for rand 0.7 #75

Darksonn opened this issue Dec 22, 2018 · 9 comments

Comments

@Darksonn
Copy link
Contributor

Currently the rand feature of num-bigint uses rand version 0.5, although version 0.6 has been released. According to the rand documentation the update shouldn't affect the required version of rustc for the rand feature.

I can't quite tell what effects it would have for backwards compatibility in general, but maybe one could use a range for the version.

Related issue: #47

@cuviper
Copy link
Member

cuviper commented Jan 11, 2019

Just trying the update, I found that the method signatures of UniformSampler have changed from 0.5, which makes it harder to support a version range here. Maybe that could be detected in the build script for a cfg flag.

Generally though, I think the experience with a version range was poor in the past, as Cargo really tries to just grab the newest possible. And if one part of your dependency tree ends up wanting num-bigint+rand-0.6, while another wants num-bigint+rand-0.5, then you're stuck.

@cuviper
Copy link
Member

cuviper commented Jun 28, 2019

Rand 0.7 just came out today.

I think what I may try is bumping to num-bigint 0.3 with support for rand 0.7, and then have a num-bigint 0.2.x update which re-exports everything from 0.3 except the rand support, keeping its own support for rand 0.5.

(Yes, this means skipping 0.6 -- I don't want to version lock with their every update.)

@cuviper
Copy link
Member

cuviper commented Jun 28, 2019

Oh, right, we can't do a "re-export and add rand 0.5" in 0.2.x due to coherence:

error[E0117]: only traits defined in the current crate can be implemented for arbitrary types
   --> src/bigrand.rs:148:1
    |
148 | / impl SampleUniform for BigUint {
149 | |     type Sampler = UniformBigUint;
150 | | }
    | |_^ impl doesn't use types inside crate
    |
    = note: the impl does not reference any types defined in this crate
    = note: define and implement a trait or new type instead

I think everything else would work, but SampleUniform is a public impl, so that's a blocker.

So nevermind, it will have to be a fully independent bump.

@programmerjake
Copy link

programmerjake commented Aug 29, 2019

Maybe depend on both versions of rand and allow selecting which one(s) to use using features?
I don't know if rust can handle using two separate versions of the same crate in a source file at the same time (maybe give them different crate-internal aliases).

@programmerjake
Copy link

also, maybe rename the issue to "Consider support for rand 0.7"

@cuviper cuviper changed the title Consider support for rand 0.6 Consider support for rand 0.7 Aug 29, 2019
@danclive
Copy link

danclive commented Sep 2, 2019

I also encountered this problem today, because I am currently using 'rand v0.7', using this' crate 'will encounter conflicts, so I can only fork one copy, and then manually change the' rand 'version to' v0.7 '.

@yorickpeterse
Copy link

Has any progress on this been made? It would be nice being able to use newer versions of rand combined with the random number generation support provided by num-bigint.

@cuviper
Copy link
Member

cuviper commented Jan 14, 2020

#110 just merged with rand 0.7 as part of the upcoming num-bigint 0.3 -- #128.

@cuviper cuviper closed this as completed Jan 14, 2020
@yorickpeterse
Copy link

@cuviper @kpcyrd Thanks for adding rand 0.7 support!

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

No branches or pull requests

5 participants