Specifically if you are calling rand_core::Error::with_cause with something that doesn't implement std::error::Error (because you don't directly rely on std) then another dependency activates the rand_core/std feature you will get a compilation error.
Simplest way to see this is to use rand as the library that is built on rand_core without the std feature, then activate the std feature in an empty library that depends on both:
[dependencies]
rand = { version = "0.6.5", default-features = false }
rand_core = { version = "0.4.0", default-features = false, features = ["std"] }
This will fail to build with the error:
error[E0277]: the trait bound `error::TimerError: std::error::Error` is not satisfied
--> /home/wim/.cargo/registry/src/github.com-1ecc6299db9ec823/rand_jitter-0.1.3/src/error.rs:62:9
|
62 | Error::with_cause(ErrorKind::Unavailable,
| ^^^^^^^^^^^^^^^^^ the trait `std::error::Error` is not implemented for `error::TimerError`
|
= note: required because of the requirements on the impl of `core::convert::From<error::TimerError>` for `alloc::boxed::Box<(dyn std::error::Error + core::marker::Send + core::marker::Sync + 'static)>`
= note: required because of the requirements on the impl of `core::convert::Into<alloc::boxed::Box<(dyn std::error::Error + core::marker::Send + core::marker::Sync + 'static)>>` for `error::TimerError`
= note: required by `rand_core::Error::with_cause`
Specifically if you are calling
rand_core::Error::with_causewith something that doesn't implementstd::error::Error(because you don't directly rely onstd) then another dependency activates therand_core/stdfeature you will get a compilation error.Simplest way to see this is to use
randas the library that is built onrand_corewithout thestdfeature, then activate thestdfeature in an empty library that depends on both:This will fail to build with the error: