Skip to content

Update rand deps #86963

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
110 changes: 94 additions & 16 deletions Cargo.lock
Original file line number Diff line number Diff line change
@@ -39,7 +39,7 @@ version = "0.0.0"
dependencies = [
"compiler_builtins",
"core",
"rand 0.7.3",
"rand 0.8.3",
"rand_xorshift",
]

@@ -232,6 +232,12 @@ dependencies = [
"toml",
]

[[package]]
name = "bumpalo"
version = "3.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d9df67f7bf9ef8498769f994239c45613ef0c5899415fb58e9add412d2c1a538"

[[package]]
name = "byte-tools"
version = "0.3.1"
@@ -714,7 +720,7 @@ dependencies = [
name = "core"
version = "0.0.0"
dependencies = [
"rand 0.7.3",
"rand 0.8.3",
]

[[package]]
@@ -1401,18 +1407,20 @@ checksum = "7abc8dd8451921606d809ba32e95b6111925cd2906060d2dcc29c070220503eb"
dependencies = [
"cfg-if 0.1.10",
"libc",
"wasi",
"wasi 0.9.0+wasi-snapshot-preview1",
]

[[package]]
name = "getrandom"
version = "0.2.0"
version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ee8025cf36f917e6a52cce185b7c7177689b838b7ec138364e50cc2277a56cf4"
checksum = "7fcd999463524c52659517fe2cea98493cfe485d10565e7b0fb07dbba7ad2753"
dependencies = [
"cfg-if 0.1.10",
"cfg-if 1.0.0",
"js-sys",
"libc",
"wasi",
"wasi 0.10.2+wasi-snapshot-preview1",
"wasm-bindgen",
]

[[package]]
@@ -1742,6 +1750,15 @@ dependencies = [
"libc",
]

[[package]]
name = "js-sys"
version = "0.3.49"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dc15e39392125075f60c95ba416f5381ff6c3a948ff02ab12464715adf56c821"
dependencies = [
"wasm-bindgen",
]

[[package]]
name = "json"
version = "0.12.4"
@@ -2251,7 +2268,7 @@ dependencies = [
"colored",
"compiletest_rs",
"env_logger 0.8.1",
"getrandom 0.2.0",
"getrandom 0.2.3",
"hex 0.4.2",
"libc",
"log",
@@ -2897,7 +2914,7 @@ version = "0.6.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "34cf66eb183df1c5876e2dcf6b13d57340741e8dc255b48e40a26de954d06ae7"
dependencies = [
"getrandom 0.2.0",
"getrandom 0.2.3",
]

[[package]]
@@ -2929,11 +2946,11 @@ dependencies = [

[[package]]
name = "rand_xorshift"
version = "0.2.0"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "77d416b86801d23dde1aa643023b775c3a462efc0ed96443add11546cdf1dca8"
checksum = "d25bf25ec5ae4a3f1b92f929810509a2f53d7dca2f50b794ff57e3face536c8f"
dependencies = [
"rand_core 0.5.1",
"rand_core 0.6.2",
]

[[package]]
@@ -2985,7 +3002,7 @@ version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "528532f3d801c87aec9def2add9ca802fe569e44a544afe633765267840abe64"
dependencies = [
"getrandom 0.2.0",
"getrandom 0.2.3",
"redox_syscall",
]

@@ -3896,7 +3913,7 @@ dependencies = [
name = "rustc_incremental"
version = "0.0.0"
dependencies = [
"rand 0.7.3",
"rand 0.8.3",
"rustc_ast",
"rustc_data_structures",
"rustc_errors",
@@ -4954,11 +4971,11 @@ dependencies = [
"panic_abort",
"panic_unwind",
"profiler_builtins",
"rand 0.7.3",
"rand 0.8.3",
"rustc-demangle",
"std_detect",
"unwind",
"wasi",
"wasi 0.9.0+wasi-snapshot-preview1",
]

[[package]]
@@ -5175,6 +5192,7 @@ dependencies = [
"cfg-if 0.1.10",
"core",
"getopts",
"getrandom 0.2.3",
"libc",
"panic_abort",
"panic_unwind",
@@ -5662,6 +5680,66 @@ dependencies = [
"rustc-std-workspace-core",
]

[[package]]
name = "wasi"
version = "0.10.2+wasi-snapshot-preview1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6"

[[package]]
name = "wasm-bindgen"
version = "0.2.72"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8fe8f61dba8e5d645a4d8132dc7a0a66861ed5e1045d2c0ed940fab33bac0fbe"
dependencies = [
"cfg-if 1.0.0",
"wasm-bindgen-macro",
]

[[package]]
name = "wasm-bindgen-backend"
version = "0.2.72"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "046ceba58ff062da072c7cb4ba5b22a37f00a302483f7e2a6cdc18fedbdc1fd3"
dependencies = [
"bumpalo",
"lazy_static",
"log",
"proc-macro2",
"quote",
"syn",
"wasm-bindgen-shared",
]

[[package]]
name = "wasm-bindgen-macro"
version = "0.2.72"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0ef9aa01d36cda046f797c57959ff5f3c615c9cc63997a8d545831ec7976819b"
dependencies = [
"quote",
"wasm-bindgen-macro-support",
]

[[package]]
name = "wasm-bindgen-macro-support"
version = "0.2.72"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "96eb45c1b2ee33545a813a92dbb53856418bf7eb54ab34f7f7ff1448a5b3735d"
dependencies = [
"proc-macro2",
"quote",
"syn",
"wasm-bindgen-backend",
"wasm-bindgen-shared",
]

[[package]]
name = "wasm-bindgen-shared"
version = "0.2.72"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b7148f4696fb4960a346eaa60bbfb42a1ac4ebba21f750f75fc1375b098d5ffa"

[[package]]
name = "winapi"
version = "0.3.9"
2 changes: 1 addition & 1 deletion compiler/rustc_incremental/Cargo.toml
Original file line number Diff line number Diff line change
@@ -9,7 +9,7 @@ doctest = false
[dependencies]
rustc_graphviz = { path = "../rustc_graphviz" }
tracing = "0.1"
rand = "0.7"
rand = "0.8"
rustc_middle = { path = "../rustc_middle" }
rustc_data_structures = { path = "../rustc_data_structures" }
rustc_hir = { path = "../rustc_hir" }
4 changes: 2 additions & 2 deletions library/alloc/Cargo.toml
Original file line number Diff line number Diff line change
@@ -13,8 +13,8 @@ core = { path = "../core" }
compiler_builtins = { version = "0.1.40", features = ['rustc-dep-of-std'] }

[dev-dependencies]
rand = "0.7"
rand_xorshift = "0.2"
rand = "0.8"
rand_xorshift = "0.3"

[[test]]
name = "collectionstests"
8 changes: 4 additions & 4 deletions library/alloc/benches/slice.rs
Original file line number Diff line number Diff 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];

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

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

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

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

macro_rules! sort {
6 changes: 3 additions & 3 deletions library/alloc/benches/vec.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use rand::RngCore;
use rand::{thread_rng, RngCore};
use std::iter::{repeat, FromIterator};
use test::{black_box, Bencher};

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

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

7 changes: 5 additions & 2 deletions library/alloc/tests/slice.rs
Original file line number Diff line number Diff line change
@@ -396,8 +396,11 @@ fn test_sort() {
for len in (2..25).chain(500..510) {
for &modulus in &[5, 10, 100, 1000] {
for _ in 0..10 {
let orig: Vec<_> =
rng.sample_iter::<i32, _>(&Standard).map(|x| x % modulus).take(len).collect();
let orig: Vec<_> = (&mut rng)
.sample_iter::<i32, _>(Standard)
.map(|x| x % modulus)
.take(len)
.collect();

// Sort in default order.
let mut v = orig.clone();
2 changes: 1 addition & 1 deletion library/core/Cargo.toml
Original file line number Diff line number Diff line change
@@ -22,7 +22,7 @@ path = "benches/lib.rs"
test = true

[dev-dependencies]
rand = "0.7"
rand = "0.8"

[features]
# Make panics and failed asserts immediately abort without formatting any message
2 changes: 1 addition & 1 deletion library/std/Cargo.toml
Original file line number Diff line number Diff line change
@@ -33,7 +33,7 @@ default-features = false
features = ['read_core', 'elf', 'macho', 'pe', 'unaligned', 'archive']

[dev-dependencies]
rand = "0.7"
rand = "0.8"

[target.'cfg(any(all(target_arch = "wasm32", not(target_os = "emscripten")), all(target_vendor = "fortanix", target_env = "sgx")))'.dependencies]
dlmalloc = { version = "0.2.1", features = ['rustc-dep-of-std'] }
4 changes: 2 additions & 2 deletions library/std/src/collections/hash/map/tests.rs
Original file line number Diff line number Diff line change
@@ -711,12 +711,12 @@ fn test_entry_take_doesnt_corrupt() {

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

for _ in 0..1000 {
let x = rng.gen_range(-10, 10);
let x = rng.gen_range(-10..10);
match m.entry(x) {
Vacant(_) => {}
Occupied(e) => {
5 changes: 4 additions & 1 deletion library/std/tests/env.rs
Original file line number Diff line number Diff line change
@@ -6,7 +6,10 @@ use rand::{thread_rng, Rng};

fn make_rand_name() -> OsString {
let rng = thread_rng();
let n = format!("TEST{}", rng.sample_iter(&Alphanumeric).take(10).collect::<String>());
let n = format!(
"TEST{}",
rng.sample_iter(Alphanumeric).map(char::from).take(10).collect::<String>()
);
let n = OsString::from(n);
assert!(var_os(&n).is_none());
n
3 changes: 3 additions & 0 deletions library/test/Cargo.toml
Original file line number Diff line number Diff line change
@@ -18,6 +18,9 @@ panic_abort = { path = "../panic_abort" }
# not actually used but needed to always have proc_macro in the sysroot
proc_macro = { path = "../proc_macro" }

[target.'cfg(all(target_arch = "wasm32", target_os = "unknown"))'.dev-dependencies]
getrandom = { version = "0.2", features = ['js'] }

# Forward features to the `std` crate as necessary
[features]
default = ["std_detect_file_io", "std_detect_dlsym_getauxval", "panic-unwind"]
7 changes: 7 additions & 0 deletions src/tools/tidy/src/deps.rs
Original file line number Diff line number Diff line change
@@ -82,6 +82,7 @@ const PERMITTED_DEPENDENCIES: &[&str] = &[
"bitflags",
"block-buffer",
"block-padding",
"bumpalo",
"byteorder",
"byte-tools",
"cc",
@@ -127,6 +128,7 @@ const PERMITTED_DEPENDENCIES: &[&str] = &[
"itertools",
"itoa",
"jobserver",
"js-sys",
"lazy_static",
"libc",
"libz-sys",
@@ -218,6 +220,11 @@ const PERMITTED_DEPENDENCIES: &[&str] = &[
"vcpkg",
"version_check",
"wasi",
"wasm-bindgen",
"wasm-bindgen-backend",
"wasm-bindgen-macro",
"wasm-bindgen-macro-support",
"wasm-bindgen-shared",
"winapi",
"winapi-i686-pc-windows-gnu",
"winapi-util",