diff options
| author | Mark Rousskov <mark.simulacrum@gmail.com> | 2018-08-04 16:24:39 -0600 |
|---|---|---|
| committer | Mark Rousskov <mark.simulacrum@gmail.com> | 2018-09-04 13:22:08 -0600 |
| commit | 9ec5ef541ad17986bfe6ae067a84ea8f7b7ae133 (patch) | |
| tree | b66ab3ff4520b7abc1ea542ab3447c6d15e9047d /src/libstd | |
| parent | 1c2e17f4e3a2070a7f703f51e29c1c388ef703b6 (diff) | |
| download | rust-9ec5ef541ad17986bfe6ae067a84ea8f7b7ae133.tar.gz rust-9ec5ef541ad17986bfe6ae067a84ea8f7b7ae133.zip | |
Breaking change upgrades
Diffstat (limited to 'src/libstd')
| -rw-r--r-- | src/libstd/Cargo.toml | 2 | ||||
| -rw-r--r-- | src/libstd/fs.rs | 6 | ||||
| -rw-r--r-- | src/libstd/sync/rwlock.rs | 2 | ||||
| -rw-r--r-- | src/libstd/sys_common/io.rs | 2 | ||||
| -rw-r--r-- | src/libstd/tests/env.rs | 7 |
5 files changed, 10 insertions, 9 deletions
diff --git a/src/libstd/Cargo.toml b/src/libstd/Cargo.toml index 5348c9a0f34..bcdd1b4b088 100644 --- a/src/libstd/Cargo.toml +++ b/src/libstd/Cargo.toml @@ -25,7 +25,7 @@ profiler_builtins = { path = "../libprofiler_builtins", optional = true } unwind = { path = "../libunwind" } [dev-dependencies] -rand = "0.4" +rand = "0.5" [target.x86_64-apple-darwin.dependencies] rustc_asan = { path = "../librustc_asan" } diff --git a/src/libstd/fs.rs b/src/libstd/fs.rs index 7632fbc41f5..e177d4a988a 100644 --- a/src/libstd/fs.rs +++ b/src/libstd/fs.rs @@ -2076,7 +2076,7 @@ mod tests { use fs::{self, File, OpenOptions}; use io::{ErrorKind, SeekFrom}; use path::Path; - use rand::{StdRng, Rng}; + use rand::{StdRng, FromEntropy, RngCore}; use str; use sys_common::io::test::{TempDir, tmpdir}; use thread; @@ -3110,7 +3110,7 @@ mod tests { #[test] fn binary_file() { let mut bytes = [0; 1024]; - StdRng::new().unwrap().fill_bytes(&mut bytes); + StdRng::from_entropy().fill_bytes(&mut bytes); let tmpdir = tmpdir(); @@ -3123,7 +3123,7 @@ mod tests { #[test] fn write_then_read() { let mut bytes = [0; 1024]; - StdRng::new().unwrap().fill_bytes(&mut bytes); + StdRng::from_entropy().fill_bytes(&mut bytes); let tmpdir = tmpdir(); diff --git a/src/libstd/sync/rwlock.rs b/src/libstd/sync/rwlock.rs index e3db60cff84..ed3a3865a6c 100644 --- a/src/libstd/sync/rwlock.rs +++ b/src/libstd/sync/rwlock.rs @@ -597,7 +597,7 @@ mod tests { thread::spawn(move || { let mut rng = rand::thread_rng(); for _ in 0..M { - if rng.gen_weighted_bool(N) { + if rng.gen_bool(1.0 / (N as f64)) { drop(r.write().unwrap()); } else { drop(r.read().unwrap()); diff --git a/src/libstd/sys_common/io.rs b/src/libstd/sys_common/io.rs index ab23936358e..a96fb192139 100644 --- a/src/libstd/sys_common/io.rs +++ b/src/libstd/sys_common/io.rs @@ -14,7 +14,7 @@ pub const DEFAULT_BUF_SIZE: usize = 8 * 1024; pub mod test { use path::{Path, PathBuf}; use env; - use rand::{self, Rng}; + use rand::{self, RngCore}; use fs; pub struct TempDir(PathBuf); diff --git a/src/libstd/tests/env.rs b/src/libstd/tests/env.rs index 8acb8a46d7b..7302a794480 100644 --- a/src/libstd/tests/env.rs +++ b/src/libstd/tests/env.rs @@ -13,11 +13,12 @@ extern crate rand; use std::env::*; use std::ffi::{OsString, OsStr}; -use rand::Rng; +use rand::{thread_rng, Rng}; +use rand::distributions::Alphanumeric; fn make_rand_name() -> OsString { - let mut rng = rand::thread_rng(); - let n = format!("TEST{}", rng.gen_ascii_chars().take(10) + let mut rng = thread_rng(); + let n = format!("TEST{}", rng.sample_iter(&Alphanumeric).take(10) .collect::<String>()); let n = OsString::from(n); assert!(var_os(&n).is_none()); |
