From 6bc8f164b09b9994e6a2d4c4ca60d7d36c09d3fe Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Wed, 1 Nov 2017 12:32:13 -0700 Subject: 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! --- src/liballoc/tests/slice.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/liballoc/tests/slice.rs') diff --git a/src/liballoc/tests/slice.rs b/src/liballoc/tests/slice.rs index c53bf15f1bf..85d5ce304b8 100644 --- a/src/liballoc/tests/slice.rs +++ b/src/liballoc/tests/slice.rs @@ -10,9 +10,10 @@ use std::cmp::Ordering::{Equal, Greater, Less}; use std::mem; -use std::__rand::{Rng, thread_rng}; use std::rc::Rc; +use rand::{Rng, thread_rng}; + fn square(n: usize) -> usize { n * n } -- cgit 1.4.1-3-g733a5