diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 53b59cf58..8e91fd9e1 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.55 -c rust-docs - rustup default 1.55 + rustup toolchain install 1.56 -c rust-docs + rustup default 1.56 - name: Install mdbook run: | mkdir bin diff --git a/ADMIN_TASKS.md b/ADMIN_TASKS.md index 6cef05fdf..fc982380f 100644 --- a/ADMIN_TASKS.md +++ b/ADMIN_TASKS.md @@ -1,7 +1,7 @@ # Administrative Tasks -This documentation is for Carol and Steve and anyone else managing the repo to -remember how to do occasional maintenance tasks. +This documentation is for anyone managing the repo to remember how to do +occasional maintenance tasks. ## Update the `rustc` version diff --git a/listings/ch03-common-programming-concepts/no-listing-19-statements-vs-expressions/output.txt b/listings/ch03-common-programming-concepts/no-listing-19-statements-vs-expressions/output.txt index a3a52dbed..8ec68fd69 100644 --- a/listings/ch03-common-programming-concepts/no-listing-19-statements-vs-expressions/output.txt +++ b/listings/ch03-common-programming-concepts/no-listing-19-statements-vs-expressions/output.txt @@ -1,5 +1,13 @@ $ cargo run Compiling functions v0.1.0 (file:///projects/functions) +error: expected expression, found statement (`let`) + --> src/main.rs:2:14 + | +2 | let x = (let y = 6); + | ^^^^^^^^^ + | + = note: variable declaration using `let` is a statement + error[E0658]: `let` expressions in this position are experimental --> src/main.rs:2:14 | @@ -9,14 +17,6 @@ error[E0658]: `let` expressions in this position are experimental = note: see issue #53667 for more information = help: you can write `matches!(, )` instead of `let = ` -error: expected expression, found statement (`let`) - --> src/main.rs:2:14 - | -2 | let x = (let y = 6); - | ^^^^^^^^^ - | - = note: variable declaration using `let` is a statement - warning: unnecessary parentheses around assigned value --> src/main.rs:2:13 | diff --git a/listings/ch04-understanding-ownership/no-listing-14-dangling-reference/output.txt b/listings/ch04-understanding-ownership/no-listing-14-dangling-reference/output.txt index 35265dbc3..fddca683b 100644 --- a/listings/ch04-understanding-ownership/no-listing-14-dangling-reference/output.txt +++ b/listings/ch04-understanding-ownership/no-listing-14-dangling-reference/output.txt @@ -10,7 +10,7 @@ error[E0106]: missing lifetime specifier help: consider using the `'static` lifetime | 5 | fn dangle() -> &'static String { - | ^^^^^^^^ + | ~~~~~~~~ For more information about this error, try `rustc --explain E0106`. error: could not compile `ownership` due to previous error diff --git a/listings/ch05-using-structs-to-structure-related-data/no-listing-02-reference-in-struct/output.txt b/listings/ch05-using-structs-to-structure-related-data/no-listing-02-reference-in-struct/output.txt index 304c1df60..e28da599c 100644 --- a/listings/ch05-using-structs-to-structure-related-data/no-listing-02-reference-in-struct/output.txt +++ b/listings/ch05-using-structs-to-structure-related-data/no-listing-02-reference-in-struct/output.txt @@ -8,9 +8,9 @@ error[E0106]: missing lifetime specifier | help: consider introducing a named lifetime parameter | -1 | struct User<'a> { +1 ~ struct User<'a> { 2 | active: bool, -3 | username: &'a str, +3 ~ username: &'a str, | error[E0106]: missing lifetime specifier @@ -21,10 +21,10 @@ error[E0106]: missing lifetime specifier | help: consider introducing a named lifetime parameter | -1 | struct User<'a> { +1 ~ struct User<'a> { 2 | active: bool, 3 | username: &str, -4 | email: &'a str, +4 ~ email: &'a str, | For more information about this error, try `rustc --explain E0106`. diff --git a/listings/ch10-generic-types-traits-and-lifetimes/listing-10-05/output.txt b/listings/ch10-generic-types-traits-and-lifetimes/listing-10-05/output.txt index 0738325ac..0530f5424 100644 --- a/listings/ch10-generic-types-traits-and-lifetimes/listing-10-05/output.txt +++ b/listings/ch10-generic-types-traits-and-lifetimes/listing-10-05/output.txt @@ -11,7 +11,7 @@ error[E0369]: binary operation `>` cannot be applied to type `T` help: consider restricting type parameter `T` | 1 | fn largest(list: &[T]) -> T { - | ^^^^^^^^^^^^^^^^^^^^^^ + | ++++++++++++++++++++++ For more information about this error, try `rustc --explain E0369`. error: could not compile `chapter10` due to previous error diff --git a/listings/ch10-generic-types-traits-and-lifetimes/listing-10-12/Cargo.lock b/listings/ch10-generic-types-traits-and-lifetimes/listing-10-12/Cargo.lock index e8007a19b..2835471f0 100644 --- a/listings/ch10-generic-types-traits-and-lifetimes/listing-10-12/Cargo.lock +++ b/listings/ch10-generic-types-traits-and-lifetimes/listing-10-12/Cargo.lock @@ -1,6 +1,7 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. -[[package]] -name = "chapter10" -version = "0.1.0" +version = 3 +[[package]] +name = "aggregator" +version = "0.1.0" diff --git a/listings/ch10-generic-types-traits-and-lifetimes/listing-10-13/Cargo.lock b/listings/ch10-generic-types-traits-and-lifetimes/listing-10-13/Cargo.lock index e8007a19b..2835471f0 100644 --- a/listings/ch10-generic-types-traits-and-lifetimes/listing-10-13/Cargo.lock +++ b/listings/ch10-generic-types-traits-and-lifetimes/listing-10-13/Cargo.lock @@ -1,6 +1,7 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. -[[package]] -name = "chapter10" -version = "0.1.0" +version = 3 +[[package]] +name = "aggregator" +version = "0.1.0" diff --git a/listings/ch10-generic-types-traits-and-lifetimes/listing-10-14/Cargo.lock b/listings/ch10-generic-types-traits-and-lifetimes/listing-10-14/Cargo.lock index e8007a19b..2835471f0 100644 --- a/listings/ch10-generic-types-traits-and-lifetimes/listing-10-14/Cargo.lock +++ b/listings/ch10-generic-types-traits-and-lifetimes/listing-10-14/Cargo.lock @@ -1,6 +1,7 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. -[[package]] -name = "chapter10" -version = "0.1.0" +version = 3 +[[package]] +name = "aggregator" +version = "0.1.0" diff --git a/listings/ch10-generic-types-traits-and-lifetimes/listing-10-21/output.txt b/listings/ch10-generic-types-traits-and-lifetimes/listing-10-21/output.txt index a39351a6e..534a984a6 100644 --- a/listings/ch10-generic-types-traits-and-lifetimes/listing-10-21/output.txt +++ b/listings/ch10-generic-types-traits-and-lifetimes/listing-10-21/output.txt @@ -10,7 +10,7 @@ error[E0106]: missing lifetime specifier help: consider introducing a named lifetime parameter | 9 | fn longest<'a>(x: &'a str, y: &'a str) -> &'a str { - | ^^^^ ^^^^^^^ ^^^^^^^ ^^^ + | ++++ ++ ++ ++ For more information about this error, try `rustc --explain E0106`. error: could not compile `chapter10` due to previous error diff --git a/listings/ch10-generic-types-traits-and-lifetimes/no-listing-02-calling-default-impl/Cargo.lock b/listings/ch10-generic-types-traits-and-lifetimes/no-listing-02-calling-default-impl/Cargo.lock index e8007a19b..2835471f0 100644 --- a/listings/ch10-generic-types-traits-and-lifetimes/no-listing-02-calling-default-impl/Cargo.lock +++ b/listings/ch10-generic-types-traits-and-lifetimes/no-listing-02-calling-default-impl/Cargo.lock @@ -1,6 +1,7 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. -[[package]] -name = "chapter10" -version = "0.1.0" +version = 3 +[[package]] +name = "aggregator" +version = "0.1.0" diff --git a/listings/ch10-generic-types-traits-and-lifetimes/no-listing-03-default-impl-calls-other-methods/Cargo.lock b/listings/ch10-generic-types-traits-and-lifetimes/no-listing-03-default-impl-calls-other-methods/Cargo.lock index e8007a19b..2835471f0 100644 --- a/listings/ch10-generic-types-traits-and-lifetimes/no-listing-03-default-impl-calls-other-methods/Cargo.lock +++ b/listings/ch10-generic-types-traits-and-lifetimes/no-listing-03-default-impl-calls-other-methods/Cargo.lock @@ -1,6 +1,7 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. -[[package]] -name = "chapter10" -version = "0.1.0" +version = 3 +[[package]] +name = "aggregator" +version = "0.1.0" diff --git a/listings/ch10-generic-types-traits-and-lifetimes/no-listing-04-traits-as-parameters/Cargo.lock b/listings/ch10-generic-types-traits-and-lifetimes/no-listing-04-traits-as-parameters/Cargo.lock index e8007a19b..2835471f0 100644 --- a/listings/ch10-generic-types-traits-and-lifetimes/no-listing-04-traits-as-parameters/Cargo.lock +++ b/listings/ch10-generic-types-traits-and-lifetimes/no-listing-04-traits-as-parameters/Cargo.lock @@ -1,6 +1,7 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. -[[package]] -name = "chapter10" -version = "0.1.0" +version = 3 +[[package]] +name = "aggregator" +version = "0.1.0" diff --git a/listings/ch10-generic-types-traits-and-lifetimes/no-listing-05-returning-impl-trait/Cargo.lock b/listings/ch10-generic-types-traits-and-lifetimes/no-listing-05-returning-impl-trait/Cargo.lock index e8007a19b..2835471f0 100644 --- a/listings/ch10-generic-types-traits-and-lifetimes/no-listing-05-returning-impl-trait/Cargo.lock +++ b/listings/ch10-generic-types-traits-and-lifetimes/no-listing-05-returning-impl-trait/Cargo.lock @@ -1,6 +1,7 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. -[[package]] -name = "chapter10" -version = "0.1.0" +version = 3 +[[package]] +name = "aggregator" +version = "0.1.0" diff --git a/listings/ch10-generic-types-traits-and-lifetimes/no-listing-06-impl-trait-returns-one-type/Cargo.lock b/listings/ch10-generic-types-traits-and-lifetimes/no-listing-06-impl-trait-returns-one-type/Cargo.lock index e8007a19b..2835471f0 100644 --- a/listings/ch10-generic-types-traits-and-lifetimes/no-listing-06-impl-trait-returns-one-type/Cargo.lock +++ b/listings/ch10-generic-types-traits-and-lifetimes/no-listing-06-impl-trait-returns-one-type/Cargo.lock @@ -1,6 +1,7 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. -[[package]] -name = "chapter10" -version = "0.1.0" +version = 3 +[[package]] +name = "aggregator" +version = "0.1.0" diff --git a/listings/ch12-an-io-project/output-only-02-missing-lifetimes/output.txt b/listings/ch12-an-io-project/output-only-02-missing-lifetimes/output.txt index 33036173d..93116dd5e 100644 --- a/listings/ch12-an-io-project/output-only-02-missing-lifetimes/output.txt +++ b/listings/ch12-an-io-project/output-only-02-missing-lifetimes/output.txt @@ -10,7 +10,7 @@ error[E0106]: missing lifetime specifier help: consider introducing a named lifetime parameter | 28 | pub fn search<'a>(query: &'a str, contents: &'a str) -> Vec<&'a str> { - | ^^^^ ^^^^^^^ ^^^^^^^ ^^^ + | ++++ ++ ++ ++ For more information about this error, try `rustc --explain E0106`. error: could not compile `minigrep` due to previous error diff --git a/listings/ch13-functional-features/listing-13-08/output.txt b/listings/ch13-functional-features/listing-13-08/output.txt index 30c51e12a..37d83618a 100644 --- a/listings/ch13-functional-features/listing-13-08/output.txt +++ b/listings/ch13-functional-features/listing-13-08/output.txt @@ -4,10 +4,9 @@ error[E0308]: mismatched types --> src/main.rs:5:29 | 5 | let n = example_closure(5); - | ^ + | ^- help: try using a conversion method: `.to_string()` | | | expected struct `String`, found integer - | help: try using a conversion method: `5.to_string()` For more information about this error, try `rustc --explain E0308`. error: could not compile `closure-example` due to previous error diff --git a/listings/ch15-smart-pointers/listing-15-03/output.txt b/listings/ch15-smart-pointers/listing-15-03/output.txt index e4180993a..87e7b5766 100644 --- a/listings/ch15-smart-pointers/listing-15-03/output.txt +++ b/listings/ch15-smart-pointers/listing-15-03/output.txt @@ -11,7 +11,7 @@ error[E0072]: recursive type `List` has infinite size help: insert some indirection (e.g., a `Box`, `Rc`, or `&`) to make `List` representable | 2 | Cons(i32, Box), - | ^^^^ ^ + | ++++ + error[E0391]: cycle detected when computing drop-check constraints for `List` --> src/main.rs:1:1 @@ -19,7 +19,7 @@ error[E0391]: cycle detected when computing drop-check constraints for `List` 1 | enum List { | ^^^^^^^^^ | - = note: ...which again requires computing drop-check constraints for `List`, completing the cycle + = note: ...which immediately requires computing drop-check constraints for `List` again = note: cycle used when computing dropck types for `Canonical { max_universe: U0, variables: [], value: ParamEnvAnd { param_env: ParamEnv { caller_bounds: [], reveal: UserFacing }, value: List } }` Some errors have detailed explanations: E0072, E0391. diff --git a/listings/ch16-fearless-concurrency/listing-16-03/output.txt b/listings/ch16-fearless-concurrency/listing-16-03/output.txt index 23d3aaf27..321bf59d7 100644 --- a/listings/ch16-fearless-concurrency/listing-16-03/output.txt +++ b/listings/ch16-fearless-concurrency/listing-16-03/output.txt @@ -19,7 +19,7 @@ note: function requires argument type to outlive `'static` help: to force the closure to take ownership of `v` (and any other referenced variables), use the `move` keyword | 6 | let handle = thread::spawn(move || { - | ^^^^^^^ + | ++++ For more information about this error, try `rustc --explain E0373`. error: could not compile `threads` due to previous error diff --git a/listings/ch16-fearless-concurrency/listing-16-14/output.txt b/listings/ch16-fearless-concurrency/listing-16-14/output.txt index ffdd0674b..9546e1e48 100644 --- a/listings/ch16-fearless-concurrency/listing-16-14/output.txt +++ b/listings/ch16-fearless-concurrency/listing-16-14/output.txt @@ -15,6 +15,7 @@ error[E0277]: `Rc>` cannot be sent between threads safely | = help: within `[closure@src/main.rs:11:36: 15:10]`, the trait `Send` is not implemented for `Rc>` = note: required because it appears within the type `[closure@src/main.rs:11:36: 15:10]` +note: required by a bound in `spawn` For more information about this error, try `rustc --explain E0277`. error: could not compile `shared-state` due to previous error diff --git a/listings/ch18-patterns-and-matching/listing-18-10/output.txt b/listings/ch18-patterns-and-matching/listing-18-10/output.txt index b527311bb..702d10a23 100644 --- a/listings/ch18-patterns-and-matching/listing-18-10/output.txt +++ b/listings/ch18-patterns-and-matching/listing-18-10/output.txt @@ -1,12 +1,10 @@ $ cargo run Compiling patterns v0.1.0 (file:///projects/patterns) warning: irrefutable `if let` pattern - --> src/main.rs:2:5 + --> src/main.rs:2:8 | -2 | / if let x = 5 { -3 | | println!("{}", x); -4 | | }; - | |_____^ +2 | if let x = 5 { + | ^^^^^^^^^ | = note: `#[warn(irrefutable_let_patterns)]` on by default = note: this pattern will always match, so the `if let` is useless diff --git a/listings/ch19-advanced-features/no-listing-02-impl-outlineprint-for-point/output.txt b/listings/ch19-advanced-features/no-listing-02-impl-outlineprint-for-point/output.txt index 1264ce747..0991f10fa 100644 --- a/listings/ch19-advanced-features/no-listing-02-impl-outlineprint-for-point/output.txt +++ b/listings/ch19-advanced-features/no-listing-02-impl-outlineprint-for-point/output.txt @@ -3,14 +3,16 @@ $ cargo run error[E0277]: `Point` doesn't implement `std::fmt::Display` --> src/main.rs:20:6 | -3 | trait OutlinePrint: fmt::Display { - | ------------ required by this bound in `OutlinePrint` -... 20 | impl OutlinePrint for Point {} | ^^^^^^^^^^^^ `Point` cannot be formatted with the default formatter | = help: the trait `std::fmt::Display` is not implemented for `Point` = note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead +note: required by a bound in `OutlinePrint` + --> src/main.rs:3:21 + | +3 | trait OutlinePrint: fmt::Display { + | ^^^^^^^^^^^^ required by this bound in `OutlinePrint` For more information about this error, try `rustc --explain E0277`. error: could not compile `traits-example` 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 9811fcde0..d6fffc967 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 @@ -10,7 +10,7 @@ error[E0746]: return type cannot have an unboxed trait object help: use `impl Fn(i32) -> i32` as the return type, as all return paths are of type `[closure@src/lib.rs:2:5: 2:14]`, which implements `Fn(i32) -> i32` | 1 | fn returns_closure() -> impl Fn(i32) -> i32 { - | ^^^^^^^^^^^^^^^^^^^ + | ~~~~~~~~~~~~~~~~~~~ For more information about this error, try `rustc --explain E0746`. error: could not compile `functions-example` due to previous error diff --git a/rust-toolchain b/rust-toolchain index 67fc7ad0d..e01e6c121 100644 --- a/rust-toolchain +++ b/rust-toolchain @@ -1 +1 @@ -1.55 +1.56 diff --git a/src/title-page.md b/src/title-page.md index 29dfdc6dd..027218688 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.55 or later with +This version of the text assumes you’re using Rust 1.56 or later with `edition="2018"` in *Cargo.toml* of all projects to use Rust 2018 Edition idioms. See the [“Installation” section of Chapter 1][install] to install or update Rust, and see the new [Appendix E][editions]