flier / rust-fasthash

A suite of non-cryptographic hash functions for Rust.
Apache License 2.0
138 stars 28 forks source link

Build failure with multiple versions of rand #6

Closed dekellum closed 6 years ago

dekellum commented 6 years ago

With the release of extprim crate, 1.5.0+ builds are failing with:

error[E0277]: the trait bound `extprim::u128::u128: rand::Rand` is not satisfied

The extprim 1.5.0 and 1.5.1 crates have rand crate as a dependency, updated to ^0.4. Oddly enough, rather than leaving extprim < 1.5.0, cargo is importing both rand 0.3.x and rand 0.4.x which fails to compile with the errors indicated. Unless that behavior makes sense to someone, I might also site this issue in a companion issue with cargo.

Simply updating fasthash crates dependency to rand ^0.4 results in a slightly different error, since xoroshiro128 has it own rand dependency. I have a workaround I will submit in a PR shortly.

Note that same issue also applies to users of the fasthash crate, which is how I encountered this in the first place.

dekellum commented 6 years ago

Note that a similar workaround is available to current consumers of the fasthash crate (e.g. 0.2.6). In a currently private project I have these deps in Cargo.toml:

fasthash =       ">=0.2, <2.0"
extprim =        "~1.4.0" # constrain fasthash to avoid two rand versions
flier commented 6 years ago

agree, I have submitted a PR to upstream rust-xoroshiro128, and use upgrade-rand branch to trace it.

flier commented 6 years ago

please check 0.2.8, thanks