Skip to content

Commit 75b8fac

Browse files
committed
Update rand to 0.9.0
1 parent 4b696e6 commit 75b8fac

File tree

8 files changed

+29
-29
lines changed

8 files changed

+29
-29
lines changed

Cargo.lock

+7-7
Original file line numberDiff line numberDiff line change
@@ -2871,11 +2871,11 @@ dependencies = [
28712871

28722872
[[package]]
28732873
name = "rand_xoshiro"
2874-
version = "0.6.0"
2874+
version = "0.7.0"
28752875
source = "registry+https://github.com/rust-lang/crates.io-index"
2876-
checksum = "6f97cdb2a36ed4183de61b2f824cc45c9f1037f28afe0a322e9fff4c108b5aaa"
2876+
checksum = "f703f4665700daf5512dcca5f43afa6af89f09db47fb56be587f80636bda2d41"
28772877
dependencies = [
2878-
"rand_core 0.6.4",
2878+
"rand_core 0.9.0",
28792879
]
28802880

28812881
[[package]]
@@ -3144,7 +3144,7 @@ name = "rustc_abi"
31443144
version = "0.0.0"
31453145
dependencies = [
31463146
"bitflags",
3147-
"rand 0.8.5",
3147+
"rand 0.9.0",
31483148
"rand_xoshiro",
31493149
"rustc_data_structures",
31503150
"rustc_hashes",
@@ -3777,7 +3777,7 @@ dependencies = [
37773777
name = "rustc_incremental"
37783778
version = "0.0.0"
37793779
dependencies = [
3780-
"rand 0.8.5",
3780+
"rand 0.9.0",
37813781
"rustc_ast",
37823782
"rustc_data_structures",
37833783
"rustc_errors",
@@ -5163,8 +5163,8 @@ version = "0.1.0"
51635163
dependencies = [
51645164
"indicatif",
51655165
"num",
5166-
"rand 0.8.5",
5167-
"rand_chacha 0.3.1",
5166+
"rand 0.9.0",
5167+
"rand_chacha 0.9.0",
51685168
"rayon",
51695169
]
51705170

compiler/rustc_abi/Cargo.toml

+4-4
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ edition = "2024"
66
[dependencies]
77
# tidy-alphabetical-start
88
bitflags = "2.4.1"
9-
rand = { version = "0.8.4", default-features = false, optional = true }
10-
rand_xoshiro = { version = "0.6.0", optional = true }
11-
rustc_data_structures = { path = "../rustc_data_structures", optional = true }
9+
rand = { version = "0.9.0", default-features = false, optional = true }
10+
rand_xoshiro = { version = "0.7.0", optional = true }
11+
rustc_data_structures = { path = "../rustc_data_structures", optional = true }
1212
rustc_hashes = { path = "../rustc_hashes" }
1313
rustc_index = { path = "../rustc_index", default-features = false }
1414
rustc_macros = { path = "../rustc_macros", optional = true }
15-
rustc_serialize = { path = "../rustc_serialize", optional = true }
15+
rustc_serialize = { path = "../rustc_serialize", optional = true }
1616
rustc_span = { path = "../rustc_span", optional = true }
1717
tracing = "0.1"
1818
# tidy-alphabetical-end

compiler/rustc_incremental/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ edition = "2024"
55

66
[dependencies]
77
# tidy-alphabetical-start
8-
rand = "0.8.4"
8+
rand = "0.9.0"
99
rustc_ast = { path = "../rustc_ast" }
1010
rustc_data_structures = { path = "../rustc_data_structures" }
1111
rustc_errors = { path = "../rustc_errors" }

compiler/rustc_incremental/src/persist/fs.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ use std::io::{self, ErrorKind};
108108
use std::path::{Path, PathBuf};
109109
use std::time::{Duration, SystemTime, UNIX_EPOCH};
110110

111-
use rand::{RngCore, thread_rng};
111+
use rand::{RngCore, rng};
112112
use rustc_data_structures::base_n::{BaseNString, CASE_INSENSITIVE, ToBaseN};
113113
use rustc_data_structures::fx::{FxHashSet, FxIndexSet};
114114
use rustc_data_structures::svh::Svh;
@@ -445,7 +445,7 @@ fn copy_files(sess: &Session, target_dir: &Path, source_dir: &Path) -> Result<bo
445445
fn generate_session_dir_path(crate_dir: &Path) -> PathBuf {
446446
let timestamp = timestamp_to_string(SystemTime::now());
447447
debug!("generate_session_dir_path: timestamp = {}", timestamp);
448-
let random_number = thread_rng().next_u32();
448+
let random_number = rng().next_u32();
449449
debug!("generate_session_dir_path: random_number = {}", random_number);
450450

451451
// Chop the first 3 characters off the timestamp. Those 3 bytes will be zero for a while.

src/etc/test-float-parse/Cargo.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ publish = false
77
[dependencies]
88
indicatif = { version = "0.17.8", default-features = false }
99
num = "0.4.3"
10-
rand = "0.8.5"
11-
rand_chacha = "0.3"
10+
rand = "0.9.0"
11+
rand_chacha = "0.9.0"
1212
rayon = "1"
1313

1414
[lib]

src/etc/test-float-parse/src/gen/fuzz.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use std::ops::Range;
66
use std::sync::Mutex;
77

88
use rand::Rng;
9-
use rand::distributions::{Distribution, Standard};
9+
use rand::distr::{Distribution, StandardUniform};
1010
use rand_chacha::ChaCha8Rng;
1111
use rand_chacha::rand_core::SeedableRng;
1212

@@ -47,7 +47,7 @@ impl<F: Float> Fuzz<F> {
4747

4848
impl<F: Float> Generator<F> for Fuzz<F>
4949
where
50-
Standard: Distribution<<F as Float>::Int>,
50+
StandardUniform: Distribution<<F as Float>::Int>,
5151
{
5252
const NAME: &'static str = "fuzz";
5353
const SHORT_NAME: &'static str = "fuzz";
@@ -75,13 +75,13 @@ where
7575

7676
impl<F: Float> Iterator for Fuzz<F>
7777
where
78-
Standard: Distribution<<F as Float>::Int>,
78+
StandardUniform: Distribution<<F as Float>::Int>,
7979
{
8080
type Item = <Self as Generator<F>>::WriteCtx;
8181

8282
fn next(&mut self) -> Option<Self::Item> {
8383
let _ = self.iter.next()?;
84-
let i: F::Int = self.rng.gen();
84+
let i: F::Int = self.rng.random();
8585

8686
Some(F::from_bits(i))
8787
}

src/etc/test-float-parse/src/gen/many_digits.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use std::fmt::Write;
33
use std::marker::PhantomData;
44
use std::ops::{Range, RangeInclusive};
55

6-
use rand::distributions::{Distribution, Uniform};
6+
use rand::distr::{Distribution, Uniform};
77
use rand::{Rng, SeedableRng};
88
use rand_chacha::ChaCha8Rng;
99

@@ -40,7 +40,7 @@ impl<F: Float> Generator<F> for RandDigits<F> {
4040

4141
fn new() -> Self {
4242
let rng = ChaCha8Rng::from_seed(SEED);
43-
let range = Uniform::from(0..10);
43+
let range = Uniform::try_from(0..10).unwrap();
4444

4545
Self { rng, iter: 0..ITERATIONS, uniform: range, marker: PhantomData }
4646
}
@@ -55,11 +55,11 @@ impl<F: Float> Iterator for RandDigits<F> {
5555

5656
fn next(&mut self) -> Option<Self::Item> {
5757
let _ = self.iter.next()?;
58-
let num_digits = self.rng.gen_range(POSSIBLE_NUM_DIGITS);
59-
let has_decimal = self.rng.gen_bool(0.2);
60-
let has_exp = self.rng.gen_bool(0.2);
58+
let num_digits = self.rng.random_range(POSSIBLE_NUM_DIGITS);
59+
let has_decimal = self.rng.random_bool(0.2);
60+
let has_exp = self.rng.random_bool(0.2);
6161

62-
let dec_pos = if has_decimal { Some(self.rng.gen_range(0..num_digits)) } else { None };
62+
let dec_pos = if has_decimal { Some(self.rng.random_range(0..num_digits)) } else { None };
6363

6464
let mut s = String::with_capacity(num_digits);
6565

@@ -75,7 +75,7 @@ impl<F: Float> Iterator for RandDigits<F> {
7575
}
7676

7777
if has_exp {
78-
let exp = self.rng.gen_range(EXP_RANGE);
78+
let exp = self.rng.random_range(EXP_RANGE);
7979
write!(s, "e{exp}").unwrap();
8080
}
8181

src/etc/test-float-parse/src/lib.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use std::sync::{OnceLock, mpsc};
1111
use std::{fmt, time};
1212

1313
use indicatif::{MultiProgress, ProgressBar};
14-
use rand::distributions::{Distribution, Standard};
14+
use rand::distr::{Distribution, StandardUniform};
1515
use rayon::prelude::*;
1616
use time::{Duration, Instant};
1717
use traits::{Float, Generator, Int};
@@ -132,7 +132,7 @@ fn register_float<F: Float>(tests: &mut Vec<TestInfo>, cfg: &Config)
132132
where
133133
RangeInclusive<F::Int>: Iterator<Item = F::Int>,
134134
<F::Int as TryFrom<u128>>::Error: std::fmt::Debug,
135-
Standard: Distribution<<F as traits::Float>::Int>,
135+
StandardUniform: Distribution<<F as traits::Float>::Int>,
136136
{
137137
if F::BITS <= MAX_BITS_FOR_EXHAUUSTIVE {
138138
// Only run exhaustive tests if there is a chance of completion.

0 commit comments

Comments
 (0)