Update Rust crate rand to 0.10 - #287
Conversation
|
PR author is in the excluded authors list. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 223b6b6a25
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| ahash = "0.8" | ||
| blake3 = "1.8" | ||
| rand = { version = "0.9", optional = true } | ||
| rand = { version = "0.10", optional = true } |
There was a problem hiding this comment.
Preserve seed replay for the simulation harnesses
Upgrading the simulation crates from rand 0.9 to 0.10 changes the sampler behind calls like random_range/random_bool, so a ChaCha8Rng seeded with an old failing seed will no longer drive the same operation stream. That breaks the reproducibility contract documented in crates/gossip-coordination/src/sim/mod.rs:31-34 and the seed-replay workflow relied on by crates/gossip-coordination/src/sim/harness_tests.rs:577-579 and crates/gossip-coordination/src/sim/mega_sim_tests.rs:495-521: any seed captured from CI or a proptest-regressions file on the 0.9 line stops reproducing the original failure after this bump.
Useful? React with 👍 / 👎.
| csv = "1.3" | ||
| memchr = "2" | ||
| rand = { version = "0.8", default-features = false, features = ["std_rng"] } | ||
| rand = { version = "0.10", default-features = false, features = ["std_rng"] } |
There was a problem hiding this comment.
Keep bootstrap CI generation on a value-stable RNG
The eval harness uses StdRng::seed_from_u64 in tools/eval-harness/src/metrics.rs:268-283,543 specifically so bootstrap confidence intervals are deterministic and comparable in CI. Moving this dependency to rand 0.10 weakens that guarantee because StdRng on the 0.10 line is explicitly non-portable, so the same BootstrapConfig { seed: 42 } can start producing different intervals after a routine dependency refresh. That will make report diffs noisy and undermine the “same input, same CI” behavior this module documents.
Useful? React with 👍 / 👎.
223b6b6 to
b163aa3
Compare
b163aa3 to
017ace7
Compare
| blake3 = "1.8" | ||
| rand = { version = "0.9", optional = true } | ||
| rand = { version = "0.10", optional = true } | ||
| rand_chacha = { version = "0.9", optional = true } |
There was a problem hiding this comment.
CRITICAL: The RNG stack is only half-upgraded here
crates/gossip-coordination/src/sim/mod.rs and the other simulation modules still use the 0.9 rand API with rand_chacha::ChaCha8Rng. Moving only rand to 0.10 is not source-compatible: 0.10 changed the trait surface, while rand_chacha 0.9 still sits on the older rand_core line. As written, the test-support targets stop compiling until the RNG crates and imports are updated together.
| tracing.workspace = true | ||
| rand = { version = "0.9", optional = true } | ||
| rand = { version = "0.10", optional = true } | ||
| rand_chacha = { version = "0.9", optional = true } |
There was a problem hiding this comment.
CRITICAL: This leaves the crate on incompatible rand APIs
crates/gossip-coordination-etcd/src/sim_etcd_kv.rs and crates/gossip-coordination-etcd/tests/concurrent_cas_contention.rs still import rand::{Rng, SeedableRng} and drive ChaCha8Rng directly. Bumping only rand to 0.10 is not source-compatible here: the 0.10 traits no longer match rand_chacha 0.9, so these simulator/test targets stop compiling until the RNG versions and imports move in lockstep.
| thiserror.workspace = true | ||
| rand = { version = "0.9", optional = true } | ||
| rand = { version = "0.10", optional = true } | ||
| rand_chacha = { version = "0.9", optional = true } |
There was a problem hiding this comment.
CRITICAL: The simulator still depends on the pre-0.10 RNG API
crates/gossip-persistence-inmemory/src/sim/mod.rs and crates/gossip-persistence-inmemory/tests/differential_oracle.rs still use the 0.9 rand API with rand_chacha::ChaCha8Rng. Updating only rand to 0.10 leaves those call sites on incompatible traits, so the test-support code stops compiling until the RNG stack is upgraded together.
Code Review SummaryStatus: 4 Issues Found | Recommendation: Address before merge Overview
Fix these issues in Kilo Cloud Issue Details (click to expand)CRITICAL
Files Reviewed (6 files)
Previous Review Summary (commit 6741630)Current summary above is authoritative. Previous snapshots are kept for context only. Previous review (commit 6741630)Status: 4 Issues Found | Recommendation: Address before merge Overview
Fix these issues in Kilo Cloud Issue Details (click to expand)CRITICAL
Other Observations (not in diff)Issues found in unchanged code that cannot receive inline comments:
Files Reviewed (6 files)
Reviewed by gpt-5.5-2026-04-23 · Input: 119.8K · Output: 20.6K · Cached: 645.1K |
017ace7 to
384d8fc
Compare
384d8fc to
7a51854
Compare
7a51854 to
045363b
Compare
045363b to
6741630
Compare
6741630 to
ee456d3
Compare
ee456d3 to
eebecda
Compare
eebecda to
bbd8c7e
Compare
bbd8c7e to
6633230
Compare
This PR contains the following updates:
0.8→0.100.9→0.100.9→0.10Release Notes
rust-random/rand (rand)
v0.10.2Compare Source
Fixes
UniformCharfrom bad source (#1790)Changes
partial_shuffleand apply#[must_use](#1769)unsafein contexts where non-local memory corruption could invalidate contract (#1791)v0.10.1Compare Source
This release includes a fix for a soundness bug; see #1763.
Changes
make_rngand add#[track_caller](#1761)log(#1763)v0.10.0Compare Source
Changes
rand_chachahas been replaced with a dependency onchacha20. This changes the implementation behindStdRng, but the output remains the same. There may be some API breakage when using the ChaCha-types directly as these are now the ones inchacha20instead ofrand_chacha(#1642).IndexedRandom::choose_multiple->sample,choose_multiple_array->sample_array,choose_multiple_weighted->sample_weighted, structSliceChooseIter->IndexedSamplesand fnsIteratorRandom::choose_multiple->sample,choose_multiple_fill->sample_fill(#1632)Fillbe implemented for element types, not sliceable types (#1652)OsError::raw_os_erroron UEFI targets by returningOption<usize>(#1665)TryRngCore::read_adapter(..) -> RngReadAdapterwith simpler structRngReader(#1669)SeedableRng::from_os_rng,try_from_os_rng(#1674)Clonesupport forStdRng,ReseedingRng(#1677)postcardinstead ofbincodeto test the serde feature (#1693)IteratorRandom::samplewhenamountis much larger than iterator size (#1695)os_rng->sys_rng,OsRng->SysRng,OsError->SysError(#1697)Rng->RngExtas upstreamrand_corehas renamedRngCore->Rng(#1717)Additions
IndexedRandom::choose_iter,choose_weighted_iter(#1632)Xoshiro128PlusPlus,Xoshiro256PlusPlusprngs (#1649)ChaCha8Rng,ChaCha12Rng,ChaCha20Rngbehindchachafeature (#1659)rand::make_rng() -> R where R: SeedableRng(#1734)Removals
ReseedingRng(#1722)small_rng(#1732)v0.9.5Compare Source
What's Changed
Full Changelog: rust-random/rand@0.9.4...0.9.5
v0.9.4Compare Source
Fixes
Full Changelog: rust-random/rand@0.9.3...0.9.4
v0.9.3Compare Source
v0.9.2Compare Source
Deprecated
rand::rngs::mockmodule andStepRnggenerator (#1634)Additions
WeightedIndex<usize>(de)serialization (#1646)v0.9.1Compare Source
Security and unsafe
zerocopydependency fromrand(#1579)Fixes
simd_supportfor recent nightly rust (#1586)Changes
fn rand::seq::index::sample_weightedandfn IndexedRandom::choose_multiple_weightedto return fewer thanamountresults (#1623), reverting an undocumented change (#1382) to the previous release.Additions
rand::distr::Alphabeticdistribution. (#1587)rand_core(#1604)v0.9.0Compare Source
Security and unsafe
ReseedingRngandThreadRng. Instead, it is recommended to callThreadRng::reseedon fork. (#1379)zerocopyto replace someunsafecode (#1349, #1393, #1446, #1502)Dependencies
--ignore-rust-versionrand_corev0.9.0 (#1558)Features
stdfeature withoutgetrandomorrand_chacha(#1354)small_rngby default (#1455)rand_chacha; usestd_rnginstead. (#1473)serde1toserde(#1477)getrandomtoos_rng(#1537)thread_rng(#1547)API changes: rand_core traits
RngCore::read_adapterimplementingstd::io::Read(#1267)CryptoBlockRng: BlockRngCore; maketrait CryptoRng: RngCore(#1273)TryRngCore,TryCryptoRng(#1424, #1499)fn SeedableRng::from_rng->try_from_rngand add infallible variantfn from_rng(#1424)fn SeedableRng::from_entropy->from_os_rngand add fallible variantfn try_from_os_rng(#1424)CloneandAsRefto associated typeSeedableRng::Seed(#1491)API changes: Rng trait and top-level fns
rand::thread_rng()torand::rng()and remove from the prelude (#1506)rand::random()from the prelude (#1506)random_iter,random_range,random_bool,random_ratio,fill(#1488)Rng::gen_iterasrandom_iter(#1305, #1500)Rng::gentorandomto avoid conflict with the newgenkeyword in Rust 2024 (#1438)Rng::gen_rangetorandom_range,gen_booltorandom_bool,gen_ratiotorandom_ratio(#1505)#[track_caller](#1442, #1447)API changes: RNGs
<SmallRng as SeedableRng>::Seedsize to 256 bits (#1455)rng) ofReseedingRng::new(#1533)API changes: Sequences
SliceRandomintoIndexedRandom,IndexedMutRandom,SliceRandom(#1382)IndexedRandom::choose_multiple_array,index::sample_array(#1453, #1469)API changes: Distributions: renames
rand::distributionstorand::distr(#1470)StandardtoStandardUniform(#1526)distr::Slice->distr::slice::Choose,distr::EmptySlice->distr::slice::Empty(#1548)distr::DistString->distr::SampleString(#1548)distr::DistIter->distr::Iter,distr::DistMap->distr::Map(#1548)API changes: Distributions
Sizedbound onDistribution<T> for &D(#1278)Distribution<Option<T>>forStandardUniform(#1526)StandardUniformsupport allNonZero*types (#1332){Uniform, UniformSampler}::{new, new_inclusive}return aResult(instead of potentially panicking) (#1229)UniformimplementsTryFrominstead ofFromfor ranges (#1229)UniformUsize(#1487)isizeandusizevalues withStandardUniform,Uniform(except viaUniformUsize) andFilland usage as aWeightedAliasIndexweight (#1487)DistStringfor distributionsSlice<char>andUniform<char>(#1315)Slice::num_choices(#1402)p()for distributionBernoullito access probability (#1481)API changes: Weighted distributions
pubmodulerand::distr::weighted, movingWeightedIndexthere (#1548)weighted::Weight, allowingWeightedIndexto trap overflow (#1353)weight, weights, total_weightto distributionWeightedIndex(#1420)WeightedErrortoweighted::Error, revising variants (#1382) and mark as#[non_exhaustive](#1480)API changes: SIMD
std::simd, expand SIMD & docs (#1239)Reproducibility-breaking changes
ReseedingRng::reseeddiscard remaining data from the last block generated (#1379)SmallRng::seed_from_u64implementation (#1203)UniformFloat::newsamples andUniformFloat::sample_singleto yieldhigh(#1462)Slice(#1469)Uniformforusizeportable viaUniformUsize(#1487)IndexdRandom::choose_multiple_weightedfor very small seeds and optimize for large input length / low memory (#1530)Reproducibility-breaking optimisations
sample_floyd, affecting output ofrand::seq::index::sampleandrand::seq::SliceRandom::choose_multiple(#1277)IteratorRandom::chooseandchoose_stable(#1268)SliceRandom::shuffleandpartial_shuffle(#1272)Uniform: use Canon's method (single sampling) / Lemire's method (distribution sampling) for faster sampling (breaks value stability; #1287)sample_single_inclusivefor floats (+~20% perf) (#1289)Other optimisations
SmallRnginitialization performance (#1482)Other
Cargo.lock.msrvfile (#1275)rustfmtand enforce (#1448)benchescrate (#1329, #1439) and migrate to Criterion (#1490)Documentation
ThreadRngrelated docs (#1257)--generate-link-to-definitionfeature (#1327)doc_auto_cfg(#1411, #1450)v0.8.8Compare Source
What's Changed
Full Changelog: rust-random/rand@0.8.7...0.8.8
v0.8.7Compare Source
What's Changed
Full Changelog: rust-random/rand@0.8.6...0.8.7
v0.8.6Compare Source
What's Changed
This release back-ports a fix from v0.10. See also #1763.
Changes
log(#1772)simd_supportfeature.New Contributors
Full Changelog: rust-random/rand@0.8.5...0.8.6
Configuration
📅 Schedule: (UTC)
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about these updates again.
This PR was generated by Mend Renovate. View the repository job log.