Upgrading rand 0.7 to 0.8
Breaking0.7.3 → 0.8.8Breaking9Security1Platform1Deprecated2New12Changed9Fixed13Other12
BreakingUpgrade verdict
9 breaking changes and a platform requirement change and a security fix.
In plain terms
- Removes the `wasm-bindgen` and `stdweb` feature flags; see the getrandom documentation for WASM support.
- `ThreadRng` is no longer `Copy`, enabling safe usage within thread-local destructors.
- `gen_range(a, b)` is replaced with `gen_range(a..b)`; `gen_range(a..=b)` is also supported, and `a` and `b` can no longer be references or SIMD types.
- Drop the experimental simd_support feature.
Must act Top 5 of 13 that need code or config changes
Adds bincode ^1.2.1, serde ^1.0.103, serde_json ^1.0.99.
Drops getrandom, log, packed_simd, rand_hc.
Installs 18 packages in all (was 20).
What you must change
Breaking9
Removes the
wasm-bindgen and stdweb feature flags; see the getrandom documentation for WASM support.wasm-bindgenstdwebThreadRng is no longer Copy, enabling safe usage within thread-local destructors.ThreadRnggen_range(a, b) is replaced with gen_range(a..b); gen_range(a..=b) is also supported, and a and b can no longer be references or SIMD types.gen_rangeDrop the experimental simd_support feature.
simd_supportReadRng::next_u32 and next_u64 now use little-Endian conversion instead of native-Endian, changing results on Big-Endian platforms.ReadRng::next_u32ReadRng::next_u64Replaces
AsByteSliceMut with Fill and adds support for [bool], [char], [f32] and [f64].AsByteSliceMutFillRestricts
rand::rngs::adapter to std.rand::rngs::adapterImplements
IntoIterator for IndexVec, replacing the into_iter method.IndexVecIntoIteratorinto_iterMoves
rand::distributions::alias_method::WeightedIndex to rand_distr::WeightedAliasIndex; the simpler rand::distribution::WeightedIndex remains.rand::distributions::alias_method::WeightedIndexrand_distr::WeightedAliasIndexrand::distribution::WeightedIndexSecurity1
Rand is unsound with a custom logger using
rand::rng()Platform1
The minimum supported Rust version is now 1.36.
Deprecations to plan for
Deprecated2
Deprecate feature log ().
logDeprecate
rngs::adapter::ReadRng.rngs::adapter::ReadRng