Update to Rust 1.97
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 9f85dcf..0a06e9c 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml
@@ -15,8 +15,8 @@ - name: Install Rust run: | rustup set profile minimal - rustup toolchain install 1.96 -c rust-docs - rustup default 1.96 + rustup toolchain install 1.97 -c rust-docs + rustup default 1.97 - name: Install mdbook run: | mkdir bin @@ -50,8 +50,8 @@ - name: Install Rust run: | rustup set profile minimal - rustup toolchain install 1.96 -c rust-docs - rustup default 1.96 + rustup toolchain install 1.97 -c rust-docs + rustup default 1.97 - name: Run `tools` package tests run: | cargo test
diff --git a/listings/ch02-guessing-game-tutorial/listing-02-04/output.txt b/listings/ch02-guessing-game-tutorial/listing-02-04/output.txt index 04fc540..a7676f0 100644 --- a/listings/ch02-guessing-game-tutorial/listing-02-04/output.txt +++ b/listings/ch02-guessing-game-tutorial/listing-02-04/output.txt
@@ -1,8 +1,8 @@ $ cargo build Compiling libc v0.2.186 Compiling rand_core v0.10.1 - Compiling cfg-if v1.0.0 Compiling getrandom v0.4.3 + Compiling cfg-if v1.0.0 Compiling chacha20 v0.10.1 Compiling rand v0.10.1 Compiling guessing_game v0.1.0 (file:///projects/guessing_game) @@ -17,7 +17,7 @@ = note: expected reference `&String` found reference `&{integer}` note: method defined here - --> /rustc/ac68faa20c58cbccd01ee7208bf3b6e93a7d7f96/library/core/src/cmp.rs:999:7 + --> /rustc/2d8144b7880597b6e6d3dfd63a9a9efae3f533d3/library/core/src/cmp.rs:1000:7 For more information about this error, try `rustc --explain E0308`. error: could not compile `guessing_game` (bin "guessing_game") due to 1 previous error
diff --git a/listings/ch06-enums-and-pattern-matching/no-listing-07-cant-use-option-directly/output.txt b/listings/ch06-enums-and-pattern-matching/no-listing-07-cant-use-option-directly/output.txt index 6d5e18b..3eda17f 100644 --- a/listings/ch06-enums-and-pattern-matching/no-listing-07-cant-use-option-directly/output.txt +++ b/listings/ch06-enums-and-pattern-matching/no-listing-07-cant-use-option-directly/output.txt
@@ -8,19 +8,19 @@ | = help: the trait `Add<Option<i8>>` is not implemented for `i8` help: the following other types implement trait `Add<Rhs>` - --> /rustc/ac68faa20c58cbccd01ee7208bf3b6e93a7d7f96/library/core/src/ops/arith.rs:98:8 + --> /rustc/2d8144b7880597b6e6d3dfd63a9a9efae3f533d3/library/core/src/ops/arith.rs:98:8 | = note: `i8` implements `Add` - ::: /rustc/ac68faa20c58cbccd01ee7208bf3b6e93a7d7f96/library/core/src/ops/arith.rs:113:0 + ::: /rustc/2d8144b7880597b6e6d3dfd63a9a9efae3f533d3/library/core/src/ops/arith.rs:113:0 | = note: in this macro invocation - --> /rustc/ac68faa20c58cbccd01ee7208bf3b6e93a7d7f96/library/core/src/internal_macros.rs:22:8 + --> /rustc/2d8144b7880597b6e6d3dfd63a9a9efae3f533d3/library/core/src/internal_macros.rs:22:8 | = note: `&i8` implements `Add<i8>` - ::: /rustc/ac68faa20c58cbccd01ee7208bf3b6e93a7d7f96/library/core/src/internal_macros.rs:33:8 + ::: /rustc/2d8144b7880597b6e6d3dfd63a9a9efae3f533d3/library/core/src/internal_macros.rs:33:8 | = note: `i8` implements `Add<&i8>` - ::: /rustc/ac68faa20c58cbccd01ee7208bf3b6e93a7d7f96/library/core/src/internal_macros.rs:44:8 + ::: /rustc/2d8144b7880597b6e6d3dfd63a9a9efae3f533d3/library/core/src/internal_macros.rs:44:8 | = note: `&i8` implements `Add` = note: this error originates in the macro `add_impl` (in Nightly builds, run with -Z macro-backtrace for more info)
diff --git a/listings/ch06-enums-and-pattern-matching/no-listing-10-non-exhaustive-match/output.txt b/listings/ch06-enums-and-pattern-matching/no-listing-10-non-exhaustive-match/output.txt index 7f7bb50..4f09241 100644 --- a/listings/ch06-enums-and-pattern-matching/no-listing-10-non-exhaustive-match/output.txt +++ b/listings/ch06-enums-and-pattern-matching/no-listing-10-non-exhaustive-match/output.txt
@@ -7,8 +7,8 @@ | ^ pattern `None` not covered | note: `Option<i32>` defined here - --> /rustc/ac68faa20c58cbccd01ee7208bf3b6e93a7d7f96/library/core/src/option.rs:600:0 - ::: /rustc/ac68faa20c58cbccd01ee7208bf3b6e93a7d7f96/library/core/src/option.rs:604:4 + --> /rustc/2d8144b7880597b6e6d3dfd63a9a9efae3f533d3/library/core/src/option.rs:597:0 + ::: /rustc/2d8144b7880597b6e6d3dfd63a9a9efae3f533d3/library/core/src/option.rs:601:4 | = note: not covered = note: the matched value is of type `Option<i32>`
diff --git a/listings/ch08-common-collections/listing-08-19/output.txt b/listings/ch08-common-collections/listing-08-19/output.txt index c48ed6f..a5161e5 100644 --- a/listings/ch08-common-collections/listing-08-19/output.txt +++ b/listings/ch08-common-collections/listing-08-19/output.txt
@@ -10,10 +10,10 @@ = note: you can use `.chars().nth()` or `.bytes().nth()` for more information, see chapter 8 in The Book: <https://doc.rust-lang.org/book/ch08-02-strings.html#indexing-into-strings> help: `usize` implements trait `SliceIndex<T>` - --> /rustc/ac68faa20c58cbccd01ee7208bf3b6e93a7d7f96/library/core/src/slice/index.rs:214:0 + --> /rustc/2d8144b7880597b6e6d3dfd63a9a9efae3f533d3/library/core/src/slice/index.rs:214:0 | = note: `SliceIndex<[T]>` - --> /rustc/ac68faa20c58cbccd01ee7208bf3b6e93a7d7f96/library/core/src/bstr/traits.rs:197:0 + --> /rustc/2d8144b7880597b6e6d3dfd63a9a9efae3f533d3/library/core/src/bstr/traits.rs:197:0 | = note: `SliceIndex<ByteStr>` = note: required for `String` to implement `Index<{integer}>`
diff --git a/listings/ch13-functional-features/listing-13-08/output.txt b/listings/ch13-functional-features/listing-13-08/output.txt index 0542a44..30d2a25 100644 --- a/listings/ch13-functional-features/listing-13-08/output.txt +++ b/listings/ch13-functional-features/listing-13-08/output.txt
@@ -14,7 +14,7 @@ | ^^^^^ `value` is moved here | help: `Fn` and `FnMut` closures require captured values to be able to be consumed multiple times, but `FnOnce` closures may consume them only once - --> /rustc/ac68faa20c58cbccd01ee7208bf3b6e93a7d7f96/library/alloc/src/slice.rs:249:11 + --> /rustc/2d8144b7880597b6e6d3dfd63a9a9efae3f533d3/library/alloc/src/slice.rs:249:11 help: consider cloning the value if the performance cost is acceptable | 18 | sort_operations.push(value.clone());
diff --git a/listings/ch16-fearless-concurrency/listing-16-14/output.txt b/listings/ch16-fearless-concurrency/listing-16-14/output.txt index 2b2a83a..66a17bd 100644 --- a/listings/ch16-fearless-concurrency/listing-16-14/output.txt +++ b/listings/ch16-fearless-concurrency/listing-16-14/output.txt
@@ -22,7 +22,7 @@ 11 | let handle = thread::spawn(move || { | ^^^^^^^ note: required by a bound in `spawn` - --> /rustc/ac68faa20c58cbccd01ee7208bf3b6e93a7d7f96/library/std/src/thread/functions.rs:125:0 + --> /rustc/2d8144b7880597b6e6d3dfd63a9a9efae3f533d3/library/std/src/thread/functions.rs:125:0 For more information about this error, try `rustc --explain E0277`. error: could not compile `shared-state` (bin "shared-state") due to 1 previous error
diff --git a/listings/ch19-patterns-and-matching/listing-19-10/output.txt b/listings/ch19-patterns-and-matching/listing-19-10/output.txt index c7cfe2d..4951803 100644 --- a/listings/ch19-patterns-and-matching/listing-19-10/output.txt +++ b/listings/ch19-patterns-and-matching/listing-19-10/output.txt
@@ -1,20 +1,14 @@ $ cargo run Compiling patterns v0.1.0 (file:///projects/patterns) -warning: irrefutable `let...else` pattern - --> src/main.rs:2:5 +warning: unreachable `else` clause + --> src/main.rs:2:15 | 2 | let x = 5 else { - | ^^^^^^^^^ + | --------- ^^^^ + | | + | assigning to binding pattern will always succeed | = note: this pattern always matches, so the else clause is unreachable -help: remove this `else` block - --> src/main.rs:2:20 - | -2 | let x = 5 else { - | ____________________^ -3 | | return; -4 | | }; - | |_____^ = note: `#[warn(irrefutable_let_patterns)]` on by default warning: `patterns` (bin "patterns") generated 1 warning
diff --git a/listings/ch21-web-server/listing-21-22/output.txt b/listings/ch21-web-server/listing-21-22/output.txt index 2cdc73e..08114aa 100644 --- a/listings/ch21-web-server/listing-21-22/output.txt +++ b/listings/ch21-web-server/listing-21-22/output.txt
@@ -9,7 +9,7 @@ | move occurs because `worker.thread` has type `JoinHandle<()>`, which does not implement the `Copy` trait | note: `JoinHandle::<T>::join` takes ownership of the receiver `self`, which moves `worker.thread` - --> /rustc/ac68faa20c58cbccd01ee7208bf3b6e93a7d7f96/library/std/src/thread/join_handle.rs:149:16 + --> /rustc/2d8144b7880597b6e6d3dfd63a9a9efae3f533d3/library/std/src/thread/join_handle.rs:149:16 For more information about this error, try `rustc --explain E0507`. error: could not compile `hello` (lib) due to 1 previous error
diff --git a/rust-toolchain b/rust-toolchain index 1e71443..038d8c2 100644 --- a/rust-toolchain +++ b/rust-toolchain
@@ -1 +1 @@ -1.96 +1.97
diff --git a/src/ch19-02-refutability.md b/src/ch19-02-refutability.md index 4117d3f..8c71a33 100644 --- a/src/ch19-02-refutability.md +++ b/src/ch19-02-refutability.md
@@ -76,7 +76,7 @@ </Listing> Rust complains that it doesn’t make sense to use `let...else` with an -irrefutable pattern: +irrefutable pattern because the `else` will never be reached: ```console {{#include ../listings/ch19-patterns-and-matching/listing-19-10/output.txt}}
diff --git a/src/title-page.md b/src/title-page.md index 98e4958..b979275 100644 --- a/src/title-page.md +++ b/src/title-page.md
@@ -3,7 +3,7 @@ _by Steve Klabnik, Carol Nichols, and Chris Krycho, with contributions from the Rust Community_ -This version of the text assumes you’re using Rust 1.96.0 (released 2026-05-28) +This version of the text assumes you’re using Rust 1.97.0 (released 2026-07-09) or later with `edition = "2024"` in the *Cargo.toml* file of all projects to configure them to use Rust 2024 Edition idioms. See the [“Installation” section of Chapter 1][install]<!-- ignore --> for instructions on installing or