Skip to content

Commit

Permalink
Update to Rust 1.76
Browse files Browse the repository at this point in the history
  • Loading branch information
carols10cents committed Feb 19, 2024
1 parent ea46ef3 commit ea11fe5
Show file tree
Hide file tree
Showing 72 changed files with 119 additions and 102 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.75 -c rust-docs
rustup default 1.75
rustup toolchain install 1.76 -c rust-docs
rustup default 1.76
- name: Install mdbook
run: |
mkdir bin
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.

4 changes: 2 additions & 2 deletions listings/ch02-guessing-game-tutorial/listing-02-04/output.txt
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/82e1608dfa6e0b5569232559e3d385fea5a93112/library/core/src/cmp.rs:811:8
--> /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` (bin "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 @@ -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` (bin "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 @@ -15,4 +15,4 @@ help: try removing the method call
|

For more information about this error, try `rustc --explain E0308`.
error: could not compile `variables` (bin "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 @@ -22,4 +22,4 @@ help: remove these parentheses
|

warning: `functions` (bin "functions") generated 1 warning
error: could not compile `functions` (bin "functions") due to previous error; 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` (bin "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` (bin "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` (bin "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 @@ -13,4 +13,4 @@ help: consider giving `guess` an explicit type
| ++++++++++++

For more information about this error, try `rustc --explain E0284`.
error: could not compile `no_type_annotations` (bin "no_type_annotations") due to previous error
error: could not compile `no_type_annotations` (bin "no_type_annotations") due to 1 previous error
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ help: consider changing this to be a mutable reference
| +++

For more information about this error, try `rustc --explain E0596`.
error: could not compile `ownership` (bin "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` (bin "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` (bin "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` (bin "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` (bin "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` (bin "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` (bin "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 @@ -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 @@ -16,4 +16,4 @@ help: consider annotating `Rectangle` with `#[derive(Debug)]`
|

For more information about this error, try `rustc --explain E0277`.
error: could not compile `rectangles` (bin "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 @@ -14,4 +14,4 @@ error[E0277]: cannot add `Option<i8>` to `i8`
<&i8 as Add<&i8>>

For more information about this error, try `rustc --explain E0277`.
error: could not compile `enums` (bin "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,8 +7,8 @@ error[E0004]: non-exhaustive patterns: `None` not covered
| ^ pattern `None` not covered
|
note: `Option<i32>` defined here
--> /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/core/src/option.rs:569:1
::: /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/core/src/option.rs:573:5
--> /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/core/src/option.rs:570:1
::: /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/core/src/option.rs:574:5
|
= note: not covered
= note: the matched value is of type `Option<i32>`
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` (bin "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 @@ -21,4 +21,4 @@ warning: unused import: `crate::front_of_house::hosting`

For more information about this error, try `rustc --explain E0433`.
warning: `restaurant` (lib) generated 1 warning
error: could not compile `restaurant` (lib) due to previous error; 1 warning emitted
error: could not compile `restaurant` (lib) due to 1 previous error; 1 warning emitted
2 changes: 1 addition & 1 deletion listings/ch08-common-collections/listing-08-06/output.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ error[E0502]: cannot borrow `v` 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 `collections` (bin "collections") due to previous error
error: could not compile `collections` (bin "collections") due to 1 previous error
6 changes: 3 additions & 3 deletions listings/ch08-common-collections/listing-08-19/output.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
$ cargo run
Compiling collections v0.1.0 (file:///projects/collections)
error[E0277]: the type `String` cannot be indexed by `{integer}`
--> src/main.rs:3:13
--> src/main.rs:3:16
|
3 | let h = s1[0];
| ^^^^^ `String` cannot be indexed by `{integer}`
| ^ `String` cannot be indexed by `{integer}`
|
= help: the trait `Index<{integer}>` is not implemented for `String`
= help: the following other types implement trait `Index<Idx>`:
Expand All @@ -16,4 +16,4 @@ error[E0277]: the type `String` cannot be indexed by `{integer}`
<String as Index<RangeToInclusive<usize>>>

For more information about this error, try `rustc --explain E0277`.
error: could not compile `collections` (bin "collections") due to previous error
error: could not compile `collections` (bin "collections") due to 1 previous error
2 changes: 1 addition & 1 deletion listings/ch09-error-handling/listing-09-10/output.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ error[E0277]: the `?` operator can only be used in a function that returns `Resu
= help: the trait `FromResidual<Result<Infallible, std::io::Error>>` is not implemented for `()`

For more information about this error, try `rustc --explain E0277`.
error: could not compile `error-handling` (bin "error-handling") due to previous error
error: could not compile `error-handling` (bin "error-handling") due to 1 previous error
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ help: consider restricting type parameter `T`
| ++++++++++++++++++++++

For more information about this error, try `rustc --explain E0369`.
error: could not compile `chapter10` (bin "chapter10") due to previous error
error: could not compile `chapter10` (bin "chapter10") 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 integer, found floating-point number

For more information about this error, try `rustc --explain E0308`.
error: could not compile `chapter10` (bin "chapter10") due to previous error
error: could not compile `chapter10` (bin "chapter10") due to 1 previous error
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ error[E0597]: `x` does not live long enough
| - borrow later used here

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

For more information about this error, try `rustc --explain E0106`.
error: could not compile `chapter10` (bin "chapter10") due to previous error
error: could not compile `chapter10` (bin "chapter10") due to 1 previous error
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ error[E0597]: `string2` does not live long enough
| ------ borrow later used here

For more information about this error, try `rustc --explain E0597`.
error: could not compile `chapter10` (bin "chapter10") due to previous error
error: could not compile `chapter10` (bin "chapter10") due to 1 previous error
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ error[E0515]: cannot return value referencing local variable `result`
| `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
error: could not compile `chapter10` (bin "chapter10") due to 1 previous error
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
pub fn add(left: usize, right: usize) -> usize {
left + right
}

#[cfg(test)]
mod tests {
use super::*;

#[test]
fn it_works() {
let result = 2 + 2;
let result = add(2, 2);
assert_eq!(result, 4);
}
}
2 changes: 1 addition & 1 deletion listings/ch12-an-io-project/listing-12-01/output.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ $ cargo run
Compiling minigrep v0.1.0 (file:///projects/minigrep)
Finished dev [unoptimized + debuginfo] target(s) in 0.61s
Running `target/debug/minigrep`
[src/main.rs:5] args = [
[src/main.rs:5:5] args = [
"target/debug/minigrep",
]
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ $ cargo run -- needle haystack
Compiling minigrep v0.1.0 (file:///projects/minigrep)
Finished dev [unoptimized + debuginfo] target(s) in 1.57s
Running `target/debug/minigrep needle haystack`
[src/main.rs:5] args = [
[src/main.rs:5:5] args = [
"target/debug/minigrep",
"needle",
"haystack",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ help: consider introducing a named lifetime parameter
| ++++ ++ ++ ++

For more information about this error, try `rustc --explain E0106`.
error: could not compile `minigrep` (lib) due to previous error
error: could not compile `minigrep` (lib) due to 1 previous error
2 changes: 1 addition & 1 deletion listings/ch13-functional-features/listing-13-03/output.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ note: closure parameter defined here
| ^

For more information about this error, try `rustc --explain E0308`.
error: could not compile `closure-example` (bin "closure-example") due to previous error
error: could not compile `closure-example` (bin "closure-example") due to 1 previous error
2 changes: 1 addition & 1 deletion listings/ch13-functional-features/listing-13-08/output.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ error[E0507]: cannot move out of `value`, a captured variable in an `FnMut` clos
| ^^^^^ move occurs because `value` has type `String`, which does not implement the `Copy` trait

For more information about this error, try `rustc --explain E0507`.
error: could not compile `rectangles` (bin "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
@@ -1,8 +1,14 @@
pub fn add(left: usize, right: usize) -> usize {
left + right
}

#[cfg(test)]
mod tests {
use super::*;

#[test]
fn it_works() {
let result = 2 + 2;
let result = add(2, 2);
assert_eq!(result, 4);
}
}
2 changes: 1 addition & 1 deletion listings/ch15-smart-pointers/listing-15-03/output.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ help: insert some indirection (e.g., a `Box`, `Rc`, or `&`) to break the cycle
| ++++ +

For more information about this error, try `rustc --explain E0072`.
error: could not compile `cons-list` (bin "cons-list") due to previous error
error: could not compile `cons-list` (bin "cons-list") due to 1 previous error
2 changes: 1 addition & 1 deletion listings/ch15-smart-pointers/listing-15-09/output.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ error[E0614]: type `MyBox<{integer}>` cannot be dereferenced
| ^^

For more information about this error, try `rustc --explain E0614`.
error: could not compile `deref-example` (bin "deref-example") due to previous error
error: could not compile `deref-example` (bin "deref-example") due to 1 previous error
2 changes: 1 addition & 1 deletion listings/ch15-smart-pointers/listing-15-15/output.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ help: consider using `drop` function
| +++++ ~

For more information about this error, try `rustc --explain E0040`.
error: could not compile `drop-example` (bin "drop-example") due to previous error
error: could not compile `drop-example` (bin "drop-example") due to 1 previous error
2 changes: 1 addition & 1 deletion listings/ch15-smart-pointers/listing-15-17/output.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ error[E0382]: use of moved value: `a`
| ^ value used here after move

For more information about this error, try `rustc --explain E0382`.
error: could not compile `cons-list` (bin "cons-list") due to previous error
error: could not compile `cons-list` (bin "cons-list") due to 1 previous error
2 changes: 1 addition & 1 deletion listings/ch15-smart-pointers/listing-15-21/output.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ 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
error: could not compile `limit-tracker` (lib test) due to 1 previous error
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ help: consider changing this to be mutable
| +++

For more information about this error, try `rustc --explain E0596`.
error: could not compile `borrowing` (bin "borrowing") due to previous error
error: could not compile `borrowing` (bin "borrowing") due to 1 previous error
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ error[E0277]: can't compare `{integer}` with `&{integer}`
= note: this error originates in the macro `assert_eq` (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 `deref-example` (bin "deref-example") due to previous error
error: could not compile `deref-example` (bin "deref-example") due to 1 previous error
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ help: to force the closure to take ownership of `v` (and any other referenced va
| ++++

For more information about this error, try `rustc --explain E0373`.
error: could not compile `threads` (bin "threads") due to previous error
error: could not compile `threads` (bin "threads") due to 1 previous error
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,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 `message-passing` (bin "message-passing") due to previous error
error: could not compile `message-passing` (bin "message-passing") due to 1 previous error
Loading

0 comments on commit ea11fe5

Please sign in to comment.