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

Rand no longer compiles #818

Closed
sfackler opened this issue Jun 6, 2019 · 27 comments
Closed

Rand no longer compiles #818

sfackler opened this issue Jun 6, 2019 · 27 comments

Comments

@sfackler
Copy link
Contributor

sfackler commented Jun 6, 2019

A crate that just depends on rand = "0.6" no longer compiles, producing these errors:

    Checking rand v0.6.5
error[E0277]: the trait bound `rand_hc::Hc128Rng: rand_core::SeedableRng` is not satisfied
  --> /Users/sfackler/.cargo/registry/src/github.com-1ecc6299db9ec823/rand-0.6.5/src/rngs/std.rs:55:6
   |
55 | impl SeedableRng for StdRng {
   |      ^^^^^^^^^^^ the trait `rand_core::SeedableRng` is not implemented for `rand_hc::Hc128Rng`

error[E0277]: the trait bound `rand_isaac::IsaacRng: rand_core::SeedableRng` is not satisfied
  --> /Users/sfackler/.cargo/registry/src/github.com-1ecc6299db9ec823/rand-0.6.5/src/deprecated.rs:50:6
   |
50 | impl SeedableRng for IsaacRng {
   |      ^^^^^^^^^^^ the trait `rand_core::SeedableRng` is not implemented for `rand_isaac::IsaacRng`

error[E0277]: the trait bound `rand_isaac::Isaac64Rng: rand_core::SeedableRng` is not satisfied
  --> /Users/sfackler/.cargo/registry/src/github.com-1ecc6299db9ec823/rand-0.6.5/src/deprecated.rs:96:6
   |
96 | impl SeedableRng for Isaac64Rng {
   |      ^^^^^^^^^^^ the trait `rand_core::SeedableRng` is not implemented for `rand_isaac::Isaac64Rng`

error[E0277]: the trait bound `rand_hc::Hc128Rng: rand_core::SeedableRng` is not satisfied
   --> /Users/sfackler/.cargo/registry/src/github.com-1ecc6299db9ec823/rand-0.6.5/src/deprecated.rs:198:6
    |
198 | impl SeedableRng for Hc128Rng {
    |      ^^^^^^^^^^^ the trait `rand_core::SeedableRng` is not implemented for `rand_hc::Hc128Rng`

error[E0277]: the trait bound `rand_xorshift::XorShiftRng: rand_core::SeedableRng` is not satisfied
   --> /Users/sfackler/.cargo/registry/src/github.com-1ecc6299db9ec823/rand-0.6.5/src/deprecated.rs:239:6
    |
239 | impl SeedableRng for XorShiftRng {
    |      ^^^^^^^^^^^ the trait `rand_core::SeedableRng` is not implemented for `rand_xorshift::XorShiftRng`

error[E0277]: the trait bound `rand_hc::Hc128Rng: rand_core::SeedableRng` is not satisfied
   --> /Users/sfackler/.cargo/registry/src/github.com-1ecc6299db9ec823/rand-0.6.5/src/deprecated.rs:279:6
    |
279 | impl SeedableRng for StdRng {
    |      ^^^^^^^^^^^ the trait `rand_core::SeedableRng` is not implemented for `rand_hc::Hc128Rng`

error[E0277]: the trait bound `rand_hc::Hc128Core: rand_core::block::BlockRngCore` is not satisfied
  --> /Users/sfackler/.cargo/registry/src/github.com-1ecc6299db9ec823/rand-0.6.5/src/rngs/thread.rs:73:5
   |
73 |     rng: *mut ReseedingRng<Hc128Core, EntropyRng>,
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `rand_core::block::BlockRngCore` is not implemented for `rand_hc::Hc128Core`
   |
note: required by `rngs::adapter::reseeding::ReseedingRng`
  --> /Users/sfackler/.cargo/registry/src/github.com-1ecc6299db9ec823/rand-0.6.5/src/rngs/adapter/reseeding.rs:88:1
   |
88 | / pub struct ReseedingRng<R, Rsdr>(BlockRng<ReseedingCore<R, Rsdr>>)
89 | | where R: BlockRngCore + SeedableRng,
90 | |       Rsdr: RngCore;
   | |____________________^

error[E0277]: the trait bound `rand_hc::Hc128Core: rand_core::SeedableRng` is not satisfied
  --> /Users/sfackler/.cargo/registry/src/github.com-1ecc6299db9ec823/rand-0.6.5/src/rngs/thread.rs:73:5
   |
73 |     rng: *mut ReseedingRng<Hc128Core, EntropyRng>,
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `rand_core::SeedableRng` is not implemented for `rand_hc::Hc128Core`
   |
note: required by `rngs::adapter::reseeding::ReseedingRng`
  --> /Users/sfackler/.cargo/registry/src/github.com-1ecc6299db9ec823/rand-0.6.5/src/rngs/adapter/reseeding.rs:88:1
   |
88 | / pub struct ReseedingRng<R, Rsdr>(BlockRng<ReseedingCore<R, Rsdr>>)
89 | | where R: BlockRngCore + SeedableRng,
90 | |       Rsdr: RngCore;
   | |____________________^

error[E0277]: the trait bound `rand_hc::Hc128Core: rand_core::block::BlockRngCore` is not satisfied
  --> /Users/sfackler/.cargo/registry/src/github.com-1ecc6299db9ec823/rand-0.6.5/src/rngs/thread.rs:76:1
   |
76 | / thread_local!(
77 | |     static THREAD_RNG_KEY: UnsafeCell<ReseedingRng<Hc128Core, EntropyRng>> = {
78 | |         let mut entropy_source = EntropyRng::new();
79 | |         let r = Hc128Core::from_rng(&mut entropy_source).unwrap_or_else(|err|
...  |
85 | |     }
86 | | );
   | |__^ the trait `rand_core::block::BlockRngCore` is not implemented for `rand_hc::Hc128Core`
   |
note: required by `rngs::adapter::reseeding::ReseedingRng`
  --> /Users/sfackler/.cargo/registry/src/github.com-1ecc6299db9ec823/rand-0.6.5/src/rngs/adapter/reseeding.rs:88:1
   |
88 | / pub struct ReseedingRng<R, Rsdr>(BlockRng<ReseedingCore<R, Rsdr>>)
89 | | where R: BlockRngCore + SeedableRng,
90 | |       Rsdr: RngCore;
   | |____________________^
   = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)

error[E0277]: the trait bound `rand_hc::Hc128Core: rand_core::SeedableRng` is not satisfied
  --> /Users/sfackler/.cargo/registry/src/github.com-1ecc6299db9ec823/rand-0.6.5/src/rngs/thread.rs:76:1
   |
76 | / thread_local!(
77 | |     static THREAD_RNG_KEY: UnsafeCell<ReseedingRng<Hc128Core, EntropyRng>> = {
78 | |         let mut entropy_source = EntropyRng::new();
79 | |         let r = Hc128Core::from_rng(&mut entropy_source).unwrap_or_else(|err|
...  |
85 | |     }
86 | | );
   | |__^ the trait `rand_core::SeedableRng` is not implemented for `rand_hc::Hc128Core`
   |
note: required by `rngs::adapter::reseeding::ReseedingRng`
  --> /Users/sfackler/.cargo/registry/src/github.com-1ecc6299db9ec823/rand-0.6.5/src/rngs/adapter/reseeding.rs:88:1
   |
88 | / pub struct ReseedingRng<R, Rsdr>(BlockRng<ReseedingCore<R, Rsdr>>)
89 | | where R: BlockRngCore + SeedableRng,
90 | |       Rsdr: RngCore;
   | |____________________^
   = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)

error[E0277]: the trait bound `rand_hc::Hc128Core: rand_core::block::BlockRngCore` is not satisfied
  --> /Users/sfackler/.cargo/registry/src/github.com-1ecc6299db9ec823/rand-0.6.5/src/rngs/thread.rs:76:1
   |
76 | / thread_local!(
77 | |     static THREAD_RNG_KEY: UnsafeCell<ReseedingRng<Hc128Core, EntropyRng>> = {
78 | |         let mut entropy_source = EntropyRng::new();
79 | |         let r = Hc128Core::from_rng(&mut entropy_source).unwrap_or_else(|err|
...  |
85 | |     }
86 | | );
   | |__^ the trait `rand_core::block::BlockRngCore` is not implemented for `rand_hc::Hc128Core`
   |
note: required by `rngs::adapter::reseeding::ReseedingRng`
  --> /Users/sfackler/.cargo/registry/src/github.com-1ecc6299db9ec823/rand-0.6.5/src/rngs/adapter/reseeding.rs:88:1
   |
88 | / pub struct ReseedingRng<R, Rsdr>(BlockRng<ReseedingCore<R, Rsdr>>)
89 | | where R: BlockRngCore + SeedableRng,
90 | |       Rsdr: RngCore;
   | |____________________^
   = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)

error[E0277]: the trait bound `rand_hc::Hc128Core: rand_core::SeedableRng` is not satisfied
  --> /Users/sfackler/.cargo/registry/src/github.com-1ecc6299db9ec823/rand-0.6.5/src/rngs/thread.rs:76:1
   |
76 | / thread_local!(
77 | |     static THREAD_RNG_KEY: UnsafeCell<ReseedingRng<Hc128Core, EntropyRng>> = {
78 | |         let mut entropy_source = EntropyRng::new();
79 | |         let r = Hc128Core::from_rng(&mut entropy_source).unwrap_or_else(|err|
...  |
85 | |     }
86 | | );
   | |__^ the trait `rand_core::SeedableRng` is not implemented for `rand_hc::Hc128Core`
   |
note: required by `rngs::adapter::reseeding::ReseedingRng`
  --> /Users/sfackler/.cargo/registry/src/github.com-1ecc6299db9ec823/rand-0.6.5/src/rngs/adapter/reseeding.rs:88:1
   |
88 | / pub struct ReseedingRng<R, Rsdr>(BlockRng<ReseedingCore<R, Rsdr>>)
89 | | where R: BlockRngCore + SeedableRng,
90 | |       Rsdr: RngCore;
   | |____________________^
   = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)

error[E0277]: the trait bound `rand_hc::Hc128Core: rand_core::block::BlockRngCore` is not satisfied
  --> /Users/sfackler/.cargo/registry/src/github.com-1ecc6299db9ec823/rand-0.6.5/src/rngs/thread.rs:76:1
   |
76 | / thread_local!(
77 | |     static THREAD_RNG_KEY: UnsafeCell<ReseedingRng<Hc128Core, EntropyRng>> = {
78 | |         let mut entropy_source = EntropyRng::new();
79 | |         let r = Hc128Core::from_rng(&mut entropy_source).unwrap_or_else(|err|
...  |
85 | |     }
86 | | );
   | |__^ the trait `rand_core::block::BlockRngCore` is not implemented for `rand_hc::Hc128Core`
   |
note: required by `rngs::adapter::reseeding::ReseedingRng`
  --> /Users/sfackler/.cargo/registry/src/github.com-1ecc6299db9ec823/rand-0.6.5/src/rngs/adapter/reseeding.rs:88:1
   |
88 | / pub struct ReseedingRng<R, Rsdr>(BlockRng<ReseedingCore<R, Rsdr>>)
89 | | where R: BlockRngCore + SeedableRng,
90 | |       Rsdr: RngCore;
   | |____________________^
   = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)

error[E0277]: the trait bound `rand_hc::Hc128Core: rand_core::SeedableRng` is not satisfied
  --> /Users/sfackler/.cargo/registry/src/github.com-1ecc6299db9ec823/rand-0.6.5/src/rngs/thread.rs:76:1
   |
76 | / thread_local!(
77 | |     static THREAD_RNG_KEY: UnsafeCell<ReseedingRng<Hc128Core, EntropyRng>> = {
78 | |         let mut entropy_source = EntropyRng::new();
79 | |         let r = Hc128Core::from_rng(&mut entropy_source).unwrap_or_else(|err|
...  |
85 | |     }
86 | | );
   | |__^ the trait `rand_core::SeedableRng` is not implemented for `rand_hc::Hc128Core`
   |
note: required by `rngs::adapter::reseeding::ReseedingRng`
  --> /Users/sfackler/.cargo/registry/src/github.com-1ecc6299db9ec823/rand-0.6.5/src/rngs/adapter/reseeding.rs:88:1
   |
88 | / pub struct ReseedingRng<R, Rsdr>(BlockRng<ReseedingCore<R, Rsdr>>)
89 | | where R: BlockRngCore + SeedableRng,
90 | |       Rsdr: RngCore;
   | |____________________^
   = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)

error[E0277]: the trait bound `rand_hc::Hc128Core: rand_core::block::BlockRngCore` is not satisfied
  --> /Users/sfackler/.cargo/registry/src/github.com-1ecc6299db9ec823/rand-0.6.5/src/rngs/thread.rs:76:1
   |
76 | / thread_local!(
77 | |     static THREAD_RNG_KEY: UnsafeCell<ReseedingRng<Hc128Core, EntropyRng>> = {
78 | |         let mut entropy_source = EntropyRng::new();
79 | |         let r = Hc128Core::from_rng(&mut entropy_source).unwrap_or_else(|err|
...  |
85 | |     }
86 | | );
   | |__^ the trait `rand_core::block::BlockRngCore` is not implemented for `rand_hc::Hc128Core`
   |
note: required by `rngs::adapter::reseeding::ReseedingRng`
  --> /Users/sfackler/.cargo/registry/src/github.com-1ecc6299db9ec823/rand-0.6.5/src/rngs/adapter/reseeding.rs:88:1
   |
88 | / pub struct ReseedingRng<R, Rsdr>(BlockRng<ReseedingCore<R, Rsdr>>)
89 | | where R: BlockRngCore + SeedableRng,
90 | |       Rsdr: RngCore;
   | |____________________^
   = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)

error[E0277]: the trait bound `rand_hc::Hc128Core: rand_core::SeedableRng` is not satisfied
  --> /Users/sfackler/.cargo/registry/src/github.com-1ecc6299db9ec823/rand-0.6.5/src/rngs/thread.rs:76:1
   |
76 | / thread_local!(
77 | |     static THREAD_RNG_KEY: UnsafeCell<ReseedingRng<Hc128Core, EntropyRng>> = {
78 | |         let mut entropy_source = EntropyRng::new();
79 | |         let r = Hc128Core::from_rng(&mut entropy_source).unwrap_or_else(|err|
...  |
85 | |     }
86 | | );
   | |__^ the trait `rand_core::SeedableRng` is not implemented for `rand_hc::Hc128Core`
   |
note: required by `rngs::adapter::reseeding::ReseedingRng`
  --> /Users/sfackler/.cargo/registry/src/github.com-1ecc6299db9ec823/rand-0.6.5/src/rngs/adapter/reseeding.rs:88:1
   |
88 | / pub struct ReseedingRng<R, Rsdr>(BlockRng<ReseedingCore<R, Rsdr>>)
89 | | where R: BlockRngCore + SeedableRng,
90 | |       Rsdr: RngCore;
   | |____________________^
   = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)

error[E0277]: the trait bound `rand_hc::Hc128Rng: rand_core::SeedableRng` is not satisfied
  --> /Users/sfackler/.cargo/registry/src/github.com-1ecc6299db9ec823/rand-0.6.5/src/rngs/std.rs:56:5
   |
56 |     type Seed = <Hc128Rng as SeedableRng>::Seed;
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `rand_core::SeedableRng` is not implemented for `rand_hc::Hc128Rng`

error[E0277]: the trait bound `rand_hc::Hc128Rng: rand_core::SeedableRng` is not satisfied
  --> /Users/sfackler/.cargo/registry/src/github.com-1ecc6299db9ec823/rand-0.6.5/src/rngs/std.rs:58:5
   |
58 | /     fn from_seed(seed: Self::Seed) -> Self {
59 | |         StdRng(Hc128Rng::from_seed(seed))
60 | |     }
   | |_____^ the trait `rand_core::SeedableRng` is not implemented for `rand_hc::Hc128Rng`

error[E0277]: the trait bound `rand_isaac::IsaacRng: rand_core::SeedableRng` is not satisfied
  --> /Users/sfackler/.cargo/registry/src/github.com-1ecc6299db9ec823/rand-0.6.5/src/deprecated.rs:51:5
   |
51 |     type Seed = <rand_isaac::IsaacRng as SeedableRng>::Seed;
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `rand_core::SeedableRng` is not implemented for `rand_isaac::IsaacRng`

error[E0277]: the trait bound `rand_isaac::IsaacRng: rand_core::SeedableRng` is not satisfied
  --> /Users/sfackler/.cargo/registry/src/github.com-1ecc6299db9ec823/rand-0.6.5/src/deprecated.rs:53:5
   |
53 | /     fn from_seed(seed: Self::Seed) -> Self {
54 | |         IsaacRng(rand_isaac::IsaacRng::from_seed(seed))
55 | |     }
   | |_____^ the trait `rand_core::SeedableRng` is not implemented for `rand_isaac::IsaacRng`

error[E0277]: the trait bound `rand_isaac::Isaac64Rng: rand_core::SeedableRng` is not satisfied
  --> /Users/sfackler/.cargo/registry/src/github.com-1ecc6299db9ec823/rand-0.6.5/src/deprecated.rs:97:5
   |
97 |     type Seed = <rand_isaac::Isaac64Rng as SeedableRng>::Seed;
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `rand_core::SeedableRng` is not implemented for `rand_isaac::Isaac64Rng`

error[E0277]: the trait bound `rand_isaac::Isaac64Rng: rand_core::SeedableRng` is not satisfied
   --> /Users/sfackler/.cargo/registry/src/github.com-1ecc6299db9ec823/rand-0.6.5/src/deprecated.rs:99:5
    |
99  | /     fn from_seed(seed: Self::Seed) -> Self {
100 | |         Isaac64Rng(rand_isaac::Isaac64Rng::from_seed(seed))
101 | |     }
    | |_____^ the trait `rand_core::SeedableRng` is not implemented for `rand_isaac::Isaac64Rng`

error[E0277]: the trait bound `rand_hc::Hc128Rng: rand_core::SeedableRng` is not satisfied
   --> /Users/sfackler/.cargo/registry/src/github.com-1ecc6299db9ec823/rand-0.6.5/src/deprecated.rs:199:5
    |
199 |     type Seed = <rand_hc::Hc128Rng as SeedableRng>::Seed;
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `rand_core::SeedableRng` is not implemented for `rand_hc::Hc128Rng`

error[E0277]: the trait bound `rand_hc::Hc128Rng: rand_core::SeedableRng` is not satisfied
   --> /Users/sfackler/.cargo/registry/src/github.com-1ecc6299db9ec823/rand-0.6.5/src/deprecated.rs:201:5
    |
201 | /     fn from_seed(seed: Self::Seed) -> Self {
202 | |         Hc128Rng(rand_hc::Hc128Rng::from_seed(seed))
203 | |     }
    | |_____^ the trait `rand_core::SeedableRng` is not implemented for `rand_hc::Hc128Rng`

error[E0277]: the trait bound `rand_xorshift::XorShiftRng: rand_core::SeedableRng` is not satisfied
   --> /Users/sfackler/.cargo/registry/src/github.com-1ecc6299db9ec823/rand-0.6.5/src/deprecated.rs:240:5
    |
240 |     type Seed = <::rand_xorshift::XorShiftRng as SeedableRng>::Seed;
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `rand_core::SeedableRng` is not implemented for `rand_xorshift::XorShiftRng`

error[E0277]: the trait bound `rand_xorshift::XorShiftRng: rand_core::SeedableRng` is not satisfied
   --> /Users/sfackler/.cargo/registry/src/github.com-1ecc6299db9ec823/rand-0.6.5/src/deprecated.rs:242:5
    |
242 | /     fn from_seed(seed: Self::Seed) -> Self {
243 | |         XorShiftRng(::rand_xorshift::XorShiftRng::from_seed(seed))
244 | |     }
    | |_____^ the trait `rand_core::SeedableRng` is not implemented for `rand_xorshift::XorShiftRng`

error[E0277]: the trait bound `rand_hc::Hc128Rng: rand_core::SeedableRng` is not satisfied
   --> /Users/sfackler/.cargo/registry/src/github.com-1ecc6299db9ec823/rand-0.6.5/src/deprecated.rs:280:5
    |
280 |     type Seed = <rngs::StdRng as SeedableRng>::Seed;
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `rand_core::SeedableRng` is not implemented for `rand_hc::Hc128Rng`

error[E0277]: the trait bound `rand_hc::Hc128Rng: rand_core::SeedableRng` is not satisfied
   --> /Users/sfackler/.cargo/registry/src/github.com-1ecc6299db9ec823/rand-0.6.5/src/deprecated.rs:282:5
    |
282 | /     fn from_seed(seed: Self::Seed) -> Self {
283 | |         StdRng(rngs::StdRng::from_seed(seed))
284 | |     }
    | |_____^ the trait `rand_core::SeedableRng` is not implemented for `rand_hc::Hc128Rng`

error: aborting due to 28 previous errors

For more information about this error, try `rustc --explain E0277`.
error: Could not compile `rand`.

To learn more, run the command again with --verbose.

It looks like new versions of a bunch of the inner crates were just released that may not have been semver-compatible?

@spielcrypto
Copy link

@dhardy I have the same issue

@mati865
Copy link

mati865 commented Jun 6, 2019

rand haven't been updated for a while so it's not the issue.
The problem comes down to new rand_core 0.5, failed job is using following rand_core versions:

[00:05:00] Downloaded rand_core v0.4.0
...
[00:05:00] Downloaded rand_core v0.3.1
...
[00:05:01] Downloaded rand_core v0.5.0

@spielcrypto
Copy link

spielcrypto commented Jun 6, 2019

What I'm thinking is that all of subpackage doesn't have rand_core updated to 0.5.0, anyway all the project breaks

@dhardy
Copy link
Member

dhardy commented Jun 6, 2019

Yup, it won't. I'm trying to fix it.

If you force use of rand_core 0.4 for now it will avoid this issue... hopefully I'll have a compatibility shim ready soon.

@kflansburg
Copy link

If you force use of rand_core 0.4 for now it will avoid this issue...

Can you describe this process? I've had no luck using Cargo's patching.

@dhardy
Copy link
Member

dhardy commented Jun 6, 2019

cargo update -p rand_core:0.4.0

I'll have the compatibility shim out soon (see #819).

@dhardy
Copy link
Member

dhardy commented Jun 6, 2019

Sorry, it's more than that: other rand crates also need to be downgraded (e.g. cargo update -p rand_hc:=0.1.0).

@Stargateur
Copy link

@sfackler I don't think the whole error report was necessary ;) Can you hide it somehow ?

@matklad
Copy link
Contributor

matklad commented Jun 6, 2019

@dhardy could this be fixed by yanking the offending versions?

@pietroalbini
Copy link

@dhardy as you suggested in #819 (comment) I think yanking is the best solution right now: the new version broke tons of things, including rustc's CI (we can't land any PRs right now).

@kflansburg
Copy link

[patch.crates-io]
rand = { git = "https://github.com/rust-random/rand.git", rev = "ff121cff61dfcb8c06a618b204ed93be727c4303" }
rand_core = { git = "https://github.com/rust-random/rand.git", rev = "ff121cff61dfcb8c06a618b204ed93be727c4303" }
rand_hc = { git = "https://github.com/rust-random/rand.git", rev = "ff121cff61dfcb8c06a618b204ed93be727c4303" }
rand_chacha = { git = "https://github.com/rust-random/rand.git", rev = "ff121cff61dfcb8c06a618b204ed93be727c4303" }
rand_distr = { git = "https://github.com/rust-random/rand.git", rev = "ff121cff61dfcb8c06a618b204ed93be727c4303" }
rand_isaac = { git = "https://github.com/rust-random/rand.git", rev = "ff121cff61dfcb8c06a618b204ed93be727c4303" }
rand_jitter = { git = "https://github.com/rust-random/rand.git", rev = "ff121cff61dfcb8c06a618b204ed93be727c4303" }
rand_os = { git = "https://github.com/rust-random/rand.git", rev = "ff121cff61dfcb8c06a618b204ed93be727c4303" }
rand_pcg = { git = "https://github.com/rust-random/rand.git", rev = "ff121cff61dfcb8c06a618b204ed93be727c4303" }
rand_xorshift = { git = "https://github.com/rust-random/rand.git", rev = "ff121cff61dfcb8c06a618b204ed93be727c4303" }
rand_xoshiro = { git = "https://github.com/rust-random/rand.git", rev = "ff121cff61dfcb8c06a618b204ed93be727c4303" }

I was able to use this patch to compile from the revision just before the new release commits started.

@spielcrypto
Copy link

Although downgraded it, some another library continues requiring this version and my API continues breaking

@dhardy
Copy link
Member

dhardy commented Jun 6, 2019

Fair enough. But I now lack a strategy for publishing rand 0.7 without a clean break.

@spielcrypto
Copy link

spielcrypto commented Jun 6, 2019

@kflansburg
I get this error applying your patches

error[E0432]: unresolved import `rand::rngs::SmallRng`
 --> /home/spielrs/.cargo/registry/src/github.com-1ecc6299db9ec823/phf_generator-0.7.24/src/lib.rs:7:5
  |
7 | use rand::rngs::SmallRng;
  |     ^^^^^^^^^^^^^^^^^^^^ no `SmallRng` in `rngs`

error[E0432]: unresolved import `rand::rngs::SmallRng`
 --> /home/spielrs/.cargo/registry/src/github.com-1ecc6299db9ec823/parking_lot_core-0.4.0/src/parking_lot.rs:8:5
  |
8 | use rand::rngs::SmallRng;
  |     ^^^^^^^^^^^^^^^^^^^^ no `SmallRng` in `rngs`

error[E0432]: unresolved import `rand::FromEntropy`
 --> /home/spielrs/.cargo/registry/src/github.com-1ecc6299db9ec823/parking_lot_core-0.4.0/src/parking_lot.rs:9:12
  |
9 | use rand::{FromEntropy, Rng};
  |            ^^^^^^^^^^^ no `FromEntropy` in the root

error[E0432]: unresolved imports `rand::rngs::SmallRng`, `rand::FromEntropy`
  --> /home/spielrs/.cargo/registry/src/github.com-1ecc6299db9ec823/parking_lot_core-0.5.0/src/parking_lot.rs:16:12
   |
16 | use rand::{rngs::SmallRng, FromEntropy, Rng};
   |            ^^^^^^^^^^^^^^  ^^^^^^^^^^^ no `FromEntropy` in the root
   |            |
   |            no `SmallRng` in `rngs`

error: aborting due to previous error

@kflansburg
Copy link

kflansburg commented Jun 6, 2019

Hmmm, I do not use those other crates so I'm afraid I can't help there.

Edit: The revision I used was from 17 days ago, I figured it would work for most people as I don't see bugs reported in that time.

@dhardy
Copy link
Member

dhardy commented Jun 6, 2019

All yanked.

But now the question is how do I publish new Rand versions without causing this problem again?

Theoretically, I could use pre-release versions for each depedency, then publish Rand using the pre-release versions.

@dhardy
Copy link
Member

dhardy commented Jun 6, 2019

Everything boils down to one problem: Cargo assumes it can safely use rand_core version 0.4 and 0.5 simultaneously. It can't without a compatibility shim. So this is a Cargo bug... but one without a solution I believe.

Please help find a solution to this one, otherwise I can promise you more pain in the future (even if I do my best to avoid repeating this one).

@alce
Copy link

alce commented Jun 6, 2019

Thank you, you are the best.

@TheRadioGuy
Copy link

So, Do we have a solution?

@dhardy
Copy link
Member

dhardy commented Jun 6, 2019

Ah: I think the cause of everyone's problems was that I published a new patch version (0.1.1) of rand_hc which depended on the new minor version (0.5.0) of rand_core.

So, rule for the future: if bumping a minor/major version of a dependency used in the API, also use at least a minor version bump of this package. (Can Cargo enforce this?)

@spielcrypto
Copy link

spielcrypto commented Jun 6, 2019

@dhardy is possible that every dependency use rand_core=0.5?

I mean rand_hc, rand_os etc...

Use every dependency the same rand_core version

I can try it

@sfackler
Copy link
Contributor Author

sfackler commented Jun 6, 2019

0.4 and 0.5 are semver-incompatible versions and rand_core is a public dependency of rand_hc, so that bump is a breaking change.

@spielcrypto
Copy link

I see that 0.7 has all the dependencies updated to 0.5. I think it would be enough.

@TheRadioGuy
Copy link

It works now for me, thanks

@spielcrypto
Copy link

rand = {git="https://github.com/rust-random/rand.git"} (last commit)
resolve the issue

@sfackler sfackler closed this as completed Jun 6, 2019
KizzyCode added a commit to KizzyCode/crypto_api_chachapoly that referenced this issue Jun 6, 2019
…oxide` optional (even for tests)

Motivated by the recent build-breaking accident in the `rand`-crate (rust-random/rand#818)
Licenser pushed a commit to tremor-rs/tremor-runtime that referenced this issue Sep 30, 2019
* Seed random number generation with event's ingestion time
* Move function to random namespace and rename existing funtion
* Simple test for the function
* Docs on function usage and event drop recipe based on this

Had to downgrade rand crate to 0.6.5 (from 0.7.0) becasue of
compilation issues with newer version (when using seeded RNG):
rust-random/rand#818
@oren0e
Copy link

oren0e commented Dec 26, 2021

I am having the same issue. Using

[patch.crates-io]
rand = { git = "https://github.com/rust-random/rand.git", rev = "ff121cff61dfcb8c06a618b204ed93be727c4303" }
rand_core = { git = "https://github.com/rust-random/rand.git", rev = "ff121cff61dfcb8c06a618b204ed93be727c4303" }
rand_hc = { git = "https://github.com/rust-random/rand.git", rev = "ff121cff61dfcb8c06a618b204ed93be727c4303" }
rand_chacha = { git = "https://github.com/rust-random/rand.git", rev = "ff121cff61dfcb8c06a618b204ed93be727c4303" }
rand_distr = { git = "https://github.com/rust-random/rand.git", rev = "ff121cff61dfcb8c06a618b204ed93be727c4303" }
rand_isaac = { git = "https://github.com/rust-random/rand.git", rev = "ff121cff61dfcb8c06a618b204ed93be727c4303" }
rand_jitter = { git = "https://github.com/rust-random/rand.git", rev = "ff121cff61dfcb8c06a618b204ed93be727c4303" }
rand_os = { git = "https://github.com/rust-random/rand.git", rev = "ff121cff61dfcb8c06a618b204ed93be727c4303" }
rand_pcg = { git = "https://github.com/rust-random/rand.git", rev = "ff121cff61dfcb8c06a618b204ed93be727c4303" }
rand_xorshift = { git = "https://github.com/rust-random/rand.git", rev = "ff121cff61dfcb8c06a618b204ed93be727c4303" }
rand_xoshiro = { git = "https://github.com/rust-random/rand.git", rev = "ff121cff61dfcb8c06a618b204ed93be727c4303" }

I was able to use this patch to compile from the revision just before the new release commits started.

does not solve my problem, I receive this error when using the quoted solution:

error[E0432]: unresolved import `core4::ErrorKind`
  --> /Users/username/.cargo/registry/src/github.com-1ecc6299db9ec823/rand_core-0.3.1/src/lib.rs:44:17
   |
44 | pub use core4::{ErrorKind, Error};
   |                 ^^^^^^^^^ no `ErrorKind` in the root

@dhardy
Copy link
Member

dhardy commented Dec 27, 2021

@oren0e I fail to see how this is the same issue. Open a new one.

But don't expect any support for using rev = "ff121cff61dfcb8c06a618b204ed93be727c4303"; this is not a release and is very old.

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