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
@carols10cents carols10cents mentioned this pull request Jul 12, 2026
2 tasks
jhpratt added a commit to jhpratt/rust that referenced this pull request Jul 14, 2026
Update books

## rust-lang/book

3 commits in 05d114287b7d6f6c9253d5242540f00fbd6172ab..dd7ab4f4f4541adf4aa2a872cdac06c206b73288
2026-07-10 19:43:43 UTC to 2026-06-29 20:56:02 UTC

- Update to Rust 1.97 (rust-lang/book#4799)
- doc: upgrade rand dependency to v0.10.1 in book listings and text (rust-lang/book#4756)
- Explicitly state "compilation modes" (rust-lang/book#3517)

## rust-lang/edition-guide

1 commits in c3c0f0b3da26610138b7ba7663f60cd2c68cf184..53686db907c45268d1b323afd9a3545a37abbced
2026-07-10 17:05:04 UTC to 2026-07-10 17:05:04 UTC

- Fix typo of key name `resolver.incompatible-rust-versions` (rust-lang/edition-guide#385)

## rust-lang/reference

4 commits in 86635e30bf861a038dc197d7e16fd09e7e514e7a..afdc77bab886d4455c11247cdd32391bfab636ae
2026-07-09 16:48:44 UTC to 2026-07-06 14:48:32 UTC

- Fix the tagged-union pattern-matching recommendation (rust-lang/reference#2303)
- Structs with no fields or all-ZST fields are ZSTs (rust-lang/reference#2262)
- macros.md: fix case (rust-lang/reference#2307)
- Bump railroad-dependency (rust-lang/reference#2305)

## rust-lang/rust-by-example

1 commits in d3117f6c873acbbf331c1d510371d061dfcc975c..15308f3e951814ef3475d2b58f48276e6b17b9af
2026-07-06 10:14:39 UTC to 2026-07-06 10:14:39 UTC

- Update Chinese translations in `zh.po` (rust-lang/rust-by-example#2025)
jhpratt added a commit to jhpratt/rust that referenced this pull request Jul 14, 2026
Update books

## rust-lang/book

3 commits in 05d114287b7d6f6c9253d5242540f00fbd6172ab..dd7ab4f4f4541adf4aa2a872cdac06c206b73288
2026-07-10 19:43:43 UTC to 2026-06-29 20:56:02 UTC

- Update to Rust 1.97 (rust-lang/book#4799)
- doc: upgrade rand dependency to v0.10.1 in book listings and text (rust-lang/book#4756)
- Explicitly state "compilation modes" (rust-lang/book#3517)

## rust-lang/edition-guide

1 commits in c3c0f0b3da26610138b7ba7663f60cd2c68cf184..53686db907c45268d1b323afd9a3545a37abbced
2026-07-10 17:05:04 UTC to 2026-07-10 17:05:04 UTC

- Fix typo of key name `resolver.incompatible-rust-versions` (rust-lang/edition-guide#385)

## rust-lang/reference

4 commits in 86635e30bf861a038dc197d7e16fd09e7e514e7a..afdc77bab886d4455c11247cdd32391bfab636ae
2026-07-09 16:48:44 UTC to 2026-07-06 14:48:32 UTC

- Fix the tagged-union pattern-matching recommendation (rust-lang/reference#2303)
- Structs with no fields or all-ZST fields are ZSTs (rust-lang/reference#2262)
- macros.md: fix case (rust-lang/reference#2307)
- Bump railroad-dependency (rust-lang/reference#2305)

## rust-lang/rust-by-example

1 commits in d3117f6c873acbbf331c1d510371d061dfcc975c..15308f3e951814ef3475d2b58f48276e6b17b9af
2026-07-06 10:14:39 UTC to 2026-07-06 10:14:39 UTC

- Update Chinese translations in `zh.po` (rust-lang/rust-by-example#2025)
rust-timer added a commit to rust-lang/rust that referenced this pull request Jul 14, 2026
Rollup merge of #159241 - rustbot:docs-update, r=ehuss

Update books

## rust-lang/book

3 commits in 05d114287b7d6f6c9253d5242540f00fbd6172ab..dd7ab4f4f4541adf4aa2a872cdac06c206b73288
2026-07-10 19:43:43 UTC to 2026-06-29 20:56:02 UTC

- Update to Rust 1.97 (rust-lang/book#4799)
- doc: upgrade rand dependency to v0.10.1 in book listings and text (rust-lang/book#4756)
- Explicitly state "compilation modes" (rust-lang/book#3517)

## rust-lang/edition-guide

1 commits in c3c0f0b3da26610138b7ba7663f60cd2c68cf184..53686db907c45268d1b323afd9a3545a37abbced
2026-07-10 17:05:04 UTC to 2026-07-10 17:05:04 UTC

- Fix typo of key name `resolver.incompatible-rust-versions` (rust-lang/edition-guide#385)

## rust-lang/reference

4 commits in 86635e30bf861a038dc197d7e16fd09e7e514e7a..afdc77bab886d4455c11247cdd32391bfab636ae
2026-07-09 16:48:44 UTC to 2026-07-06 14:48:32 UTC

- Fix the tagged-union pattern-matching recommendation (rust-lang/reference#2303)
- Structs with no fields or all-ZST fields are ZSTs (rust-lang/reference#2262)
- macros.md: fix case (rust-lang/reference#2307)
- Bump railroad-dependency (rust-lang/reference#2305)

## rust-lang/rust-by-example

1 commits in d3117f6c873acbbf331c1d510371d061dfcc975c..15308f3e951814ef3475d2b58f48276e6b17b9af
2026-07-06 10:14:39 UTC to 2026-07-06 10:14:39 UTC

- Update Chinese translations in `zh.po` (rust-lang/rust-by-example#2025)
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