Skip to content

Commit fd2aa86

Browse files
committed
Update rand to 0.9.0
1 parent 613bdd4 commit fd2aa86

File tree

8 files changed

+27
-27
lines changed

8 files changed

+27
-27
lines changed

Cargo.lock

+7-7
Original file line numberDiff line numberDiff line change
@@ -3046,11 +3046,11 @@ dependencies = [
30463046

30473047
[[package]]
30483048
name = "rand_xoshiro"
3049-
version = "0.6.0"
3049+
version = "0.7.0"
30503050
source = "registry+https://github.com/rust-lang/crates.io-index"
3051-
checksum = "6f97cdb2a36ed4183de61b2f824cc45c9f1037f28afe0a322e9fff4c108b5aaa"
3051+
checksum = "f703f4665700daf5512dcca5f43afa6af89f09db47fb56be587f80636bda2d41"
30523052
dependencies = [
3053-
"rand_core 0.6.4",
3053+
"rand_core 0.9.0",
30543054
]
30553055

30563056
[[package]]
@@ -3326,7 +3326,7 @@ name = "rustc_abi"
33263326
version = "0.0.0"
33273327
dependencies = [
33283328
"bitflags",
3329-
"rand 0.8.5",
3329+
"rand 0.9.0",
33303330
"rand_xoshiro",
33313331
"rustc_data_structures",
33323332
"rustc_feature",
@@ -3940,7 +3940,7 @@ dependencies = [
39403940
name = "rustc_incremental"
39413941
version = "0.0.0"
39423942
dependencies = [
3943-
"rand 0.8.5",
3943+
"rand 0.9.0",
39443944
"rustc_ast",
39453945
"rustc_data_structures",
39463946
"rustc_errors",
@@ -5324,8 +5324,8 @@ version = "0.1.0"
53245324
dependencies = [
53255325
"indicatif",
53265326
"num",
5327-
"rand 0.8.5",
5328-
"rand_chacha 0.3.1",
5327+
"rand 0.9.0",
5328+
"rand_chacha 0.9.0",
53295329
"rayon",
53305330
]
53315331

compiler/rustc_abi/Cargo.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ edition = "2021"
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 }
119
rustc_data_structures = { path = "../rustc_data_structures", optional = true }
10+
rand = { version = "0.9.0", default-features = false, optional = true }
11+
rand_xoshiro = { version = "0.7.0", optional = true }
1212
rustc_feature = { path = "../rustc_feature", optional = true }
1313
rustc_index = { path = "../rustc_index", default-features = false }
1414
rustc_macros = { path = "../rustc_macros", optional = true }

compiler/rustc_incremental/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ edition = "2021"
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;
@@ -444,7 +444,7 @@ fn copy_files(sess: &Session, target_dir: &Path, source_dir: &Path) -> Result<bo
444444
fn generate_session_dir_path(crate_dir: &Path) -> PathBuf {
445445
let timestamp = timestamp_to_string(SystemTime::now());
446446
debug!("generate_session_dir_path: timestamp = {}", timestamp);
447-
let random_number = thread_rng().next_u32();
447+
let random_number = rng().next_u32();
448448
debug!("generate_session_dir_path: random_number = {}", random_number);
449449

450450
// 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)