Skip to content

doc: upgrade rand dependency to v0.10.1 in book listings and text#4756

Merged
carols10cents merged 7 commits into
rust-lang:mainfrom
falloficaruss:upgrade-rand-v0.10.1
Jun 30, 2026
Merged

doc: upgrade rand dependency to v0.10.1 in book listings and text#4756
carols10cents merged 7 commits into
rust-lang:mainfrom
falloficaruss:upgrade-rand-v0.10.1

Conversation

@falloficaruss

Copy link
Copy Markdown
Contributor

Upgrades the 'rand' crate dependency from v0.8.5 to v0.10.1 across all chapter listings and updates the corresponding book narrative to reflect the new API structure.

Key Changes:

  • Manifests: Updated 14 Cargo.toml files in listings to point to rand 0.10.1.
  • Source Code: Migrated 11 main.rs and lib.rs source files under listings/ to:
    • Bring the new extension trait 'rand::RngExt' into scope instead of 'rand::Rng'.
    • Replace 'rand::thread_rng().gen_range(1..=100)' with 'rand::rng().random_range(1..=100)'.
  • Chapter 1: Updated the offline caching command in ch01-01-installation.md to refer to rand@0.10.1.
  • Chapter 2: Updated ch02-00-guessing-game-tutorial.md to explain RngExt, rand::rng, and random_range. Adjusted all SemVer examples, compiler outputs, and hypotheticals to use 0.10.1 / 0.10.2 / 0.11.0.
  • Chapter 7: Updated the module path and import system explanation in ch07-04-bringing-paths-into-scope-with-the-use-keyword.md to target the new traits/functions.
  • Chapter 14: Updated simulated cargo output in ch14-03-cargo-workspaces.md showing rand v0.10.1 being compiled.

Closes #4746

falloficaruss and others added 7 commits June 30, 2026 09:48
Upgrades the 'rand' crate dependency from v0.8.5 to v0.10.1 across
all chapter listings and updates the corresponding book narrative to
reflect the new API structure.

Key Changes:
- Manifests: Updated 14 Cargo.toml files in listings to point to rand 0.10.1.
- Source Code: Migrated 11 main.rs and lib.rs source files under listings/ to:
  - Bring the new extension trait 'rand::RngExt' into scope instead of 'rand::Rng'.
  - Replace 'rand::thread_rng().gen_range(1..=100)' with 'rand::rng().random_range(1..=100)'.
- Chapter 1: Updated the offline caching command in ch01-01-installation.md to refer to rand@0.10.1.
- Chapter 2: Updated ch02-00-guessing-game-tutorial.md to explain RngExt, rand::rng, and random_range. Adjusted all SemVer examples, compiler outputs, and hypotheticals to use 0.10.1 / 0.10.2 / 0.11.0.
- Chapter 7: Updated the module path and import system explanation in ch07-04-bringing-paths-into-scope-with-the-use-keyword.md to target the new traits/functions.
- Chapter 14: Updated simulated cargo output in ch14-03-cargo-workspaces.md showing rand v0.10.1 being compiled.
@carols10cents carols10cents force-pushed the upgrade-rand-v0.10.1 branch from 5eec545 to f5fdd64 Compare June 30, 2026 14:59
@carols10cents

Copy link
Copy Markdown
Member

Thank you!! I rebased your branch and added a few more changes. I decided to go with use rand::prelude::*; to match what rand's docs recommend, I found a few more places that needed to be updated, and I added a reminder in the place where I think people might be hitting errors if they've put something different in their Cargo.toml.

@carols10cents carols10cents merged commit 8cc0cb1 into rust-lang:main Jun 30, 2026
3 checks passed
@falloficaruss

Copy link
Copy Markdown
Contributor Author

Thanks for merging!

@falloficaruss falloficaruss deleted the upgrade-rand-v0.10.1 branch June 30, 2026 16:06
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.

Outdated rand crate example in The Rust Programming Language book

2 participants