Skip to content

Commit

Permalink
std: Remove rand crate and module
Browse files Browse the repository at this point in the history
Rust lang commit: 6bc8f164b09b9994e6a2d4c4ca60d7d36c09d3fe
  • Loading branch information
dvc94ch committed Nov 12, 2017
1 parent 23882a1 commit 53342db
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 378 deletions.
3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ optional = true
optional = true
path = "naive_ralloc"

[dev-dependencies]
rand = "0.3"

[features]
default = ["ralloc"]

Expand Down
10 changes: 4 additions & 6 deletions src/collections/hash/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ use hash::{Hash, Hasher, BuildHasher, SipHasher13};
use iter::{FromIterator, FusedIterator};
use mem::{self, replace};
use ops::{Deref, Index, InPlace, Place, Placer};
use rand::{self, Rng};
use ptr;
use sys;

use super::table::{self, Bucket, EmptyBucket, FullBucket, FullBucketMut, RawTable, SafeHash};
use super::table::BucketState::{Empty, Full};
Expand Down Expand Up @@ -2343,8 +2343,8 @@ impl RandomState {
// rand
#[stable(feature = "hashmap_build_hasher", since = "1.7.0")]
pub fn new() -> RandomState {
let mut r = rand::thread_rng();
RandomState { k0: r.gen(), k1: r.gen() }
let (k0, k1) = sys::hashmap_random_keys();
RandomState { k0: k0, k1: k1 }
}
#[cfg(issue = "87")]
#[inline]
Expand All @@ -2364,9 +2364,7 @@ impl RandomState {
// increment one of the seeds on every RandomState creation, giving
// every corresponding HashMap a different iteration order.
thread_local!(static KEYS: Cell<(u64, u64)> = {
let r = rand::OsRng::new();
let mut r = r.expect("failed to create an OS RNG");
Cell::new((r.gen(), r.gen()))
Cell::new(sys::hashmap_random_keys())
});

KEYS.with(|keys| {
Expand Down
2 changes: 0 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ extern crate naive_ralloc;
#[macro_use]
extern crate sc;
extern crate std_unicode;
extern crate rand as core_rand;
#[cfg(test)]
extern crate test;

Expand Down Expand Up @@ -199,7 +198,6 @@ mod linux;
mod memchr;
#[cfg(not(test))]
mod panicking;
mod rand;
mod sys;
mod sys_common;
mod libc;
Expand Down
298 changes: 0 additions & 298 deletions src/rand/mod.rs

This file was deleted.

2 changes: 2 additions & 0 deletions src/sys/linux/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ pub mod thread;

pub use os::linux as platform;

pub use self::rand::hashmap_random_keys;

use intrinsics;
use io::Error;
use io::ErrorKind;
Expand Down
Loading

0 comments on commit 53342db

Please sign in to comment.