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 0.6.5 seems to be breaking the build #228

Closed
brycx opened this Issue Jan 28, 2019 · 10 comments

Comments

Projects
None yet
3 participants
@brycx
Copy link

brycx commented Jan 28, 2019

Not exactly sure if this belongs here or on rust-random/rand. Just tried to run cargo test with quickcheck = "0.8.0" in [dev-dependencies], without using the macros or importing them. This is what I get:

[...]

error[E0277]: the trait bound `rand_xorshift::XorShiftRng: rand_core::SeedableRng` is not satisfied
   --> /home/user/.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
   --> /home/user/.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
   --> /home/user/.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 34 previous errors

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

This comment has been minimized.

Copy link
Owner

BurntSushi commented Jan 28, 2019

Seems to be working fine for me:

$ cat Cargo.toml
[package]
name = "quickcheck-228"
version = "0.1.0"
edition = "2018"

[dev-dependencies]
quickcheck = "0.8.0"

$ cargo test
    Updating crates.io index
  Downloaded quickcheck v0.8.0
  Downloaded rand v0.6.5
  Downloaded regex-syntax v0.6.5
  Downloaded rand_jitter v0.1.0
   Compiling libc v0.2.48
   Compiling semver-parser v0.7.0
   Compiling memchr v2.1.3
   Compiling cfg-if v0.1.6
   Compiling autocfg v0.1.2
   Compiling ucd-util v0.1.3
   Compiling rand_core v0.4.0
   Compiling regex v1.1.0
   Compiling lazy_static v1.2.0
   Compiling quick-error v1.2.2
   Compiling utf8-ranges v1.0.2
   Compiling termcolor v1.0.4
   Compiling log v0.4.6
   Compiling humantime v1.2.0
   Compiling thread_local v0.3.6
   Compiling regex-syntax v0.6.5
   Compiling rand_core v0.3.1
   Compiling rand_jitter v0.1.0
   Compiling rand_chacha v0.1.1
   Compiling rand v0.6.5
   Compiling semver v0.9.0
   Compiling rand_hc v0.1.0
   Compiling rand_isaac v0.1.1
   Compiling rand_xorshift v0.1.1
   Compiling rustc_version v0.2.3
   Compiling rand_os v0.1.1
   Compiling atty v0.2.11
   Compiling rand_pcg v0.1.1
   Compiling aho-corasick v0.6.9
   Compiling env_logger v0.5.13
   Compiling quickcheck v0.8.0
   Compiling quickcheck-228 v0.1.0 (/tmp/quickcheck-228)
    Finished dev [unoptimized + debuginfo] target(s) in 9.63s
     Running target/debug/deps/quickcheck_228-d7675bb233b8040f

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out

I think you need to include more information about your build? The actual errors you're getting tell me that you're somehow not using compatible versions of rand in the same build, but your reproduction steps don't allow me to know for sure.

@brycx

This comment has been minimized.

Copy link

brycx commented Jan 28, 2019

Huh, that's weird. I'm trying to build with latest stable and nightly Rust, edition = 2018. The full error log I've posted here https://pastebin.com/QM7jDrXp (those are when trying to build with stable).

These are my dependencies:

[dependencies]
rand_os = { version = "0.1.1", optional = true }
tiny-keccak = "1.4.2"
byteorder = { version = "1.2.7", default-features = false }
subtle = { version = "2", default-features = false }
clear_on_drop = "=0.2.3"

[dev-dependencies]
hex = "0.3.2"
serde_json = "1.0.33"
quickcheck = "0.8.0"

Let me know if you need anything else.

@BurntSushi

This comment has been minimized.

Copy link
Owner

BurntSushi commented Jan 28, 2019

Works just fine for me. Are you sure you aren't still depending on an older version of rand? Like I said in my original comment, that's what the errors are saying. For example, can you start a fresh project in the same way that I am and confirm the issue persists? If not, then it's likely you are still using an older version of rand somehow. Look at your Cargo.lock for example.

@brycx

This comment has been minimized.

Copy link

brycx commented Jan 28, 2019

With a fresh library, this issue does not persist. I have checked the Cargo.lock and can't find a conflicting rand dep. The only thing I can think of is rand using a newer rand_core version compared to rand_os, but I can't confirm that with a fresh lib either.

I'll just have to see if rand_os gets updated and that fixes it. Thanks a lot for your help anyway!

@BurntSushi

This comment has been minimized.

Copy link
Owner

BurntSushi commented Jan 28, 2019

OK, then I'm going to close this for now. If you want to post the Cargo.lock of the project that is giving you problems, then I can look at it.

@BurntSushi BurntSushi closed this Jan 28, 2019

@brycx

This comment has been minimized.

Copy link

brycx commented Jan 28, 2019

This is the Cargo.lock: https://pastebin.com/5qEyqzbz.

@BurntSushi

This comment has been minimized.

Copy link
Owner

BurntSushi commented Jan 28, 2019

I copied your Cargo.lock to my system and I was able to reproduce the error. I then ran cargo update:

$ cargo update
    Updating crates.io index
    Updating libc v0.2.44 -> v0.2.48
    Updating rand_core v0.3.0 -> v0.3.1
    Updating serde v1.0.83 -> v1.0.85
    Updating serde_json v1.0.33 -> v1.0.37

And now things work.

Sigh. It looks like the rand maintainers used the semver trick to release a 0.4 version of rand_core which is specifically incompatible with rand_core 0.3.0 but is compatible with rand_core 0.3.1 (again, because this is how the semver trick works). Your project is somehow using both rand_core 0.3.0 and rand_core 0.4.0 simultaneously, which are incompatible with one another. To me, this means someone messed up somewhere and hasn't declared minimal dependency versions somewhere, but I don't know for sure and don't have the patience to look into it.

@brycx

This comment has been minimized.

Copy link

brycx commented Jan 28, 2019

I didn't know about cargo update, that's neat. I see, this clears things up a lot. Again, thanks a lot for the help!

@dhardy

This comment has been minimized.

Copy link

dhardy commented Jan 28, 2019

Yep, @BurntSushi is on the ball.

To me, this means someone messed up somewhere and hasn't declared minimal dependency versions somewhere, but I don't know for sure and don't have the patience to look into it.

Is there a way to avoid this? Because rand_core 0.3.1 can't be published until after 0.4.0 is released. And after that, is there a way to force all 0.3.0 users to upgrade?

@BurntSushi

This comment has been minimized.

Copy link
Owner

BurntSushi commented Jan 28, 2019

@dhardy I don't know. :-( It was just a guess. I've never used the semver trick myself, so I'm not completely intimate with how it works and its ramifications. Maybe it means bumping other dependencies like rand_chacha which declare compatibility with 0.3.0 and 0.3.1 but not 0.4? Not sure.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment