]> git.lizzy.rs Git - rust.git/commit
std: Remove `rand` crate and module
authorAlex Crichton <alex@alexcrichton.com>
Wed, 1 Nov 2017 19:32:13 +0000 (12:32 -0700)
committerAlex Crichton <alex@alexcrichton.com>
Thu, 9 Nov 2017 04:41:17 +0000 (20:41 -0800)
commit6bc8f164b09b9994e6a2d4c4ca60d7d36c09d3fe
tree29cb9e3ac618cf4696aef88153c6fb2d48da3ee4
parentfc77b623d3072005f35e320e652f2b31695d493c
std: Remove `rand` crate and module

This commit removes the `rand` crate from the standard library facade as
well as the `__rand` module in the standard library. Neither of these
were used in any meaningful way in the standard library itself. The only
need for randomness in libstd is to initialize the thread-local keys of
a `HashMap`, and that unconditionally used `OsRng` defined in the
standard library anyway.

The cruft of the `rand` crate and the extra `rand` support in the
standard library makes libstd slightly more difficult to port to new
platforms, namely WebAssembly which doesn't have any randomness at all
(without interfacing with JS). The purpose of this commit is to clarify
and streamline randomness in libstd, focusing on how it's only required
in one location, hashmap seeds.

Note that the `rand` crate out of tree has almost always been a drop-in
replacement for the `rand` crate in-tree, so any usage (accidental or
purposeful) of the crate in-tree should switch to the `rand` crate on
crates.io. This then also has the further benefit of avoiding
duplication (mostly) between the two crates!
49 files changed:
src/Cargo.lock
src/bootstrap/compile.rs
src/bootstrap/dist.rs
src/doc/unstable-book/src/library-features/rand.md [deleted file]
src/liballoc/Cargo.toml
src/liballoc/lib.rs
src/liballoc/linked_list.rs
src/liballoc/tests/lib.rs
src/liballoc/tests/slice.rs
src/libcore/Cargo.toml
src/libcore/tests/num/flt2dec/mod.rs
src/librand/Cargo.toml [deleted file]
src/librand/chacha.rs [deleted file]
src/librand/distributions/exponential.rs [deleted file]
src/librand/distributions/gamma.rs [deleted file]
src/librand/distributions/mod.rs [deleted file]
src/librand/distributions/normal.rs [deleted file]
src/librand/distributions/range.rs [deleted file]
src/librand/distributions/ziggurat_tables.rs [deleted file]
src/librand/isaac.rs [deleted file]
src/librand/lib.rs [deleted file]
src/librand/rand_impls.rs [deleted file]
src/librand/reseeding.rs [deleted file]
src/librustc_back/Cargo.toml
src/librustc_back/lib.rs
src/librustc_back/tempdir.rs
src/librustc_incremental/Cargo.toml
src/librustc_incremental/lib.rs
src/librustc_incremental/persist/fs.rs
src/libstd/Cargo.toml
src/libstd/collections/hash/map.rs
src/libstd/lib.rs
src/libstd/rand/mod.rs [deleted file]
src/libstd/rt.rs
src/libstd/sync/rwlock.rs
src/libstd/sys/redox/mod.rs
src/libstd/sys/redox/rand.rs
src/libstd/sys/unix/mod.rs
src/libstd/sys/unix/rand.rs
src/libstd/sys/windows/mod.rs
src/libstd/sys/windows/pipe.rs
src/libstd/sys/windows/rand.rs
src/test/compile-fail/task-rng-isnt-sendable.rs [deleted file]
src/test/run-pass-fulldeps/binary-heap-panic-safe.rs [new file with mode: 0644]
src/test/run-pass-fulldeps/env.rs [new file with mode: 0644]
src/test/run-pass-fulldeps/vector-sort-panic-safe.rs [new file with mode: 0644]
src/test/run-pass/binary-heap-panic-safe.rs [deleted file]
src/test/run-pass/env.rs [deleted file]
src/test/run-pass/vector-sort-panic-safe.rs [deleted file]