Skip to content

Commit a4bf36e

Browse files
committed
Update rand in the stdlib tests, and remove the getrandom feature from it
1 parent 659e169 commit a4bf36e

File tree

22 files changed

+508
-480
lines changed

22 files changed

+508
-480
lines changed

Cargo.lock

+34-91
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ version = "0.7.4"
3030
source = "registry+https://github.com/rust-lang/crates.io-index"
3131
checksum = "43bb833f0bf979d8475d38fbf09ed3b8a55e1885fe93ad3f93239fc6a4f17b98"
3232
dependencies = [
33-
"getrandom 0.2.8",
33+
"getrandom",
3434
"once_cell",
3535
"version_check",
3636
]
@@ -50,7 +50,7 @@ version = "0.0.0"
5050
dependencies = [
5151
"compiler_builtins",
5252
"core",
53-
"rand 0.7.3",
53+
"rand",
5454
"rand_xorshift",
5555
]
5656

@@ -947,7 +947,7 @@ checksum = "6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e"
947947
name = "core"
948948
version = "0.0.0"
949949
dependencies = [
950-
"rand 0.7.3",
950+
"rand",
951951
"rand_xorshift",
952952
]
953953

@@ -1051,7 +1051,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
10511051
checksum = "ef2b4b23cddf68b89b8f8069890e8c270d54e2d5fe1b143820234805e4cb17ef"
10521052
dependencies = [
10531053
"generic-array",
1054-
"rand_core 0.6.4",
1054+
"rand_core",
10551055
"subtle",
10561056
"zeroize",
10571057
]
@@ -1310,7 +1310,7 @@ version = "2.0.4"
13101310
source = "registry+https://github.com/rust-lang/crates.io-index"
13111311
checksum = "6a3d382e8464107391c8706b4c14b087808ecb909f6c15c34114bc42e53a9e4c"
13121312
dependencies = [
1313-
"getrandom 0.2.8",
1313+
"getrandom",
13141314
]
13151315

13161316
[[package]]
@@ -1347,7 +1347,7 @@ dependencies = [
13471347
"hkdf",
13481348
"pem-rfc7468",
13491349
"pkcs8",
1350-
"rand_core 0.6.4",
1350+
"rand_core",
13511351
"sec1",
13521352
"subtle",
13531353
"zeroize",
@@ -1478,7 +1478,7 @@ version = "0.12.1"
14781478
source = "registry+https://github.com/rust-lang/crates.io-index"
14791479
checksum = "d013fc25338cc558c5c2cfbad646908fb23591e2404481826742b651c9af7160"
14801480
dependencies = [
1481-
"rand_core 0.6.4",
1481+
"rand_core",
14821482
"subtle",
14831483
]
14841484

@@ -1745,17 +1745,6 @@ dependencies = [
17451745
"unicode-width",
17461746
]
17471747

1748-
[[package]]
1749-
name = "getrandom"
1750-
version = "0.1.16"
1751-
source = "registry+https://github.com/rust-lang/crates.io-index"
1752-
checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce"
1753-
dependencies = [
1754-
"cfg-if",
1755-
"libc",
1756-
"wasi 0.9.0+wasi-snapshot-preview1",
1757-
]
1758-
17591748
[[package]]
17601749
name = "getrandom"
17611750
version = "0.2.8"
@@ -1765,7 +1754,7 @@ dependencies = [
17651754
"cfg-if",
17661755
"js-sys",
17671756
"libc",
1768-
"wasi 0.11.0+wasi-snapshot-preview1",
1757+
"wasi",
17691758
"wasm-bindgen",
17701759
]
17711760

@@ -1836,7 +1825,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
18361825
checksum = "5dfbfb3a6cfbd390d5c9564ab283a0349b9b9fcd46a706c1eb10e0db70bfbac7"
18371826
dependencies = [
18381827
"ff",
1839-
"rand_core 0.6.4",
1828+
"rand_core",
18401829
"subtle",
18411830
]
18421831

@@ -2111,7 +2100,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
21112100
checksum = "af1955a75fa080c677d3972822ec4bad316169ab1cfc6c257a942c2265dbe5fe"
21122101
dependencies = [
21132102
"bitmaps",
2114-
"rand_core 0.6.4",
2103+
"rand_core",
21152104
"rand_xoshiro",
21162105
"sized-chunks",
21172106
"typenum",
@@ -2656,14 +2645,14 @@ version = "0.1.0"
26562645
dependencies = [
26572646
"colored",
26582647
"env_logger 0.9.0",
2659-
"getrandom 0.2.8",
2648+
"getrandom",
26602649
"lazy_static",
26612650
"libc",
26622651
"libffi",
26632652
"libloading",
26642653
"log",
26652654
"measureme",
2666-
"rand 0.8.5",
2655+
"rand",
26672656
"regex",
26682657
"rustc-workspace-hack",
26692658
"rustc_version",
@@ -2966,10 +2955,10 @@ checksum = "ed20c4c21d893414f42e0cbfebe8a8036b5ae9b0264611fb6504e395eda6ceec"
29662955
dependencies = [
29672956
"ct-codecs",
29682957
"ed25519-compact",
2969-
"getrandom 0.2.8",
2958+
"getrandom",
29702959
"orion",
29712960
"p384",
2972-
"rand_core 0.6.4",
2961+
"rand_core",
29732962
"regex",
29742963
"serde",
29752964
"serde_json",
@@ -3089,7 +3078,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
30893078
checksum = "5d5285893bb5eb82e6aaf5d59ee909a06a16737a8970984dd7746ba9283498d6"
30903079
dependencies = [
30913080
"phf_shared",
3092-
"rand 0.8.5",
3081+
"rand",
30933082
]
30943083

30953084
[[package]]
@@ -3294,38 +3283,15 @@ dependencies = [
32943283
"proc-macro2",
32953284
]
32963285

3297-
[[package]]
3298-
name = "rand"
3299-
version = "0.7.3"
3300-
source = "registry+https://github.com/rust-lang/crates.io-index"
3301-
checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03"
3302-
dependencies = [
3303-
"getrandom 0.1.16",
3304-
"libc",
3305-
"rand_chacha 0.2.2",
3306-
"rand_core 0.5.1",
3307-
"rand_hc",
3308-
]
3309-
33103286
[[package]]
33113287
name = "rand"
33123288
version = "0.8.5"
33133289
source = "registry+https://github.com/rust-lang/crates.io-index"
33143290
checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404"
33153291
dependencies = [
33163292
"libc",
3317-
"rand_chacha 0.3.0",
3318-
"rand_core 0.6.4",
3319-
]
3320-
3321-
[[package]]
3322-
name = "rand_chacha"
3323-
version = "0.2.2"
3324-
source = "registry+https://github.com/rust-lang/crates.io-index"
3325-
checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402"
3326-
dependencies = [
3327-
"ppv-lite86",
3328-
"rand_core 0.5.1",
3293+
"rand_chacha",
3294+
"rand_core",
33293295
]
33303296

33313297
[[package]]
@@ -3335,16 +3301,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
33353301
checksum = "e12735cf05c9e10bf21534da50a147b924d555dc7a547c42e6bb2d5b6017ae0d"
33363302
dependencies = [
33373303
"ppv-lite86",
3338-
"rand_core 0.6.4",
3339-
]
3340-
3341-
[[package]]
3342-
name = "rand_core"
3343-
version = "0.5.1"
3344-
source = "registry+https://github.com/rust-lang/crates.io-index"
3345-
checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19"
3346-
dependencies = [
3347-
"getrandom 0.1.16",
3304+
"rand_core",
33483305
]
33493306

33503307
[[package]]
@@ -3353,25 +3310,16 @@ version = "0.6.4"
33533310
source = "registry+https://github.com/rust-lang/crates.io-index"
33543311
checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c"
33553312
dependencies = [
3356-
"getrandom 0.2.8",
3357-
]
3358-
3359-
[[package]]
3360-
name = "rand_hc"
3361-
version = "0.2.0"
3362-
source = "registry+https://github.com/rust-lang/crates.io-index"
3363-
checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c"
3364-
dependencies = [
3365-
"rand_core 0.5.1",
3313+
"getrandom",
33663314
]
33673315

33683316
[[package]]
33693317
name = "rand_xorshift"
3370-
version = "0.2.0"
3318+
version = "0.3.0"
33713319
source = "registry+https://github.com/rust-lang/crates.io-index"
3372-
checksum = "77d416b86801d23dde1aa643023b775c3a462efc0ed96443add11546cdf1dca8"
3320+
checksum = "d25bf25ec5ae4a3f1b92f929810509a2f53d7dca2f50b794ff57e3face536c8f"
33733321
dependencies = [
3374-
"rand_core 0.5.1",
3322+
"rand_core",
33753323
]
33763324

33773325
[[package]]
@@ -3380,7 +3328,7 @@ version = "0.6.0"
33803328
source = "registry+https://github.com/rust-lang/crates.io-index"
33813329
checksum = "6f97cdb2a36ed4183de61b2f824cc45c9f1037f28afe0a322e9fff4c108b5aaa"
33823330
dependencies = [
3383-
"rand_core 0.6.4",
3331+
"rand_core",
33843332
]
33853333

33863334
[[package]]
@@ -3422,7 +3370,7 @@ version = "0.4.0"
34223370
source = "registry+https://github.com/rust-lang/crates.io-index"
34233371
checksum = "528532f3d801c87aec9def2add9ca802fe569e44a544afe633765267840abe64"
34243372
dependencies = [
3425-
"getrandom 0.2.8",
3373+
"getrandom",
34263374
"redox_syscall",
34273375
]
34283376

@@ -3636,10 +3584,10 @@ version = "1.0.0"
36363584
dependencies = [
36373585
"bstr 0.2.17",
36383586
"clap 3.2.20",
3639-
"getrandom 0.2.8",
3587+
"getrandom",
36403588
"libc",
36413589
"libz-sys",
3642-
"rand 0.8.5",
3590+
"rand",
36433591
"regex",
36443592
"serde_json",
36453593
"syn",
@@ -3652,7 +3600,7 @@ name = "rustc_abi"
36523600
version = "0.0.0"
36533601
dependencies = [
36543602
"bitflags",
3655-
"rand 0.8.5",
3603+
"rand",
36563604
"rand_xoshiro",
36573605
"rustc_data_structures",
36583606
"rustc_index",
@@ -4156,7 +4104,7 @@ dependencies = [
41564104
name = "rustc_incremental"
41574105
version = "0.0.0"
41584106
dependencies = [
4159-
"rand 0.8.5",
4107+
"rand",
41604108
"rustc_ast",
41614109
"rustc_data_structures",
41624110
"rustc_errors",
@@ -5179,7 +5127,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
51795127
checksum = "74233d3b3b2f6d4b006dc19dee745e73e2a6bfb6f93607cd3b02bd5b00797d7c"
51805128
dependencies = [
51815129
"digest",
5182-
"rand_core 0.6.4",
5130+
"rand_core",
51835131
]
51845132

51855133
[[package]]
@@ -5339,11 +5287,12 @@ dependencies = [
53395287
"panic_abort",
53405288
"panic_unwind",
53415289
"profiler_builtins",
5342-
"rand 0.7.3",
5290+
"rand",
5291+
"rand_xorshift",
53435292
"rustc-demangle",
53445293
"std_detect",
53455294
"unwind",
5346-
"wasi 0.11.0+wasi-snapshot-preview1",
5295+
"wasi",
53475296
]
53485297

53495298
[[package]]
@@ -5815,7 +5764,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
58155764
checksum = "97fee6b57c6a41524a810daee9286c02d7752c4253064d0b05472833a438f675"
58165765
dependencies = [
58175766
"cfg-if",
5818-
"rand 0.8.5",
5767+
"rand",
58195768
"static_assertions",
58205769
]
58215770

@@ -6098,7 +6047,7 @@ version = "0.8.2"
60986047
source = "registry+https://github.com/rust-lang/crates.io-index"
60996048
checksum = "bc5cf98d8186244414c848017f0e2676b3fcb46807f6668a97dfe67359a3c4b7"
61006049
dependencies = [
6101-
"getrandom 0.2.8",
6050+
"getrandom",
61026051
]
61036052

61046053
[[package]]
@@ -6139,12 +6088,6 @@ dependencies = [
61396088
"winapi-util",
61406089
]
61416090

6142-
[[package]]
6143-
name = "wasi"
6144-
version = "0.9.0+wasi-snapshot-preview1"
6145-
source = "registry+https://github.com/rust-lang/crates.io-index"
6146-
checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519"
6147-
61486091
[[package]]
61496092
name = "wasi"
61506093
version = "0.11.0+wasi-snapshot-preview1"

library/alloc/Cargo.toml

+2-2
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 = { version = "0.8.5", default-features = false, features = ["alloc"] }
17+
rand_xorshift = "0.3.0"
1818

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

library/alloc/benches/slice.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use std::{mem, ptr};
22

3-
use rand::distributions::{Alphanumeric, Standard};
3+
use rand::distributions::{Alphanumeric, DistString, Standard};
44
use rand::Rng;
55
use test::{black_box, Bencher};
66

@@ -218,7 +218,7 @@ fn gen_strings(len: usize) -> Vec<String> {
218218
let mut v = vec![];
219219
for _ in 0..len {
220220
let n = rng.gen::<usize>() % 20 + 1;
221-
v.push((&mut rng).sample_iter(&Alphanumeric).take(n).collect());
221+
v.push(Alphanumeric.sample_string(&mut rng, n));
222222
}
223223
v
224224
}

library/alloc/src/collections/binary_heap/tests.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,7 @@ fn test_retain() {
465465
#[test]
466466
#[cfg(not(target_os = "emscripten"))]
467467
fn panic_safe() {
468-
use rand::{seq::SliceRandom, thread_rng};
468+
use rand::seq::SliceRandom;
469469
use std::cmp;
470470
use std::panic::{self, AssertUnwindSafe};
471471
use std::sync::atomic::{AtomicUsize, Ordering};
@@ -490,7 +490,7 @@ fn panic_safe() {
490490
self.0.partial_cmp(&other.0)
491491
}
492492
}
493-
let mut rng = thread_rng();
493+
let mut rng = crate::test_helpers::test_rng();
494494
const DATASZ: usize = 32;
495495
// Miri is too slow
496496
let ntest = if cfg!(miri) { 1 } else { 10 };

0 commit comments

Comments
 (0)