From 8eec261d3e1a0ea161dcba5d5cccf73b7aead1a3 Mon Sep 17 00:00:00 2001 From: "Carol (Nichols || Goulding)" Date: Mon, 19 Feb 2024 13:16:05 -0500 Subject: [PATCH] Update to Rust 1.71 --- .github/workflows/main.yml | 4 ++-- .../listing-02-04/output.txt | 4 ++-- .../listing-04-06/output.txt | 2 +- .../no-listing-10-non-exhaustive-match/output.txt | 6 +++--- listings/ch15-smart-pointers/listing-15-21/output.txt | 2 +- .../ch16-fearless-concurrency/listing-16-14/output.txt | 7 +++++-- listings/ch17-oop/listing-17-10/output.txt | 2 +- .../no-listing-18-returns-closure/output.txt | 10 +++++++--- listings/ch20-web-server/listing-20-22/output.txt | 4 ++-- .../no-listing-04-update-worker-definition/output.txt | 4 ++-- rust-toolchain | 2 +- src/title-page.md | 2 +- 12 files changed, 28 insertions(+), 21 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 6088036de6..a1de8e319f 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -12,8 +12,8 @@ jobs: - name: Install Rust run: | rustup set profile minimal - rustup toolchain install 1.70 -c rust-docs - rustup default 1.70 + rustup toolchain install 1.71 -c rust-docs + rustup default 1.71 - name: Install mdbook run: | mkdir bin 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 97df06b875..a4a4a9ed02 100644 --- a/listings/ch02-guessing-game-tutorial/listing-02-04/output.txt +++ b/listings/ch02-guessing-game-tutorial/listing-02-04/output.txt @@ -18,9 +18,9 @@ error[E0308]: mismatched types = note: expected reference `&String` found reference `&{integer}` note: method defined here - --> /Users/carolnichols/.rustup/toolchains/1.70-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/cmp.rs:784:8 + --> /Users/carolnichols/.rustup/toolchains/1.71-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/cmp.rs:775:8 | -784 | fn cmp(&self, other: &Self) -> Ordering; +775 | fn cmp(&self, other: &Self) -> Ordering; | ^^^ For more information about this error, try `rustc --explain E0308`. diff --git a/listings/ch04-understanding-ownership/listing-04-06/output.txt b/listings/ch04-understanding-ownership/listing-04-06/output.txt index 8e6d09ed3d..729fd99fd7 100644 --- a/listings/ch04-understanding-ownership/listing-04-06/output.txt +++ b/listings/ch04-understanding-ownership/listing-04-06/output.txt @@ -9,7 +9,7 @@ error[E0596]: cannot borrow `*some_string` as mutable, as it is behind a `&` ref help: consider changing this to be a mutable reference | 7 | fn change(some_string: &mut String) { - | ~~~~~~~~~~~ + | +++ For more information about this error, try `rustc --explain E0596`. error: could not compile `ownership` (bin "ownership") due to previous error 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 79f73f7c80..21694b8df9 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,12 +7,12 @@ error[E0004]: non-exhaustive patterns: `None` not covered | ^ pattern `None` not covered | note: `Option` defined here - --> /Users/carolnichols/.rustup/toolchains/1.70-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/option.rs:568:5 + --> /Users/carolnichols/.rustup/toolchains/1.71-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/option.rs:567:5 | -564 | pub enum Option { +563 | pub enum Option { | ------------------ ... -568 | None, +567 | None, | ^^^^ not covered = note: the matched value is of type `Option` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown diff --git a/listings/ch15-smart-pointers/listing-15-21/output.txt b/listings/ch15-smart-pointers/listing-15-21/output.txt index 50ad108033..8e4390dde9 100644 --- a/listings/ch15-smart-pointers/listing-15-21/output.txt +++ b/listings/ch15-smart-pointers/listing-15-21/output.txt @@ -6,7 +6,7 @@ error[E0596]: cannot borrow `self.sent_messages` as mutable, as it is behind a ` 58 | self.sent_messages.push(String::from(message)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `self` is a `&` reference, so the data it refers to cannot be borrowed as mutable | -help: consider changing that to be a mutable reference +help: consider changing this to be a mutable reference | 2 | fn send(&mut self, msg: &str); | ~~~~~~~~~ diff --git a/listings/ch16-fearless-concurrency/listing-16-14/output.txt b/listings/ch16-fearless-concurrency/listing-16-14/output.txt index d8a356b6cf..930fa85feb 100644 --- a/listings/ch16-fearless-concurrency/listing-16-14/output.txt +++ b/listings/ch16-fearless-concurrency/listing-16-14/output.txt @@ -22,9 +22,12 @@ note: required because it's used within this closure 11 | let handle = thread::spawn(move || { | ^^^^^^^ note: required by a bound in `spawn` - --> /Users/carolnichols/.rustup/toolchains/1.70-aarch64-apple-darwin/lib/rustlib/src/rust/library/std/src/thread/mod.rs:680:8 + --> /Users/carolnichols/.rustup/toolchains/1.71-aarch64-apple-darwin/lib/rustlib/src/rust/library/std/src/thread/mod.rs:683:8 | -680 | F: Send + 'static, +680 | pub fn spawn(f: F) -> JoinHandle + | ----- required by a bound in this function +... +683 | F: Send + 'static, | ^^^^ required by this bound in `spawn` For more information about this error, try `rustc --explain E0277`. diff --git a/listings/ch17-oop/listing-17-10/output.txt b/listings/ch17-oop/listing-17-10/output.txt index 2192db7031..25ad7efcb0 100644 --- a/listings/ch17-oop/listing-17-10/output.txt +++ b/listings/ch17-oop/listing-17-10/output.txt @@ -7,7 +7,7 @@ error[E0277]: the trait bound `String: Draw` is not satisfied | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Draw` is not implemented for `String` | = help: the trait `Draw` is implemented for `Button` - = note: required for the cast from `String` to the object type `dyn Draw` + = note: required for the cast from `Box` to `Box` For more information about this error, try `rustc --explain E0277`. error: could not compile `gui` (bin "gui") due to previous error diff --git a/listings/ch19-advanced-features/no-listing-18-returns-closure/output.txt b/listings/ch19-advanced-features/no-listing-18-returns-closure/output.txt index 9776e5257f..61349a7d0a 100644 --- a/listings/ch19-advanced-features/no-listing-18-returns-closure/output.txt +++ b/listings/ch19-advanced-features/no-listing-18-returns-closure/output.txt @@ -6,11 +6,15 @@ error[E0746]: return type cannot have an unboxed trait object 1 | fn returns_closure() -> dyn Fn(i32) -> i32 { | ^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | - = note: for information on `impl Trait`, see -help: use `impl Fn(i32) -> i32` as the return type, as all return paths are of type `[closure@src/lib.rs:2:5: 2:8]`, which implements `Fn(i32) -> i32` +help: return an `impl Trait` instead of a `dyn Trait`, if all returned values are the same type | 1 | fn returns_closure() -> impl Fn(i32) -> i32 { - | ~~~~~~~~~~~~~~~~~~~ + | ~~~~ +help: box the return type, and wrap all of the returned values in `Box::new` + | +1 ~ fn returns_closure() -> Box i32> { +2 ~ Box::new(|x| x + 1) + | For more information about this error, try `rustc --explain E0746`. error: could not compile `functions-example` (lib) due to previous error diff --git a/listings/ch20-web-server/listing-20-22/output.txt b/listings/ch20-web-server/listing-20-22/output.txt index ae7af472ed..d7a9e5471b 100644 --- a/listings/ch20-web-server/listing-20-22/output.txt +++ b/listings/ch20-web-server/listing-20-22/output.txt @@ -9,9 +9,9 @@ error[E0507]: cannot move out of `worker.thread` which is behind a mutable refer | move occurs because `worker.thread` has type `JoinHandle<()>`, which does not implement the `Copy` trait | note: `JoinHandle::::join` takes ownership of the receiver `self`, which moves `worker.thread` - --> /Users/carolnichols/.rustup/toolchains/1.70-aarch64-apple-darwin/lib/rustlib/src/rust/library/std/src/thread/mod.rs:1557:17 + --> /Users/carolnichols/.rustup/toolchains/1.71-aarch64-apple-darwin/lib/rustlib/src/rust/library/std/src/thread/mod.rs:1560:17 | -1557 | pub fn join(self) -> Result { +1560 | pub fn join(self) -> Result { | ^^^^ For more information about this error, try `rustc --explain E0507`. diff --git a/listings/ch20-web-server/no-listing-04-update-worker-definition/output.txt b/listings/ch20-web-server/no-listing-04-update-worker-definition/output.txt index 84f4943aad..5cd0d99dd5 100644 --- a/listings/ch20-web-server/no-listing-04-update-worker-definition/output.txt +++ b/listings/ch20-web-server/no-listing-04-update-worker-definition/output.txt @@ -7,9 +7,9 @@ error[E0599]: no method named `join` found for enum `Option` in the current scop | ^^^^ method not found in `Option>` | note: the method `join` exists on the type `JoinHandle<()>` - --> /Users/carolnichols/.rustup/toolchains/1.70-aarch64-apple-darwin/lib/rustlib/src/rust/library/std/src/thread/mod.rs:1557:5 + --> /Users/carolnichols/.rustup/toolchains/1.71-aarch64-apple-darwin/lib/rustlib/src/rust/library/std/src/thread/mod.rs:1560:5 | -1557 | pub fn join(self) -> Result { +1560 | pub fn join(self) -> Result { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `Option::expect` to unwrap the `JoinHandle<()>` value, panicking if the value is an `Option::None` | diff --git a/rust-toolchain b/rust-toolchain index bfe79d0bdd..12816e6276 100644 --- a/rust-toolchain +++ b/rust-toolchain @@ -1 +1 @@ -1.70 +1.71 diff --git a/src/title-page.md b/src/title-page.md index 506054aa3b..de9ce7796b 100644 --- a/src/title-page.md +++ b/src/title-page.md @@ -2,7 +2,7 @@ *by Steve Klabnik and Carol Nichols, with contributions from the Rust Community* -This version of the text assumes you’re using Rust 1.70.0 (released 2023-06-01) +This version of the text assumes you’re using Rust 1.71.1 (released 2023-08-03) or later. See the [“Installation” section of Chapter 1][install] to install or update Rust.