Skip to content

Rust upgrades #3844

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

Merged
merged 10 commits into from
Feb 19, 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
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.67 -c rust-docs
rustup default 1.67
rustup toolchain install 1.76 -c rust-docs
rustup default 1.76
- name: Install mdbook
run: |
mkdir bin
Expand Down
1 change: 1 addition & 0 deletions ci/dictionary.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ backtraces
BACKTRACE
Backtraces
Baz's
beefeb
benchmarking
bioinformatics
bitand
Expand Down
16 changes: 8 additions & 8 deletions listings/ch02-guessing-game-tutorial/listing-02-02/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions listings/ch02-guessing-game-tutorial/listing-02-04/output.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ error[E0308]: mismatched types
--> src/main.rs:22:21
|
22 | match guess.cmp(&secret_number) {
| --- ^^^^^^^^^^^^^^ expected struct `String`, found integer
| --- ^^^^^^^^^^^^^^ expected `&String`, found `&{integer}`
| |
| arguments to this function are incorrect
| arguments to this method are incorrect
|
= note: expected reference `&String`
found reference `&{integer}`
note: associated function defined here
--> /rustc/d5a82bbd26e1ad8b7401f6a718a9c57c96905483/library/core/src/cmp.rs:783:8
note: method defined here
--> /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/core/src/cmp.rs:814:8

For more information about this error, try `rustc --explain E0308`.
error: could not compile `guessing_game` due to previous error
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,6 +8,10 @@ warning: unused `Result` that must be used
|
= note: this `Result` may be an `Err` variant, which should be handled
= note: `#[warn(unused_must_use)]` on by default
help: use `let _ = ...` to ignore the resulting value
|
10 | let _ = io::stdin().read_line(&mut guess);
| +++++++

warning: `guessing_game` (bin "guessing_game") generated 1 warning
Finished dev [unoptimized + debuginfo] target(s) in 0.59s
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ error[E0384]: cannot assign twice to immutable variable `x`
| ^^^^^ cannot assign twice to immutable variable

For more information about this error, try `rustc --explain E0384`.
error: could not compile `variables` due to previous error
error: could not compile `variables` (bin "variables") due to 1 previous error
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ error[E0308]: mismatched types
| ----- expected due to this value
3 | spaces = spaces.len();
| ^^^^^^^^^^^^ expected `&str`, found `usize`
|
help: try removing the method call
|
3 - spaces = spaces.len();
3 + spaces = spaces;
|

For more information about this error, try `rustc --explain E0308`.
error: could not compile `variables` due to previous error
error: could not compile `variables` (bin "variables") due to 1 previous error
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,8 @@ error: expected expression, found `let` statement
|
2 | let x = (let y = 6);
| ^^^

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 unstable
--> src/main.rs:2:14
|
2 | let x = (let y = 6);
| ^^^^^^^^^
|
= note: see issue #53667 <https://github.com/rust-lang/rust/issues/53667> for more information
= note: only supported directly in conditions of `if` and `while` expressions

warning: unnecessary parentheses around assigned value
--> src/main.rs:2:13
Expand All @@ -35,6 +21,5 @@ help: remove these parentheses
2 + let x = let y = 6;
|

For more information about this error, try `rustc --explain E0658`.
warning: `functions` (bin "functions") generated 1 warning
error: could not compile `functions` due to 3 previous errors; 1 warning emitted
error: could not compile `functions` (bin "functions") due to 1 previous error; 1 warning emitted
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ error[E0308]: mismatched types
| - help: remove this semicolon to return this value

For more information about this error, try `rustc --explain E0308`.
error: could not compile `functions` due to previous error
error: could not compile `functions` (bin "functions") due to 1 previous error
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ error[E0308]: mismatched types
| ^^^^^^ expected `bool`, found integer

For more information about this error, try `rustc --explain E0308`.
error: could not compile `branches` due to previous error
error: could not compile `branches` (bin "branches") due to 1 previous error
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ error[E0308]: `if` and `else` have incompatible types
| expected because of this

For more information about this error, try `rustc --explain E0308`.
error: could not compile `branches` due to previous error
error: could not compile `branches` (bin "branches") due to 1 previous error
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
$ cargo build
Compiling no_type_annotations v0.1.0 (file:///projects/no_type_annotations)
error[E0282]: type annotations needed
error[E0284]: type annotations needed
--> src/main.rs:2:9
|
2 | let guess = "42".parse().expect("Not a number!");
| ^^^^^
| ^^^^^ ----- type must be known at this point
|
= note: cannot satisfy `<_ as FromStr>::Err == _`
help: consider giving `guess` an explicit type
|
2 | let guess: _ = "42".parse().expect("Not a number!");
| +++
2 | let guess: /* Type */ = "42".parse().expect("Not a number!");
| ++++++++++++

For more information about this error, try `rustc --explain E0282`.
error: could not compile `no_type_annotations` due to previous error
For more information about this error, try `rustc --explain E0284`.
error: could not compile `no_type_annotations` (bin "no_type_annotations") due to 1 previous error
11 changes: 7 additions & 4 deletions listings/ch04-understanding-ownership/listing-04-06/output.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,13 @@ $ cargo run
error[E0596]: cannot borrow `*some_string` as mutable, as it is behind a `&` reference
--> src/main.rs:8:5
|
7 | fn change(some_string: &String) {
| ------- help: consider changing this to be a mutable reference: `&mut String`
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
|
7 | fn change(some_string: &mut String) {
| +++

For more information about this error, try `rustc --explain E0596`.
error: could not compile `ownership` due to previous error
error: could not compile `ownership` (bin "ownership") due to 1 previous error
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ help: consider cloning the value if the performance cost is acceptable
| ++++++++

For more information about this error, try `rustc --explain E0382`.
error: could not compile `ownership` due to previous error
error: could not compile `ownership` (bin "ownership") due to 1 previous error
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ error[E0499]: cannot borrow `s` as mutable more than once at a time
| -- first borrow later used here

For more information about this error, try `rustc --explain E0499`.
error: could not compile `ownership` due to previous error
error: could not compile `ownership` (bin "ownership") due to 1 previous error
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ error[E0502]: cannot borrow `s` as mutable because it is also borrowed as immuta
| -- immutable borrow later used here

For more information about this error, try `rustc --explain E0502`.
error: could not compile `ownership` due to previous error
error: could not compile `ownership` (bin "ownership") due to 1 previous error
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,15 @@ error[E0106]: missing lifetime specifier
| ^ expected named lifetime parameter
|
= help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from
help: consider using the `'static` lifetime
help: consider using the `'static` lifetime, but this is uncommon unless you're returning a borrowed value from a `const` or a `static`
|
5 | fn dangle() -> &'static String {
| +++++++
help: instead, you are more likely to want to return an owned value
|
5 - fn dangle() -> &String {
5 + fn dangle() -> String {
|

For more information about this error, try `rustc --explain E0106`.
error: could not compile `ownership` due to previous error
error: could not compile `ownership` (bin "ownership") due to 1 previous error
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ error[E0502]: cannot borrow `s` as mutable because it is also borrowed as immuta
| ---- immutable borrow later used here

For more information about this error, try `rustc --explain E0502`.
error: could not compile `ownership` due to previous error
error: could not compile `ownership` (bin "ownership") due to 1 previous error
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ error[E0277]: `Rectangle` doesn't implement `std::fmt::Display`
= 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)

For more information about this error, try `rustc --explain E0277`.
error: could not compile `rectangles` due to previous error
error: could not compile `rectangles` (bin "rectangles") due to 1 previous error
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ help: consider introducing a named lifetime parameter
|

For more information about this error, try `rustc --explain E0106`.
error: could not compile `structs` due to 2 previous errors
error: could not compile `structs` (bin "structs") due to 2 previous errors
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ $ cargo run
Compiling rectangles v0.1.0 (file:///projects/rectangles)
Finished dev [unoptimized + debuginfo] target(s) in 0.61s
Running `target/debug/rectangles`
[src/main.rs:10] 30 * scale = 60
[src/main.rs:14] &rect1 = Rectangle {
[src/main.rs:10:16] 30 * scale = 60
[src/main.rs:14:5] &rect1 = Rectangle {
width: 60,
height: 50,
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ 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)]
1 + #[derive(Debug)]
2 | struct Rectangle {
|

For more information about this error, try `rustc --explain E0277`.
error: could not compile `rectangles` due to previous error
error: could not compile `rectangles` (bin "rectangles") 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` due to previous error
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,10 +7,10 @@ error[E0004]: non-exhaustive patterns: `None` not covered
| ^ pattern `None` not covered
|
note: `Option<i32>` defined here
--> /rustc/d5a82bbd26e1ad8b7401f6a718a9c57c96905483/library/core/src/option.rs:518:1
--> /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/core/src/option.rs:570:1
::: /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/core/src/option.rs:574:5
|
= note:
/rustc/d5a82bbd26e1ad8b7401f6a718a9c57c96905483/library/core/src/option.rs:522:5: not covered
= note: not covered
= note: the matched value is of type `Option<i32>`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
|
Expand All @@ -19,4 +19,4 @@ help: ensure that all possible cases are being handled by adding a match arm wit
|

For more information about this error, try `rustc --explain E0004`.
error: could not compile `enums` due to previous error
error: could not compile `enums` (bin "enums") due to 1 previous error
10 changes: 7 additions & 3 deletions listings/ch07-managing-growing-projects/listing-07-03/output.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ error[E0603]: module `hosting` is private
--> src/lib.rs:9:28
|
9 | crate::front_of_house::hosting::add_to_waitlist();
| ^^^^^^^ private module
| ^^^^^^^ --------------- function `add_to_waitlist` is not publicly re-exported
| |
| private module
|
note: the module `hosting` is defined here
--> src/lib.rs:2:5
Expand All @@ -16,7 +18,9 @@ error[E0603]: module `hosting` is private
--> src/lib.rs:12:21
|
12 | front_of_house::hosting::add_to_waitlist();
| ^^^^^^^ private module
| ^^^^^^^ --------------- function `add_to_waitlist` is not publicly re-exported
| |
| private module
|
note: the module `hosting` is defined here
--> src/lib.rs:2:5
Expand All @@ -25,4 +29,4 @@ note: the module `hosting` is defined here
| ^^^^^^^^^^^

For more information about this error, try `rustc --explain E0603`.
error: could not compile `restaurant` due to 2 previous errors
error: could not compile `restaurant` (lib) due to 2 previous errors
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ note: the function `add_to_waitlist` is defined here
| ^^^^^^^^^^^^^^^^^^^^

For more information about this error, try `rustc --explain E0603`.
error: could not compile `restaurant` due to 2 previous errors
error: could not compile `restaurant` (lib) due to 2 previous errors
19 changes: 12 additions & 7 deletions listings/ch07-managing-growing-projects/listing-07-12/output.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
$ cargo build
Compiling restaurant v0.1.0 (file:///projects/restaurant)
error[E0433]: failed to resolve: use of undeclared crate or module `hosting`
--> src/lib.rs:11:9
|
11 | hosting::add_to_waitlist();
| ^^^^^^^ use of undeclared crate or module `hosting`
|
help: consider importing this module through its public re-export
|
10 + use crate::hosting;
|

warning: unused import: `crate::front_of_house::hosting`
--> src/lib.rs:7:5
|
Expand All @@ -8,12 +19,6 @@ warning: unused import: `crate::front_of_house::hosting`
|
= note: `#[warn(unused_imports)]` on by default

error[E0433]: failed to resolve: use of undeclared crate or module `hosting`
--> src/lib.rs:11:9
|
11 | hosting::add_to_waitlist();
| ^^^^^^^ use of undeclared crate or module `hosting`

For more information about this error, try `rustc --explain E0433`.
warning: `restaurant` (lib) generated 1 warning
error: could not compile `restaurant` due to previous error; 1 warning emitted
error: could not compile `restaurant` (lib) due to 1 previous error; 1 warning emitted
4 changes: 2 additions & 2 deletions listings/ch08-common-collections/listing-08-06/output.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ error[E0502]: cannot borrow `v` as mutable because it is also borrowed as immuta
| ^^^^^^^^^ mutable borrow occurs here
7 |
8 | println!("The first element is: {first}");
| ----- immutable borrow later used here
| ------- immutable borrow later used here

For more information about this error, try `rustc --explain E0502`.
error: could not compile `collections` due to previous error
error: could not compile `collections` (bin "collections") due to 1 previous error
Loading