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

release 0.4.4 broke semver contract #688

Closed
japaric opened this issue Jan 9, 2019 · 7 comments
Closed

release 0.4.4 broke semver contract #688

japaric opened this issue Jan 9, 2019 · 7 comments

Comments

@japaric
Copy link

japaric commented Jan 9, 2019

And cortex-m-rtfm no longer compiles after this release.

Though I don't really understand how since the changes between 0.4.3 and 0.4.4 are minimal

STR

$ cargo new --lib foo && cd foo
$ cargo new --lib bar
$ cargo add bar --path bar
$ cargo add tempdir --vers 0.3.7
$ cargo add rand --vers 0.5.5 # and disable default features
$ cd bar && cargo add rand --vers 0.4.4 && cd ..
$ cat Cargo.toml
[package]
name = "foo"
version = "0.1.0"
authors = ["Jorge Aparicio <jorge@japaric.io>"]
edition = "2018"

[dependencies]
bar = { path = "bar" }
tempdir = "0.3.7"

[dependencies.rand]
default-features = false
version = "0.5.5"
$ cat bar/Cargo.toml
[package]
name = "bar"
version = "0.1.0"
authors = ["Jorge Aparicio <jorge@japaric.io>"]
edition = "2018"

[dependencies]
rand = "0.4.4"
$ cargo +stable build
error[E0277]: the trait bound `rngs::jitter::TimerError: std::error::Error` is not satisfied
   --> /home/japaric/.cargo/registry/src/github.com-1ecc6299db9ec823/rand-0.5.5/src/rngs/jitter.rs:269:9
    |
269 |         Error::with_cause(ErrorKind::Unavailable,
    |         ^^^^^^^^^^^^^^^^^ the trait `std::error::Error` is not implemented for `rngs::jitter::TimerError`

If I pin the rand 0.4 version to 0.4.3 then this crate compiles:

$ cat bar/Cargo.toml
[package]
name = "bar"
version = "0.1.0"
authors = ["Jorge Aparicio <jorge@japaric.io>"]
edition = "2018"

[dependencies]
rand = "=0.4.3" # <-
$ rm Cargo.lock
$ cargo +stable build && echo OK
OK

Meta

$ rustc +stable -V
rustc 1.31.1 (b6c32da9b 2018-12-18)
@japaric
Copy link
Author

japaric commented Jan 9, 2019

Though I don't really understand how since the changes between 0.4.3 and 0.4.4 are minimal

If I had to guess, this addition

[target.'cfg(target_env = "sgx")'.dependencies]
rdrand = "0.4.0"
rand_core = "0.3.0"

is probably unconditionally enabling the "std" feature of the rand_core crate, even if the target target_env is not "sgx". If that's the case then this sounds like a Cargo bug.

@newpavlov
Copy link
Member

newpavlov commented Jan 9, 2019

It's incorrect configuration, the cited TOML should be:

[target.'cfg(target_env = "sgx")'.dependencies]
rdrand = "0.4.0"
rand_core = { version = "0.3", default-features = false }

And std feature for rand_core should be enabled together with rand std feature.

(I wonder if it's worth to do such backports, though.)

@dhardy
Copy link
Member

dhardy commented Jan 9, 2019

Ah, the 0.4 series doesn't use rand_core. The extra dependency here... surely shouldn't do anything if you are not targetting SGX?

So your build uses Rand 0.4 and 0.5, and you are not using std but now somehow rand_core requires std (because this section doesn't disable default features)... @newpavlov beat me to it.

But I don't get why it matters since you're not targetting SGX?

@dhardy
Copy link
Member

dhardy commented Jan 9, 2019

@newpavlov want to make the PR for 0.4.5?

@newpavlov
Copy link
Member

I think it's the same bug in cargo which enables features enabled in dev-dependencies for non-dev builds.

newpavlov added a commit to newpavlov/rand that referenced this issue Jan 9, 2019
@dhardy
Copy link
Member

dhardy commented Jan 9, 2019

@japaric can you test 0.4.5 please?

@japaric
Copy link
Author

japaric commented Jan 9, 2019

@dhardy I checked and it works without a problem. Thanks for the quick fix!

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

3 participants