Skip to content

Commit 37e7372

Browse files
committed
rand 0.7 -> 0.8
rand_xorshift 0.2 -> 0.3
1 parent f6e6ddc commit 37e7372

File tree

10 files changed

+30
-24
lines changed

10 files changed

+30
-24
lines changed

Cargo.lock

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ version = "0.0.0"
3939
dependencies = [
4040
"compiler_builtins",
4141
"core",
42-
"rand 0.7.3",
42+
"rand 0.8.3",
4343
"rand_xorshift",
4444
]
4545

@@ -714,7 +714,7 @@ dependencies = [
714714
name = "core"
715715
version = "0.0.0"
716716
dependencies = [
717-
"rand 0.7.3",
717+
"rand 0.8.3",
718718
]
719719

720720
[[package]]
@@ -2929,11 +2929,11 @@ dependencies = [
29292929

29302930
[[package]]
29312931
name = "rand_xorshift"
2932-
version = "0.2.0"
2932+
version = "0.3.0"
29332933
source = "registry+https://github.com/rust-lang/crates.io-index"
2934-
checksum = "77d416b86801d23dde1aa643023b775c3a462efc0ed96443add11546cdf1dca8"
2934+
checksum = "d25bf25ec5ae4a3f1b92f929810509a2f53d7dca2f50b794ff57e3face536c8f"
29352935
dependencies = [
2936-
"rand_core 0.5.1",
2936+
"rand_core 0.6.2",
29372937
]
29382938

29392939
[[package]]
@@ -3896,7 +3896,7 @@ dependencies = [
38963896
name = "rustc_incremental"
38973897
version = "0.0.0"
38983898
dependencies = [
3899-
"rand 0.7.3",
3899+
"rand 0.8.3",
39003900
"rustc_ast",
39013901
"rustc_data_structures",
39023902
"rustc_errors",
@@ -4954,7 +4954,7 @@ dependencies = [
49544954
"panic_abort",
49554955
"panic_unwind",
49564956
"profiler_builtins",
4957-
"rand 0.7.3",
4957+
"rand 0.8.3",
49584958
"rustc-demangle",
49594959
"std_detect",
49604960
"unwind",

compiler/rustc_incremental/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ doctest = false
99
[dependencies]
1010
rustc_graphviz = { path = "../rustc_graphviz" }
1111
tracing = "0.1"
12-
rand = "0.7"
12+
rand = "0.8"
1313
rustc_middle = { path = "../rustc_middle" }
1414
rustc_data_structures = { path = "../rustc_data_structures" }
1515
rustc_hir = { path = "../rustc_hir" }

library/alloc/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ core = { path = "../core" }
1313
compiler_builtins = { version = "0.1.40", features = ['rustc-dep-of-std'] }
1414

1515
[dev-dependencies]
16-
rand = "0.7"
17-
rand_xorshift = "0.2"
16+
rand = "0.8"
17+
rand_xorshift = "0.3"
1818

1919
[[test]]
2020
name = "collectionstests"

library/alloc/benches/slice.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -186,12 +186,12 @@ const SEED: [u8; 16] = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15];
186186

187187
fn gen_random(len: usize) -> Vec<u64> {
188188
let mut rng = XorShiftRng::from_seed(SEED);
189-
(&mut rng).sample_iter(&Standard).take(len).collect()
189+
(&mut rng).sample_iter(Standard).take(len).collect()
190190
}
191191

192192
fn gen_random_bytes(len: usize) -> Vec<u8> {
193193
let mut rng = XorShiftRng::from_seed(SEED);
194-
(&mut rng).sample_iter(&Standard).take(len).collect()
194+
(&mut rng).sample_iter(Standard).take(len).collect()
195195
}
196196

197197
fn gen_mostly_ascending(len: usize) -> Vec<u64> {
@@ -221,14 +221,14 @@ fn gen_strings(len: usize) -> Vec<String> {
221221
let mut v = vec![];
222222
for _ in 0..len {
223223
let n = rng.gen::<usize>() % 20 + 1;
224-
v.push((&mut rng).sample_iter(&Alphanumeric).take(n).collect());
224+
v.push((&mut rng).sample_iter(Alphanumeric).map(char::from).take(n).collect());
225225
}
226226
v
227227
}
228228

229229
fn gen_big_random(len: usize) -> Vec<[u64; 16]> {
230230
let mut rng = XorShiftRng::from_seed(SEED);
231-
(&mut rng).sample_iter(&Standard).map(|x| [x; 16]).take(len).collect()
231+
(&mut rng).sample_iter(Standard).map(|x| [x; 16]).take(len).collect()
232232
}
233233

234234
macro_rules! sort {

library/alloc/benches/vec.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use rand::RngCore;
1+
use rand::{thread_rng, RngCore};
22
use std::iter::{repeat, FromIterator};
33
use test::{black_box, Bencher};
44

@@ -476,7 +476,7 @@ fn bench_in_place_recycle(b: &mut Bencher) {
476476
#[bench]
477477
fn bench_in_place_zip_recycle(b: &mut Bencher) {
478478
let mut data = vec![0u8; 1000];
479-
let mut rng = rand::thread_rng();
479+
let mut rng = thread_rng();
480480
let mut subst = vec![0u8; 1000];
481481
rng.fill_bytes(&mut subst[..]);
482482

@@ -495,7 +495,7 @@ fn bench_in_place_zip_recycle(b: &mut Bencher) {
495495
#[bench]
496496
fn bench_in_place_zip_iter_mut(b: &mut Bencher) {
497497
let mut data = vec![0u8; 256];
498-
let mut rng = rand::thread_rng();
498+
let mut rng = thread_rng();
499499
let mut subst = vec![0u8; 1000];
500500
rng.fill_bytes(&mut subst[..]);
501501

library/alloc/tests/slice.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -396,8 +396,11 @@ fn test_sort() {
396396
for len in (2..25).chain(500..510) {
397397
for &modulus in &[5, 10, 100, 1000] {
398398
for _ in 0..10 {
399-
let orig: Vec<_> =
400-
rng.sample_iter::<i32, _>(&Standard).map(|x| x % modulus).take(len).collect();
399+
let orig: Vec<_> = (&mut rng)
400+
.sample_iter::<i32, _>(Standard)
401+
.map(|x| x % modulus)
402+
.take(len)
403+
.collect();
401404

402405
// Sort in default order.
403406
let mut v = orig.clone();

library/core/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ path = "benches/lib.rs"
2222
test = true
2323

2424
[dev-dependencies]
25-
rand = "0.7"
25+
rand = "0.8"
2626

2727
[features]
2828
# Make panics and failed asserts immediately abort without formatting any message

library/std/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ default-features = false
3333
features = ['read_core', 'elf', 'macho', 'pe', 'unaligned', 'archive']
3434

3535
[dev-dependencies]
36-
rand = "0.7"
36+
rand = "0.8"
3737

3838
[target.'cfg(any(all(target_arch = "wasm32", not(target_os = "emscripten")), all(target_vendor = "fortanix", target_env = "sgx")))'.dependencies]
3939
dlmalloc = { version = "0.2.1", features = ['rustc-dep-of-std'] }

library/std/src/collections/hash/map/tests.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -711,12 +711,12 @@ fn test_entry_take_doesnt_corrupt() {
711711

712712
// Populate the map with some items.
713713
for _ in 0..50 {
714-
let x = rng.gen_range(-10, 10);
714+
let x = rng.gen_range(-10..10);
715715
m.insert(x, ());
716716
}
717717

718718
for _ in 0..1000 {
719-
let x = rng.gen_range(-10, 10);
719+
let x = rng.gen_range(-10..10);
720720
match m.entry(x) {
721721
Vacant(_) => {}
722722
Occupied(e) => {

library/std/tests/env.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,10 @@ use rand::{thread_rng, Rng};
66

77
fn make_rand_name() -> OsString {
88
let rng = thread_rng();
9-
let n = format!("TEST{}", rng.sample_iter(&Alphanumeric).take(10).collect::<String>());
9+
let n = format!(
10+
"TEST{}",
11+
rng.sample_iter(Alphanumeric).map(char::from).take(10).collect::<String>()
12+
);
1013
let n = OsString::from(n);
1114
assert!(var_os(&n).is_none());
1215
n

0 commit comments

Comments
 (0)