From a4efcd52c4c1788192b2c245bfbbb2b61ecb1831 Mon Sep 17 00:00:00 2001 From: "Carol (Nichols || Goulding)" Date: Thu, 20 Jan 2022 10:18:08 -0500 Subject: [PATCH] Update to 1.58 --- .github/workflows/main.yml | 4 +-- .../listing-02-04/output.txt | 29 +++++++++++++++++-- .../output.txt | 2 ++ .../listing-09-10/output.txt | 19 ++++++------ .../listing-19-20/output.txt | 5 ---- .../output.txt | 9 +++--- rust-toolchain | 2 +- src/title-page.md | 2 +- 8 files changed, 47 insertions(+), 25 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 1acae0b6d..550471512 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.57 -c rust-docs - rustup default 1.57 + rustup toolchain install 1.58 -c rust-docs + rustup default 1.58 - 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 62fe8327f..61494725d 100644 --- a/listings/ch02-guessing-game-tutorial/listing-02-04/output.txt +++ b/listings/ch02-guessing-game-tutorial/listing-02-04/output.txt @@ -16,5 +16,30 @@ error[E0308]: mismatched types = note: expected reference `&String` found reference `&{integer}` -For more information about this error, try `rustc --explain E0308`. -error: could not compile `guessing_game` due to previous error +error[E0283]: type annotations needed for `{integer}` + --> src/main.rs:8:44 + | +8 | let secret_number = rand::thread_rng().gen_range(1..101); + | ------------- ^^^^^^^^^ cannot infer type for type `{integer}` + | | + | consider giving `secret_number` a type + | + = note: multiple `impl`s satisfying `{integer}: SampleUniform` found in the `rand` crate: + - impl SampleUniform for i128; + - impl SampleUniform for i16; + - impl SampleUniform for i32; + - impl SampleUniform for i64; + and 8 more +note: required by a bound in `gen_range` + --> /Users/carolnichols/.cargo/registry/src/github.com-1ecc6299db9ec823/rand-0.8.3/src/rng.rs:129:12 + | +129 | T: SampleUniform, + | ^^^^^^^^^^^^^ required by this bound in `gen_range` +help: consider specifying the type arguments in the function call + | +8 | let secret_number = rand::thread_rng().gen_range::(1..101); + | ++++++++ + +Some errors have detailed explanations: E0283, E0308. +For more information about an error, try `rustc --explain E0283`. +error: could not compile `guessing_game` due to 2 previous errors diff --git a/listings/ch03-common-programming-concepts/no-listing-05-mut-cant-change-types/output.txt b/listings/ch03-common-programming-concepts/no-listing-05-mut-cant-change-types/output.txt index 8701a07d3..31a07efc4 100644 --- a/listings/ch03-common-programming-concepts/no-listing-05-mut-cant-change-types/output.txt +++ b/listings/ch03-common-programming-concepts/no-listing-05-mut-cant-change-types/output.txt @@ -3,6 +3,8 @@ $ cargo run error[E0308]: mismatched types --> src/main.rs:3:14 | +2 | let mut spaces = " "; + | ----- expected due to this value 3 | spaces = spaces.len(); | ^^^^^^^^^^^^ expected `&str`, found `usize` diff --git a/listings/ch09-error-handling/listing-09-10/output.txt b/listings/ch09-error-handling/listing-09-10/output.txt index 4c36d2028..6a8b1a4c2 100644 --- a/listings/ch09-error-handling/listing-09-10/output.txt +++ b/listings/ch09-error-handling/listing-09-10/output.txt @@ -1,16 +1,15 @@ $ cargo run Compiling error-handling v0.1.0 (file:///projects/error-handling) error[E0277]: the `?` operator can only be used in a function that returns `Result` or `Option` (or another type that implements `FromResidual`) - --> src/main.rs:4:36 - | -3 | / fn main() { -4 | | let f = File::open("hello.txt")?; - | | ^ cannot use the `?` operator in a function that returns `()` -5 | | } - | |_- this function should return `Result` or `Option` to accept `?` - | - = help: the trait `FromResidual>` is not implemented for `()` -note: required by `from_residual` + --> src/main.rs:4:36 + | +3 | / fn main() { +4 | | let f = File::open("hello.txt")?; + | | ^ cannot use the `?` operator in a function that returns `()` +5 | | } + | |_- this function should return `Result` or `Option` to accept `?` + | + = help: the trait `FromResidual>` is not implemented for `()` For more information about this error, try `rustc --explain E0277`. error: could not compile `error-handling` due to previous error diff --git a/listings/ch19-advanced-features/listing-19-20/output.txt b/listings/ch19-advanced-features/listing-19-20/output.txt index 7e3f189f3..684508245 100644 --- a/listings/ch19-advanced-features/listing-19-20/output.txt +++ b/listings/ch19-advanced-features/listing-19-20/output.txt @@ -7,11 +7,6 @@ error[E0283]: type annotations needed | ^^^^^^^^^^^^^^^^^ cannot infer type | = note: cannot satisfy `_: Animal` -note: required by `Animal::baby_name` - --> src/main.rs:2:5 - | -2 | fn baby_name() -> String; - | ^^^^^^^^^^^^^^^^^^^^^^^^^ For more information about this error, try `rustc --explain E0283`. error: could not compile `traits-example` due to previous error 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 5d621db83..21c726ca9 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 @@ -10,13 +10,14 @@ error[E0308]: mismatched types --> src/lib.rs:72:22 | 72 | Worker { id, thread } - | ^^^^^^ - | | - | expected enum `Option`, found struct `JoinHandle` - | help: try using a variant of the expected enum: `Some(thread)` + | ^^^^^^ expected enum `Option`, found struct `JoinHandle` | = note: expected enum `Option>` found struct `JoinHandle<_>` +help: try wrapping the expression in `Some` + | +72 | Worker { id, Some(thread) } + | +++++ + Some errors have detailed explanations: E0308, E0599. For more information about an error, try `rustc --explain E0308`. diff --git a/rust-toolchain b/rust-toolchain index c88cb2a7b..d467d9182 100644 --- a/rust-toolchain +++ b/rust-toolchain @@ -1 +1 @@ -1.57 +1.58 diff --git a/src/title-page.md b/src/title-page.md index 86f19fbb1..a452c58e9 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.57 (released 2021-12-02) +This version of the text assumes you’re using Rust 1.58 (released 2022-01-13) or later. See the [“Installation” section of Chapter 1][install] to install or update Rust.