Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to Rust 1.79.0 #3968

Merged
merged 1 commit into from
Jul 5, 2024
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.78 -c rust-docs
rustup default 1.78
rustup toolchain install 1.79 -c rust-docs
rustup default 1.79
- name: Install mdbook
run: |
mkdir bin
Expand All @@ -36,8 +36,8 @@ jobs:
- name: Install Rust
run: |
rustup set profile minimal
rustup toolchain install 1.76 -c rust-docs
rustup default 1.76
rustup toolchain install 1.79 -c rust-docs
rustup default 1.79
- 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/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/core/src/cmp.rs:836:8
--> /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/core/src/cmp.rs:840: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 @@ -8,10 +8,10 @@ error[E0277]: cannot add `Option<i8>` to `i8`
|
= help: the trait `Add<Option<i8>>` is not implemented for `i8`
= help: the following other types implement trait `Add<Rhs>`:
<i8 as Add>
<i8 as Add<&i8>>
<&'a i8 as Add<i8>>
<&i8 as Add<&i8>>
<i8 as Add<&i8>>
<i8 as Add>

For more information about this error, try `rustc --explain E0277`.
error: could not compile `enums` (bin "enums") due to 1 previous error
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/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/core/src/option.rs:572:1
::: /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/core/src/option.rs:576:5
--> /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/core/src/option.rs:571:1
::: /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/core/src/option.rs:575: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 @@ -12,23 +12,5 @@ help: consider introducing a named lifetime parameter
9 | fn longest<'a>(x: &'a str, y: &'a str) -> &'a str {
| ++++ ++ ++ ++

error: lifetime may not live long enough
--> src/main.rs:11:9
|
9 | fn longest(x: &str, y: &str) -> &str {
| - let's call the lifetime of this reference `'1`
10 | if x.len() > y.len() {
11 | x
| ^ returning this value requires that `'1` must outlive `'static`

error: lifetime may not live long enough
--> src/main.rs:13:9
|
9 | fn longest(x: &str, y: &str) -> &str {
| - let's call the lifetime of this reference `'2`
...
13 | y
| ^ returning this value requires that `'2` must outlive `'static`

For more information about this error, try `rustc --explain E0106`.
error: could not compile `chapter10` (bin "chapter10") due to 3 previous errors
error: could not compile `chapter10` (bin "chapter10") due to 1 previous error
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ mod tests {
let result = add(2, 2);
assert_eq!(result, 4);
}

#[test]
fn another() {
panic!("Make this test fail");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ test tests::it_adds_two ... FAILED
failures:

---- tests::it_adds_two stdout ----
thread 'tests::it_adds_two' panicked at src/lib.rs:11:9:
assertion `left == right` failed
left: 5
right: 4
Expand Down
2 changes: 2 additions & 0 deletions listings/ch13-functional-features/listing-13-04/output.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
$ cargo run
Locking 1 package to latest compatible version
Adding closure-example v0.1.0 (/Users/carolnichols/rust/book/tmp/listings/ch13-functional-features/listing-13-04)
Compiling closure-example v0.1.0 (file:///projects/closure-example)
Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.43s
Running `target/debug/closure-example`
Expand Down
2 changes: 2 additions & 0 deletions listings/ch13-functional-features/listing-13-05/output.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
$ cargo run
Locking 1 package to latest compatible version
Adding closure-example v0.1.0 (/Users/carolnichols/rust/book/tmp/listings/ch13-functional-features/listing-13-05)
Compiling closure-example v0.1.0 (file:///projects/closure-example)
Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.43s
Running `target/debug/closure-example`
Expand Down
5 changes: 5 additions & 0 deletions listings/ch13-functional-features/listing-13-08/output.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ error[E0507]: cannot move out of `value`, a captured variable in an `FnMut` clos
| --- captured by this `FnMut` closure
18 | sort_operations.push(value);
| ^^^^^ move occurs because `value` has type `String`, which does not implement the `Copy` trait
|
help: consider cloning the value if the performance cost is acceptable
|
18 | sort_operations.push(value.clone());
| ++++++++

For more information about this error, try `rustc --explain E0507`.
error: could not compile `rectangles` (bin "rectangles") due to 1 previous error
10 changes: 7 additions & 3 deletions listings/ch15-smart-pointers/listing-15-21/output.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,14 @@ 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 this to be a mutable reference
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 | }
...
56 | impl Messenger for MockMessenger {
57 ~ fn send(&mut self, message: &str) {
|
2 | fn send(&mut self, msg: &str);
| ~~~~~~~~~

For more information about this error, try `rustc --explain E0596`.
error: could not compile `limit-tracker` (lib test) due to 1 previous error
4 changes: 0 additions & 4 deletions listings/ch16-fearless-concurrency/listing-16-09/output.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@ 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 1 previous error
10 changes: 10 additions & 0 deletions listings/ch16-fearless-concurrency/listing-16-13/output.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,21 @@ error[E0382]: borrow of moved value: `counter`
5 | let counter = Mutex::new(0);
| ------- move occurs because `counter` has type `Mutex<i32>`, which does not implement the `Copy` trait
...
8 | for _ in 0..10 {
| -------------- inside of this loop
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 {
10 | let handle = thread::spawn(move || {
11 ~ let mut num = value.unwrap();
|

For more information about this error, try `rustc --explain E0382`.
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 @@ -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/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/std/src/thread/mod.rs:677:1
--> /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/std/src/thread/mod.rs:691: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
2 changes: 2 additions & 0 deletions listings/ch19-advanced-features/listing-19-05/output.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ error[E0499]: cannot borrow `*values` as mutable more than once at a time
| | | second mutable borrow occurs here
| | first mutable borrow occurs here
| returning this value requires that `*values` is borrowed for `'1`
|
= help: use `.split_at_mut(position)` to obtain two mutable non-overlapping sub-slices

For more information about this error, try `rustc --explain E0499`.
error: could not compile `unsafe-example` (bin "unsafe-example") due to 1 previous error
6 changes: 6 additions & 0 deletions listings/ch20-web-server/listing-20-17/output.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@ note: consider changing this parameter type in method `new` to borrow instead if
|
47 | fn new(id: usize, receiver: mpsc::Receiver<Job>) -> Worker {
| --- in this method ^^^^^^^^^^^^^^^^^^^ this parameter takes ownership of the value
help: consider moving the expression out of the loop so it is only moved once
|
25 ~ let mut value = Worker::new(id, receiver);
26 ~ for id in 0..size {
27 ~ workers.push(value);
|

For more information about this error, try `rustc --explain E0382`.
error: could not compile `hello` (lib) due to 1 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/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/std/src/thread/mod.rs:1657:17
--> /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/std/src/thread/mod.rs:1718:17

For more information about this error, try `rustc --explain E0507`.
error: could not compile `hello` (lib) due to 1 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/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/std/src/thread/mod.rs:1657:5
--> /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/std/src/thread/mod.rs:1718: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.78
1.79
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.78.0 (released 2024-05-02)
This version of the text assumes you’re using Rust 1.79.0 (released 2024-06-13)
or later. See the [“Installation” section of Chapter 1][install]<!-- ignore -->
to install or update Rust.

Expand Down