Skip to content
This repository has been archived by the owner on Dec 9, 2018. It is now read-only.

Commit

Permalink
Auto merge of #158 - dvc94ch:remove-rand, r=japaric
Browse files Browse the repository at this point in the history
std: Remove `rand` crate and module

I'm guessing the entire rand folder can be deleted (still contains rand/reader.rs), but I left it for now, since it wasn't removed in rust/src/libstd yet.

Rust lang commit: 6bc8f164b09b9994e6a2d4c4ca60d7d36c09d3fe
  • Loading branch information
homunkulus committed Jan 12, 2018
2 parents 23882a1 + 5883feb commit 0c28304
Show file tree
Hide file tree
Showing 10 changed files with 38 additions and 389 deletions.
1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ sc = "0.2.1"

[dependencies.ralloc]
default-features = false
features = ["allocator"]
git = "https://github.com/redox-os/ralloc"
optional = true

Expand Down
7 changes: 3 additions & 4 deletions Xargo.std.toml
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
[dependencies]
collections = {}
rand = {}
core = {}
alloc = {}

[dependencies.compiler_builtins]
features = ["mem"]
git = "https://github.com/rust-lang-nursery/compiler-builtins"
stage = 1

[dependencies.std]
git = "https://github.com/japaric/steed"
stage = 2
stage = 2
7 changes: 3 additions & 4 deletions Xargo.test.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
[dependencies]
collections = {}
rand = {}
core = {}
alloc = {}

[dependencies.compiler_builtins]
features = ["mem"]
git = "https://github.com/rust-lang-nursery/compiler-builtins"
stage = 1

[dependencies.std]
Expand All @@ -13,4 +12,4 @@ stage = 2

[dependencies.test]
git = "https://github.com/japaric/steed"
stage = 3
stage = 3
4 changes: 2 additions & 2 deletions Xargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[dependencies]
collections = {}
rand = {}
core = {}
alloc = {}

[dependencies.compiler_builtins]
features = ["mem"]
Expand Down
3 changes: 3 additions & 0 deletions ci/script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ path = "/project/test"
stage = 3
EOF

# blow the old Xargo directory to avoid like "found possibly newer version of crate"
rm -rf $HOME/.xargo

cross test \
--target $TARGET \
--no-default-features \
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
Loading

0 comments on commit 0c28304

Please sign in to comment.