Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ jobs:
- name: Install Rust
run: |
rustup set profile minimal
rustup toolchain install 1.89 -c rust-docs
rustup default 1.89
rustup toolchain install 1.90 -c rust-docs
rustup default 1.90
- name: Install mdbook
run: |
mkdir bin
Expand Down Expand Up @@ -47,8 +47,8 @@ jobs:
- name: Install Rust
run: |
rustup set profile minimal
rustup toolchain install 1.89 -c rust-docs
rustup default 1.89
rustup toolchain install 1.90 -c rust-docs
rustup default 1.90
- name: Run `tools` package tests
run: |
cargo test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ error[E0308]: mismatched types
= note: expected reference `&String`
found reference `&{integer}`
note: method defined here
--> /rustc/29483883eed69d5fb4db01964cdf2af4d86e9cb2/library/core/src/cmp.rs:976:8
--> /rustc/1159e78c4747b02ef996e55082b704c09b970588/library/core/src/cmp.rs:979:8

For more information about this error, try `rustc --explain E0308`.
error: could not compile `guessing_game` (bin "guessing_game") due to 1 previous error
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ error[E0277]: `Rectangle` doesn't implement `Debug`
= note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider annotating `Rectangle` with `#[derive(Debug)]`
|
1 + #[derive(Debug)]
2 | struct Rectangle {
1 + #[derive(Debug)]
2 | struct Rectangle {
|

For more information about this error, try `rustc --explain E0277`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ error[E0004]: non-exhaustive patterns: `None` not covered
| ^ pattern `None` not covered
|
note: `Option<i32>` defined here
--> /rustc/29483883eed69d5fb4db01964cdf2af4d86e9cb2/library/core/src/option.rs:591:1
::: /rustc/29483883eed69d5fb4db01964cdf2af4d86e9cb2/library/core/src/option.rs:595:5
--> /rustc/1159e78c4747b02ef996e55082b704c09b970588/library/core/src/option.rs:593:1
::: /rustc/1159e78c4747b02ef996e55082b704c09b970588/library/core/src/option.rs:597:5
|
= note: not covered
= note: the matched value is of type `Option<i32>`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ error[E0603]: module `hosting` is private
note: the module `hosting` is defined here
--> src/lib.rs:2:5
|
2 | mod hosting {
2 | mod hosting {
| ^^^^^^^^^^^

For more information about this error, try `rustc --explain E0603`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ error[E0603]: function `add_to_waitlist` is private
note: the function `add_to_waitlist` is defined here
--> src/lib.rs:3:9
|
3 | fn add_to_waitlist() {}
3 | fn add_to_waitlist() {}
| ^^^^^^^^^^^^^^^^^^^^

error[E0603]: function `add_to_waitlist` is private
Expand All @@ -21,7 +21,7 @@ error[E0603]: function `add_to_waitlist` is private
note: the function `add_to_waitlist` is defined here
--> src/lib.rs:3:9
|
3 | fn add_to_waitlist() {}
3 | fn add_to_waitlist() {}
| ^^^^^^^^^^^^^^^^^^^^

For more information about this error, try `rustc --explain E0603`.
Expand Down
9 changes: 6 additions & 3 deletions listings/ch13-functional-features/listing-13-03/output.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@ error[E0308]: mismatched types
--> src/main.rs:5:29
|
5 | let n = example_closure(5);
| --------------- ^- help: try using a conversion method: `.to_string()`
| | |
| | expected `String`, found integer
| --------------- ^ expected `String`, found integer
| |
| arguments to this function are incorrect
|
note: expected because the closure was earlier called with an argument of type `String`
Expand All @@ -21,6 +20,10 @@ note: closure parameter defined here
|
2 | let example_closure = |x| x;
| ^
help: try using a conversion method
|
5 | let n = example_closure(5.to_string());
| ++++++++++++

For more information about this error, try `rustc --explain E0308`.
error: could not compile `closure-example` (bin "closure-example") due to 1 previous error
6 changes: 4 additions & 2 deletions listings/ch13-functional-features/listing-13-08/output.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@ error[E0507]: cannot move out of `value`, a captured variable in an `FnMut` clos
--> src/main.rs:18:30
|
15 | let value = String::from("closure called");
| ----- captured outer variable
| ----- ------------------------------ move occurs because `value` has type `String`, which does not implement the `Copy` trait
| |
| captured outer variable
16 |
17 | list.sort_by_key(|r| {
| --- captured by this `FnMut` closure
18 | sort_operations.push(value);
| ^^^^^ move occurs because `value` has type `String`, which does not implement the `Copy` trait
| ^^^^^ `value` is moved here
|
help: consider cloning the value if the performance cost is acceptable
|
Expand Down
11 changes: 10 additions & 1 deletion listings/ch15-smart-pointers/listing-15-17/output.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,21 @@ $ cargo run
error[E0382]: use of moved value: `a`
--> src/main.rs:11:30
|
9 | let a = Cons(5, Box::new(Cons(10, Box::new(Nil))));
9 | let a = Cons(5, Box::new(Cons(10, Box::new(Nil))));
| - move occurs because `a` has type `List`, which does not implement the `Copy` trait
10 | let b = Cons(3, Box::new(a));
| - value moved here
11 | let c = Cons(4, Box::new(a));
| ^ value used here after move
|
note: if `List` implemented `Clone`, you could clone the value
--> src/main.rs:1:1
|
1 | enum List {
| ^^^^^^^^^ consider implementing `Clone` for this type
...
10 | let b = Cons(3, Box::new(a));
| - you could clone this value

For more information about this error, try `rustc --explain E0382`.
error: could not compile `cons-list` (bin "cons-list") due to 1 previous error
4 changes: 2 additions & 2 deletions listings/ch15-smart-pointers/listing-15-21/output.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ error[E0596]: cannot borrow `self.sent_messages` as mutable, as it is behind a `
|
help: consider changing this to be a mutable reference in the `impl` method and the `trait` definition
|
2 ~ fn send(&mut self, msg: &str);
3 | }
2 ~ fn send(&mut self, msg: &str);
3 | }
...
56 | impl Messenger for MockMessenger {
57 ~ fn send(&mut self, message: &str) {
Expand Down
4 changes: 2 additions & 2 deletions listings/ch16-fearless-concurrency/listing-16-09/output.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ $ cargo run
error[E0382]: borrow of moved value: `val`
--> src/main.rs:10:27
|
8 | let val = String::from("hi");
8 | let val = String::from("hi");
| --- move occurs because `val` has type `String`, which does not implement the `Copy` trait
9 | tx.send(val).unwrap();
9 | tx.send(val).unwrap();
| --- value moved here
10 | println!("val is {val}");
| ^^^ value borrowed here after move
Expand Down
12 changes: 6 additions & 6 deletions listings/ch16-fearless-concurrency/listing-16-13/output.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,21 @@ $ cargo run
error[E0382]: borrow of moved value: `counter`
--> src/main.rs:21:29
|
5 | let counter = Mutex::new(0);
| ------- move occurs because `counter` has type `Mutex<i32>`, which does not implement the `Copy` trait
5 | let counter = Mutex::new(0);
| ------- move occurs because `counter` has type `std::sync::Mutex<i32>`, which does not implement the `Copy` trait
...
8 | for _ in 0..10 {
8 | for _ in 0..10 {
| -------------- inside of this loop
9 | let handle = thread::spawn(move || {
9 | let handle = thread::spawn(move || {
| ------- value moved into closure here, in previous iteration of loop
...
21 | println!("Result: {}", *counter.lock().unwrap());
| ^^^^^^^ value borrowed here after move
|
help: consider moving the expression out of the loop so it is only moved once
|
8 ~ let mut value = counter.lock();
9 ~ for _ in 0..10 {
8 ~ let mut value = counter.lock();
9 ~ for _ in 0..10 {
10 | let handle = thread::spawn(move || {
11 ~ let mut num = value.unwrap();
|
Expand Down
8 changes: 4 additions & 4 deletions listings/ch16-fearless-concurrency/listing-16-14/output.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
$ cargo run
Compiling shared-state v0.1.0 (file:///projects/shared-state)
error[E0277]: `Rc<Mutex<i32>>` cannot be sent between threads safely
error[E0277]: `Rc<std::sync::Mutex<i32>>` cannot be sent between threads safely
--> src/main.rs:11:36
|
11 | let handle = thread::spawn(move || {
Expand All @@ -13,16 +13,16 @@ error[E0277]: `Rc<Mutex<i32>>` cannot be sent between threads safely
13 | |
14 | | *num += 1;
15 | | });
| |_________^ `Rc<Mutex<i32>>` cannot be sent between threads safely
| |_________^ `Rc<std::sync::Mutex<i32>>` cannot be sent between threads safely
|
= help: within `{closure@src/main.rs:11:36: 11:43}`, the trait `Send` is not implemented for `Rc<Mutex<i32>>`
= help: within `{closure@src/main.rs:11:36: 11:43}`, the trait `Send` is not implemented for `Rc<std::sync::Mutex<i32>>`
note: required because it's used within this closure
--> src/main.rs:11:36
|
11 | let handle = thread::spawn(move || {
| ^^^^^^^
note: required by a bound in `spawn`
--> /rustc/29483883eed69d5fb4db01964cdf2af4d86e9cb2/library/std/src/thread/mod.rs:723:1
--> /rustc/1159e78c4747b02ef996e55082b704c09b970588/library/std/src/thread/mod.rs:723:1

For more information about this error, try `rustc --explain E0277`.
error: could not compile `shared-state` (bin "shared-state") due to 1 previous error
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,23 @@ $ cargo run
error[E0382]: use of moved value: `v`
--> src/main.rs:10:10
|
4 | let v = vec![1, 2, 3];
4 | let v = vec![1, 2, 3];
| - move occurs because `v` has type `Vec<i32>`, which does not implement the `Copy` trait
5 |
6 | let handle = thread::spawn(move || {
5 |
6 | let handle = thread::spawn(move || {
| ------- value moved into closure here
7 | println!("Here's a vector: {v:?}");
7 | println!("Here's a vector: {v:?}");
| - variable moved due to use in closure
...
10 | drop(v); // oh no!
| ^ value used here after move
|
help: consider cloning the value before moving it into the closure
|
6 ~ let value = v.clone();
7 ~ let handle = thread::spawn(move || {
8 ~ println!("Here's a vector: {value:?}");
|

For more information about this error, try `rustc --explain E0382`.
error: could not compile `threads` (bin "threads") due to 1 previous error
2 changes: 1 addition & 1 deletion listings/ch20-advanced-features/listing-20-21/output.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ $ cargo run
error[E0790]: cannot call associated function on trait without specifying the corresponding `impl` type
--> src/main.rs:20:43
|
2 | fn baby_name() -> String;
2 | fn baby_name() -> String;
| ------------------------- `Animal::baby_name` defined here
...
20 | println!("A baby dog is called a {}", Animal::baby_name());
Expand Down
4 changes: 2 additions & 2 deletions listings/ch20-advanced-features/listing-20-33/output.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ $ cargo build
error[E0308]: mismatched types
--> src/main.rs:2:44
|
2 | let handlers = vec![returns_closure(), returns_initialized_closure(123)];
2 | let handlers = vec![returns_closure(), returns_initialized_closure(123)];
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected opaque type, found a different opaque type
...
9 | fn returns_closure() -> impl Fn(i32) -> i32 {
9 | fn returns_closure() -> impl Fn(i32) -> i32 {
| ------------------- the expected opaque type
...
13 | fn returns_initialized_closure(init: i32) -> impl Fn(i32) -> i32 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ error[E0277]: `Point` doesn't implement `std::fmt::Display`
note: required by a bound in `OutlinePrint`
--> src/main.rs:3:21
|
3 | trait OutlinePrint: fmt::Display {
3 | trait OutlinePrint: fmt::Display {
| ^^^^^^^^^^^^ required by this bound in `OutlinePrint`

error[E0277]: `Point` doesn't implement `std::fmt::Display`
Expand All @@ -21,9 +21,9 @@ error[E0277]: `Point` doesn't implement `std::fmt::Display`
note: required by a bound in `OutlinePrint::outline_print`
--> src/main.rs:3:21
|
3 | trait OutlinePrint: fmt::Display {
3 | trait OutlinePrint: fmt::Display {
| ^^^^^^^^^^^^ required by this bound in `OutlinePrint::outline_print`
4 | fn outline_print(&self) {
4 | fn outline_print(&self) {
| ------------- required by a bound in this associated function

For more information about this error, try `rustc --explain E0277`.
Expand Down
2 changes: 1 addition & 1 deletion listings/ch21-web-server/listing-21-22/output.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ 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::<T>::join` takes ownership of the receiver `self`, which moves `worker.thread`
--> /rustc/29483883eed69d5fb4db01964cdf2af4d86e9cb2/library/std/src/thread/mod.rs:1896:17
--> /rustc/1159e78c4747b02ef996e55082b704c09b970588/library/std/src/thread/mod.rs:1921:17

For more information about this error, try `rustc --explain E0507`.
error: could not compile `hello` (lib) due to 1 previous error
2 changes: 1 addition & 1 deletion rust-toolchain
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.89
1.90
2 changes: 1 addition & 1 deletion src/title-page.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.89.0 (released 2025-08-07)
This version of the text assumes you’re using Rust 1.90.0 (released 2025-09-18)
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
Expand Down