Skip to content

Commit

Permalink
Update to Rust 1.73
Browse files Browse the repository at this point in the history
  • Loading branch information
carols10cents committed Feb 19, 2024
1 parent b8a8ef2 commit bbfe3a7
Show file tree
Hide file tree
Showing 31 changed files with 71 additions and 41 deletions.
4 changes: 2 additions & 2 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.72 -c rust-docs
rustup default 1.72
rustup toolchain install 1.73 -c rust-docs
rustup default 1.73
- name: Install mdbook
run: |
mkdir bin
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/d5c2e9c342b358556da91d61ed4133f6f50fc0c3/library/core/src/cmp.rs:775:8
--> /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library/core/src/cmp.rs:775:8

For more information about this error, try `rustc --explain E0308`.
error: could not compile `guessing_game` (bin "guessing_game") due to previous error
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ error[E0596]: cannot borrow `*some_string` as mutable, as it is behind a `&` ref
--> src/main.rs:8:5
|
8 | some_string.push_str(", world");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `some_string` is a `&` reference, so the data it refers to cannot be borrowed as mutable
| ^^^^^^^^^^^ `some_string` is a `&` reference, so the data it refers to cannot be borrowed as mutable
|
help: consider changing this to be a mutable reference
|
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/d5c2e9c342b358556da91d61ed4133f6f50fc0c3/library/core/src/option.rs:563:1
::: /rustc/d5c2e9c342b358556da91d61ed4133f6f50fc0c3/library/core/src/option.rs:567:5
--> /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library/core/src/option.rs:563:1
::: /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library/core/src/option.rs:567: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 @@ -2,5 +2,6 @@ $ cargo run
Compiling collections v0.1.0 (file:///projects/collections)
Finished dev [unoptimized + debuginfo] target(s) in 0.43s
Running `target/debug/collections`
thread 'main' panicked at 'byte index 1 is not a char boundary; it is inside 'З' (bytes 0..2) of `Здравствуйте`', src/main.rs:4:14
thread 'main' panicked at src/main.rs:4:19:
byte index 1 is not a char boundary; it is inside 'З' (bytes 0..2) of `Здравствуйте`
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
3 changes: 2 additions & 1 deletion listings/ch09-error-handling/listing-09-01/output.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@ $ cargo run
Compiling panic v0.1.0 (file:///projects/panic)
Finished dev [unoptimized + debuginfo] target(s) in 0.27s
Running `target/debug/panic`
thread 'main' panicked at 'index out of bounds: the len is 3 but the index is 99', src/main.rs:4:5
thread 'main' panicked at src/main.rs:4:6:
index out of bounds: the len is 3 but the index is 99
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
3 changes: 2 additions & 1 deletion listings/ch09-error-handling/listing-09-04/output.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@ $ cargo run
Compiling error-handling v0.1.0 (file:///projects/error-handling)
Finished dev [unoptimized + debuginfo] target(s) in 0.73s
Running `target/debug/error-handling`
thread 'main' panicked at 'Problem opening the file: Os { code: 2, kind: NotFound, message: "No such file or directory" }', src/main.rs:8:23
thread 'main' panicked at src/main.rs:8:23:
Problem opening the file: Os { code: 2, kind: NotFound, message: "No such file or directory" }
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
3 changes: 2 additions & 1 deletion listings/ch09-error-handling/no-listing-01-panic/output.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@ $ cargo run
Compiling panic v0.1.0 (file:///projects/panic)
Finished dev [unoptimized + debuginfo] target(s) in 0.25s
Running `target/debug/panic`
thread 'main' panicked at 'crash and burn', src/main.rs:2:5
thread 'main' panicked at src/main.rs:2:5:
crash and burn
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ error[E0597]: `string2` does not live long enough
5 | let string2 = String::from("xyz");
| ------- binding `string2` declared here
6 | result = longest(string1.as_str(), string2.as_str());
| ^^^^^^^^^^^^^^^^ borrowed value does not live long enough
| ^^^^^^^ borrowed value does not live long enough
7 | }
| - `string2` dropped here while still borrowed
8 | println!("The longest string is {}", result);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
$ cargo run
Compiling chapter10 v0.1.0 (file:///projects/chapter10)
error[E0515]: cannot return reference to local variable `result`
error[E0515]: cannot return value referencing local variable `result`
--> src/main.rs:11:5
|
11 | result.as_str()
| ^^^^^^^^^^^^^^^ returns a reference to data owned by the current function
| ------^^^^^^^^^
| |
| returns a value referencing data owned by the current function
| `result` is borrowed here

For more information about this error, try `rustc --explain E0515`.
error: could not compile `chapter10` (bin "chapter10") due to previous error
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ test tests::exploration ... ok
failures:

---- tests::another stdout ----
thread 'tests::another' panicked at 'Make this test fail', src/lib.rs:10:9
thread 'tests::another' panicked at src/lib.rs:10:9:
Make this test fail
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@ failures:

---- tests::this_test_will_fail stdout ----
I got the value 8
thread 'tests::this_test_will_fail' panicked at 'assertion failed: `(left == right)`
left: `5`,
right: `10`', src/lib.rs:19:9
thread 'tests::this_test_will_fail' panicked at src/lib.rs:19:9:
assertion `left == right` failed
left: 5
right: 10
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ test tests::smaller_cannot_hold_larger ... ok
failures:

---- tests::larger_can_hold_smaller stdout ----
thread 'tests::larger_can_hold_smaller' panicked at 'assertion failed: larger.can_hold(&smaller)', src/lib.rs:28:9
thread 'tests::larger_can_hold_smaller' panicked at src/lib.rs:28:9:
assertion failed: larger.can_hold(&smaller)
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ test tests::it_adds_two ... FAILED
failures:

---- tests::it_adds_two stdout ----
thread 'tests::it_adds_two' panicked at 'assertion failed: `(left == right)`
left: `4`,
right: `5`', src/lib.rs:11:9
thread 'tests::it_adds_two' panicked at src/lib.rs:11:9:
assertion `left == right` failed
left: 4
right: 5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ test tests::greeting_contains_name ... FAILED
failures:

---- tests::greeting_contains_name stdout ----
thread 'tests::greeting_contains_name' panicked at 'assertion failed: result.contains(\"Carol\")', src/lib.rs:12:9
thread 'tests::greeting_contains_name' panicked at src/lib.rs:12:9:
assertion failed: result.contains(\"Carol\")
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ test tests::greeting_contains_name ... FAILED
failures:

---- tests::greeting_contains_name stdout ----
thread 'tests::greeting_contains_name' panicked at 'Greeting did not contain name, value was `Hello!`', src/lib.rs:12:9
thread 'tests::greeting_contains_name' panicked at src/lib.rs:12:9:
Greeting did not contain name, value was `Hello!`
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ test tests::greater_than_100 - should panic ... FAILED
failures:

---- tests::greater_than_100 stdout ----
thread 'tests::greater_than_100' panicked at 'Guess value must be greater than or equal to 1, got 200.', src/lib.rs:13:13
thread 'tests::greater_than_100' panicked at src/lib.rs:13:13:
Guess value must be greater than or equal to 1, got 200.
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
note: panic did not contain expected string
panic message: `"Guess value must be greater than or equal to 1, got 200."`,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@ failures:

---- tests::this_test_will_fail stdout ----
I got the value 8
thread 'tests::this_test_will_fail' panicked at 'assertion failed: `(left == right)`
left: `5`,
right: `10`', src/lib.rs:19:9
thread 'tests::this_test_will_fail' panicked at src/lib.rs:19:9:
assertion `left == right` failed
left: 5
right: 10
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace


Expand Down
3 changes: 2 additions & 1 deletion listings/ch12-an-io-project/listing-12-07/output.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@ $ cargo run
Compiling minigrep v0.1.0 (file:///projects/minigrep)
Finished dev [unoptimized + debuginfo] target(s) in 0.0s
Running `target/debug/minigrep`
thread 'main' panicked at 'index out of bounds: the len is 1 but the index is 1', src/main.rs:27:21
thread 'main' panicked at src/main.rs:27:21:
index out of bounds: the len is 1 but the index is 1
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
3 changes: 2 additions & 1 deletion listings/ch12-an-io-project/listing-12-08/output.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@ $ cargo run
Compiling minigrep v0.1.0 (file:///projects/minigrep)
Finished dev [unoptimized + debuginfo] target(s) in 0.0s
Running `target/debug/minigrep`
thread 'main' panicked at 'not enough arguments', src/main.rs:26:13
thread 'main' panicked at src/main.rs:26:13:
not enough arguments
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
7 changes: 4 additions & 3 deletions listings/ch12-an-io-project/listing-12-16/output.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ test tests::one_result ... FAILED
failures:

---- tests::one_result stdout ----
thread 'tests::one_result' panicked at 'assertion failed: `(left == right)`
left: `["safe, fast, productive."]`,
right: `[]`', src/lib.rs:44:9
thread 'tests::one_result' panicked at src/lib.rs:44:9:
assertion `left == right` failed
left: ["safe, fast, productive."]
right: []
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace


Expand Down
3 changes: 1 addition & 2 deletions listings/ch15-smart-pointers/listing-15-21/output.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ error[E0596]: cannot borrow `self.sent_messages` as mutable, as it is behind a `
--> src/lib.rs:58:13
|
58 | self.sent_messages.push(String::from(message));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `self` is a `&` reference, so the data it refers to cannot be borrowed as mutable
| ^^^^^^^^^^^^^^^^^^ `self` is a `&` reference, so the data it refers to cannot be borrowed as mutable
|
help: consider changing this to be a mutable reference
|
Expand All @@ -13,4 +13,3 @@ help: consider changing this to be a mutable reference

For more information about this error, try `rustc --explain E0596`.
error: could not compile `limit-tracker` (lib test) due to previous error
warning: build failed, waiting for other jobs to finish...
3 changes: 2 additions & 1 deletion listings/ch15-smart-pointers/listing-15-23/output.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ test tests::it_sends_an_over_75_percent_warning_message ... FAILED
failures:

---- tests::it_sends_an_over_75_percent_warning_message stdout ----
thread 'tests::it_sends_an_over_75_percent_warning_message' panicked at 'already borrowed: BorrowMutError', src/lib.rs:60:53
thread 'tests::it_sends_an_over_75_percent_warning_message' panicked at src/lib.rs:60:53:
already borrowed: BorrowMutError
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace


Expand Down
4 changes: 4 additions & 0 deletions listings/ch16-fearless-concurrency/listing-16-09/output.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ error[E0382]: borrow of moved value: `val`
| ^^^ value borrowed here after move
|
= 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 cloning the value if the performance cost is acceptable
|
9 | tx.send(val.clone()).unwrap();
| ++++++++

For more information about this error, try `rustc --explain E0382`.
error: could not compile `message-passing` (bin "message-passing") due to previous error
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ error[E0382]: borrow of moved value: `counter`
| ------- value moved into closure here, in previous iteration of loop
...
21 | println!("Result: {}", *counter.lock().unwrap());
| ^^^^^^^^^^^^^^ value borrowed here after move
| ^^^^^^^ value borrowed here after move

For more information about this error, try `rustc --explain E0382`.
error: could not compile `shared-state` (bin "shared-state") due to previous error
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ note: required because it's used within this closure
11 | let handle = thread::spawn(move || {
| ^^^^^^^
note: required by a bound in `spawn`
--> /rustc/d5c2e9c342b358556da91d61ed4133f6f50fc0c3/library/std/src/thread/mod.rs:680:1
--> /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library/std/src/thread/mod.rs:680:1

For more information about this error, try `rustc --explain E0277`.
error: could not compile `shared-state` (bin "shared-state") due to previous error
8 changes: 8 additions & 0 deletions listings/ch20-web-server/listing-20-17/output.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,16 @@ error[E0382]: use of moved value: `receiver`
21 | let (sender, receiver) = mpsc::channel();
| -------- move occurs because `receiver` has type `std::sync::mpsc::Receiver<Job>`, which does not implement the `Copy` trait
...
25 | for id in 0..size {
| ----------------- inside of this loop
26 | workers.push(Worker::new(id, receiver));
| ^^^^^^^^ value moved here, in previous iteration of loop
|
note: consider changing this parameter type in method `new` to borrow instead if owning the value isn't necessary
--> src/lib.rs:47:33
|
47 | fn new(id: usize, receiver: mpsc::Receiver<Job>) -> Worker {
| --- in this method ^^^^^^^^^^^^^^^^^^^ this parameter takes ownership of the value

For more information about this error, try `rustc --explain E0382`.
error: could not compile `hello` (lib) due to previous error
2 changes: 1 addition & 1 deletion listings/ch20-web-server/listing-20-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/d5c2e9c342b358556da91d61ed4133f6f50fc0c3/library/std/src/thread/mod.rs:1570:17
--> /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library/std/src/thread/mod.rs:1570:17

For more information about this error, try `rustc --explain E0507`.
error: could not compile `hello` (lib) due to previous error
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ error[E0599]: no method named `join` found for enum `Option` in the current scop
| ^^^^ method not found in `Option<JoinHandle<()>>`
|
note: the method `join` exists on the type `JoinHandle<()>`
--> /rustc/d5c2e9c342b358556da91d61ed4133f6f50fc0c3/library/std/src/thread/mod.rs:1570:5
--> /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library/std/src/thread/mod.rs:1570:5
help: consider using `Option::expect` to unwrap the `JoinHandle<()>` value, panicking if the value is an `Option::None`
|
52 | worker.thread.expect("REASON").join().unwrap();
Expand Down
2 changes: 1 addition & 1 deletion rust-toolchain
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.72
1.73
2 changes: 1 addition & 1 deletion src/title-page.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.72.1 (released 2023-09-19)
This version of the text assumes you’re using Rust 1.73.0 (released 2023-10-05)
or later. See the [“Installation” section of Chapter 1][install]<!-- ignore -->
to install or update Rust.

Expand Down

0 comments on commit bbfe3a7

Please sign in to comment.