Skip to content

chore(deps): bump rand + rand_chacha to 0.10 (RngExt migration) - #52

Merged
Navi Bot (project-navi-bot) merged 2 commits into
mainfrom
fix/rand-0.10-migration
May 25, 2026
Merged

chore(deps): bump rand + rand_chacha to 0.10 (RngExt migration)#52
Navi Bot (project-navi-bot) merged 2 commits into
mainfrom
fix/rand-0.10-migration

Conversation

@Fieldnote-Echo

Copy link
Copy Markdown
Member

Remediates the two breaking Dependabot PRs #46 (rand 0.8→0.10) and #44 (rand_chacha 0.3→0.10), which were red because rand 0.10 is an API break. They are a version-locked pair, so neither resolves alone — this does both bumps + the migration in one PR.

Migration (mechanical, all dev-deps — test/bench corpora only)

  • gen_rangerandom_range (49 sites) and .gen().random() (2 sites).
  • rand 0.10 moved those methods off the Rng trait onto RngExtuse rand::{Rng, SeedableRng}use rand::{RngExt, SeedableRng} in all 10 files. (SeedableRng/ChaCha8Rng::seed_from_u64 unchanged.)

Verified locally (strict)

  • cargo fmt --check, clippy --all-targets --all-features -D warnings
  • cargo test (default and --features experimental) — all green
  • MSRV 1.89: rand 0.10.1 + rand_chacha 0.10.0 declare rust-version = 1.85; cargo +1.89.0 test --no-run compiles clean
  • Seeded ChaCha8Rng tests pass: they assert retrieval properties (self-retrieval at top-1, scalar↔SIMD parity), not specific RNG outputs, so 0.10s changed range-sampling doesnt perturb them.

Supersedes #44 + #46 — theyll auto-close when this merges (rand/rand_chacha reach their targets). Merges under strict protection (CI + 1 non-self code-owner approval).

Combined bump of the rand + rand_chacha dev-deps (test/bench corpora only) to 0.10 — a version-locked pair, so Dependabot's separate #46 (rand) and #44 (rand_chacha) can't resolve independently. This does both bumps + the API migration in one PR.

rand 0.9 renamed gen_range->random_range and gen()->random(); rand 0.10 then moved those off the Rng trait onto RngExt. Migrated all 51 call-sites (49 gen_range + 2 gen) and the 10 'use rand::{Rng, SeedableRng}' imports -> RngExt across src/ tests/ examples/.

Verified: fmt, clippy --all-targets --all-features -D warnings, cargo test (default + experimental), MSRV 1.89 compile (rand 0.10.1 + rand_chacha 0.10.0 declare rust-version 1.85). Seeded ChaCha8Rng tests pass — they assert retrieval properties (self-retrieval, scalar/SIMD parity), robust to 0.10's changed range sampling. Supersedes #44 + #46.
@qodo-code-review

Copy link
Copy Markdown

Review Summary by Qodo

Bump rand and rand_chacha to 0.10 with RngExt trait migration

✨ Enhancement

Grey Divider

Walkthroughs

Description
• Migrate rand crate from 0.8→0.10 and rand_chacha from 0.3→0.10
• Update all RNG method calls: gen_range()random_range() (49 sites)
• Update all RNG method calls: .gen().random() (2 sites)
• Replace use rand::Rng with use rand::RngExt across 10 files
Diagram
flowchart LR
  A["rand 0.8 + rand_chacha 0.3"] -->|"API break: methods moved to RngExt"| B["rand 0.10 + rand_chacha 0.10"]
  B -->|"Update imports: Rng → RngExt"| C["10 files updated"]
  B -->|"Rename methods: gen_range → random_range"| D["49 call sites"]
  B -->|"Rename methods: gen → random"| E["2 call sites"]
  C --> F["All tests pass + MSRV 1.89 verified"]
  D --> F
  E --> F

Loading

File Changes

1. Cargo.toml Dependencies +2/-2

Bump rand and rand_chacha dev-dependencies to 0.10

Cargo.toml


2. examples/bench_rank.rs ✨ Enhancement +5/-5

Migrate to RngExt and random_range method

examples/bench_rank.rs


3. src/sign_bitmap.rs ✨ Enhancement +8/-8

Update RNG imports and method calls in tests

src/sign_bitmap.rs


View more (8)
4. src/util.rs ✨ Enhancement +3/-3

Replace gen() with random() in popcount tests

src/util.rs


5. tests/index/bitmap.rs ✨ Enhancement +16/-16

Migrate RNG trait and method calls throughout

tests/index/bitmap.rs


6. tests/index/fastscan.rs ✨ Enhancement +7/-7

Update RNG imports and random_range calls

tests/index/fastscan.rs


7. tests/index/main.rs ✨ Enhancement +2/-2

Migrate RNG trait and update method calls

tests/index/main.rs


8. tests/index/multi_bucket.rs ✨ Enhancement +2/-2

Replace Rng with RngExt and update method

tests/index/multi_bucket.rs


9. tests/index/quant.rs ✨ Enhancement +7/-7

Migrate RNG trait and random_range calls

tests/index/quant.rs


10. tests/index/rank.rs ✨ Enhancement +5/-5

Update RNG imports and method calls

tests/index/rank.rs


11. tests/redteam_beta.rs ✨ Enhancement +6/-6

Migrate RNG trait and random_range calls

tests/redteam_beta.rs


Grey Divider

Qodo Logo

@qodo-code-review

qodo-code-review Bot commented May 25, 2026

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)

Grey Divider

Great, no issues found!

Qodo reviewed your code and found no material issues that require review

Grey Divider

Qodo Logo

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the rand and rand_chacha dependencies to version 0.10 and refactors the codebase to use the updated API, including random_range and random methods. However, the reviewer identified several critical security risks, specifically pointing out that the Cargo.lock file contains non-existent versions of crates like anyhow, getrandom, and serde_json, as well as a suspicious new dependency named zmij. Furthermore, the migration to the RngExt trait was flagged as incorrect for the official rand library, reinforcing concerns about a potential supply chain attack.

Comment thread Cargo.lock
Comment thread Cargo.lock
Comment thread Cargo.lock
Comment thread Cargo.lock
Comment thread examples/bench_rank.rs
Comment thread examples/bench_rank.rs
random_range is longer than the old gen_range, pushing several
.map(|_| rng.random_range(..)).collect() chains over the line width.
rustfmt wraps them across lines. No behaviour change; fixes the
cargo fmt --check gate (rustfmt under cargo 1.95.0).
@project-navi-bot
Navi Bot (project-navi-bot) merged commit e449c73 into main May 25, 2026
21 checks passed
@project-navi-bot
Navi Bot (project-navi-bot) deleted the fix/rand-0.10-migration branch May 25, 2026 16:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants