Skip to content
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

Update to rand 0.9.0 #136395

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
14 changes: 7 additions & 7 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3046,11 +3046,11 @@ dependencies = [

[[package]]
name = "rand_xoshiro"
version = "0.6.0"
version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6f97cdb2a36ed4183de61b2f824cc45c9f1037f28afe0a322e9fff4c108b5aaa"
checksum = "f703f4665700daf5512dcca5f43afa6af89f09db47fb56be587f80636bda2d41"
dependencies = [
"rand_core 0.6.4",
"rand_core 0.9.0",
]

[[package]]
Expand Down Expand Up @@ -3326,7 +3326,7 @@ name = "rustc_abi"
version = "0.0.0"
dependencies = [
"bitflags",
"rand 0.8.5",
"rand 0.9.0",
"rand_xoshiro",
"rustc_data_structures",
"rustc_feature",
Expand Down Expand Up @@ -3940,7 +3940,7 @@ dependencies = [
name = "rustc_incremental"
version = "0.0.0"
dependencies = [
"rand 0.8.5",
"rand 0.9.0",
"rustc_ast",
"rustc_data_structures",
"rustc_errors",
Expand Down Expand Up @@ -5324,8 +5324,8 @@ version = "0.1.0"
dependencies = [
"indicatif",
"num",
"rand 0.8.5",
"rand_chacha 0.3.1",
"rand 0.9.0",
"rand_chacha 0.9.0",
"rayon",
]

Expand Down
8 changes: 4 additions & 4 deletions compiler/rustc_abi/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ edition = "2021"
[dependencies]
# tidy-alphabetical-start
bitflags = "2.4.1"
rand = { version = "0.8.4", default-features = false, optional = true }
rand_xoshiro = { version = "0.6.0", optional = true }
rustc_data_structures = { path = "../rustc_data_structures", optional = true }
rand = { version = "0.9.0", default-features = false, optional = true }
rand_xoshiro = { version = "0.7.0", optional = true }
rustc_data_structures = { path = "../rustc_data_structures", optional = true }
rustc_feature = { path = "../rustc_feature", optional = true }
rustc_index = { path = "../rustc_index", default-features = false }
rustc_macros = { path = "../rustc_macros", optional = true }
rustc_serialize = { path = "../rustc_serialize", optional = true }
rustc_serialize = { path = "../rustc_serialize", optional = true }
rustc_span = { path = "../rustc_span", optional = true }
tracing = "0.1"
# tidy-alphabetical-end
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_incremental/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ edition = "2021"

[dependencies]
# tidy-alphabetical-start
rand = "0.8.4"
rand = "0.9.0"
rustc_ast = { path = "../rustc_ast" }
rustc_data_structures = { path = "../rustc_data_structures" }
rustc_errors = { path = "../rustc_errors" }
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_incremental/src/persist/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ use std::io::{self, ErrorKind};
use std::path::{Path, PathBuf};
use std::time::{Duration, SystemTime, UNIX_EPOCH};

use rand::{RngCore, thread_rng};
use rand::{RngCore, rng};
use rustc_data_structures::base_n::{BaseNString, CASE_INSENSITIVE, ToBaseN};
use rustc_data_structures::fx::{FxHashSet, FxIndexSet};
use rustc_data_structures::svh::Svh;
Expand Down Expand Up @@ -444,7 +444,7 @@ fn copy_files(sess: &Session, target_dir: &Path, source_dir: &Path) -> Result<bo
fn generate_session_dir_path(crate_dir: &Path) -> PathBuf {
let timestamp = timestamp_to_string(SystemTime::now());
debug!("generate_session_dir_path: timestamp = {}", timestamp);
let random_number = thread_rng().next_u32();
let random_number = rng().next_u32();
debug!("generate_session_dir_path: random_number = {}", random_number);

// Chop the first 3 characters off the timestamp. Those 3 bytes will be zero for a while.
Expand Down
4 changes: 2 additions & 2 deletions src/etc/test-float-parse/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ publish = false
[dependencies]
indicatif = { version = "0.17.8", default-features = false }
num = "0.4.3"
rand = "0.8.5"
rand_chacha = "0.3"
rand = "0.9.0"
rand_chacha = "0.9.0"
rayon = "1"

[lib]
Expand Down
8 changes: 4 additions & 4 deletions src/etc/test-float-parse/src/gen/fuzz.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use std::ops::Range;
use std::sync::Mutex;

use rand::Rng;
use rand::distributions::{Distribution, Standard};
use rand::distr::{Distribution, StandardUniform};
use rand_chacha::ChaCha8Rng;
use rand_chacha::rand_core::SeedableRng;

Expand Down Expand Up @@ -47,7 +47,7 @@ impl<F: Float> Fuzz<F> {

impl<F: Float> Generator<F> for Fuzz<F>
where
Standard: Distribution<<F as Float>::Int>,
StandardUniform: Distribution<<F as Float>::Int>,
{
const NAME: &'static str = "fuzz";
const SHORT_NAME: &'static str = "fuzz";
Expand Down Expand Up @@ -75,13 +75,13 @@ where

impl<F: Float> Iterator for Fuzz<F>
where
Standard: Distribution<<F as Float>::Int>,
StandardUniform: Distribution<<F as Float>::Int>,
{
type Item = <Self as Generator<F>>::WriteCtx;

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

Some(F::from_bits(i))
}
Expand Down
14 changes: 7 additions & 7 deletions src/etc/test-float-parse/src/gen/many_digits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::fmt::Write;
use std::marker::PhantomData;
use std::ops::{Range, RangeInclusive};

use rand::distributions::{Distribution, Uniform};
use rand::distr::{Distribution, Uniform};
use rand::{Rng, SeedableRng};
use rand_chacha::ChaCha8Rng;

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

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

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

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

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

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

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

if has_exp {
let exp = self.rng.gen_range(EXP_RANGE);
let exp = self.rng.random_range(EXP_RANGE);
write!(s, "e{exp}").unwrap();
}

Expand Down
4 changes: 2 additions & 2 deletions src/etc/test-float-parse/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use std::sync::{OnceLock, mpsc};
use std::{fmt, time};

use indicatif::{MultiProgress, ProgressBar};
use rand::distributions::{Distribution, Standard};
use rand::distr::{Distribution, StandardUniform};
use rayon::prelude::*;
use time::{Duration, Instant};
use traits::{Float, Generator, Int};
Expand Down Expand Up @@ -132,7 +132,7 @@ fn register_float<F: Float>(tests: &mut Vec<TestInfo>, cfg: &Config)
where
RangeInclusive<F::Int>: Iterator<Item = F::Int>,
<F::Int as TryFrom<u128>>::Error: std::fmt::Debug,
Standard: Distribution<<F as traits::Float>::Int>,
StandardUniform: Distribution<<F as traits::Float>::Int>,
{
if F::BITS <= MAX_BITS_FOR_EXHAUUSTIVE {
// Only run exhaustive tests if there is a chance of completion.
Expand Down
1 change: 1 addition & 0 deletions src/tools/tidy/src/deps.rs
Original file line number Diff line number Diff line change
Expand Up @@ -450,6 +450,7 @@ const PERMITTED_RUSTC_DEPENDENCIES: &[&str] = &[
"windows_x86_64_gnu",
"windows_x86_64_gnullvm",
"windows_x86_64_msvc",
"wit-bindgen-rt", // via wasi
"writeable",
"yoke",
"yoke-derive",
Expand Down
Loading