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

Update Rust version and output #2518

Merged
merged 13 commits into from
Dec 9, 2020
Next Next commit
Update to 1.42
  • Loading branch information
carols10cents committed Dec 5, 2020
commit 6e988056292ce5af6910412b8d220d314e836e6e
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.41.0 -c rust-docs
rustup default 1.41.0
rustup toolchain install 1.42 -c rust-docs
rustup default 1.42
- name: Install mdbook
run: |
mkdir bin
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,32 @@
$ cargo run
Compiling functions v0.1.0 (file:///projects/functions)
error[E0658]: `let` expressions in this position are experimental
--> src/main.rs:2:14
|
2 | let x = (let y = 6);
| ^^^^^^^^^
|
= note: for more information, see https://github.com/rust-lang/rust/issues/53667

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

warning: unnecessary parentheses around assigned value
--> src/main.rs:2:13
|
2 | let x = (let y = 6);
| ^^^^^^^^^^^ help: remove these parentheses
|
= note: variable declaration using `let` is a statement
= note: `#[warn(unused_parens)]` on by default

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0658`.
error: could not compile `functions`.

To learn more, run the command again with --verbose.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
$ cargo run
Compiling branches v0.1.0 (file:///projects/branches)
error[E0308]: if and else have incompatible types
error[E0308]: `if` and `else` have incompatible types
--> src/main.rs:4:44
|
4 | let number = if condition { 5 } else { "six" };
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,26 @@ error[E0106]: missing lifetime specifier
--> src/main.rs:2:15
|
2 | username: &str,
| ^ expected lifetime parameter
| ^ expected named lifetime parameter
|
help: consider introducing a named lifetime parameter
|
1 | struct User<'lifetime> {
2 | username: &'lifetime str,
|

error[E0106]: missing lifetime specifier
--> src/main.rs:3:12
|
3 | email: &str,
| ^ expected lifetime parameter
| ^ expected named lifetime parameter
|
help: consider introducing a named lifetime parameter
|
1 | struct User<'lifetime> {
2 | username: &str,
3 | email: &'lifetime str,
|

error: aborting due to 2 previous errors

Expand Down
16 changes: 14 additions & 2 deletions listings/ch07-managing-growing-projects/listing-07-03/output.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,25 @@ error[E0603]: module `hosting` is private
--> src/lib.rs:9:28
|
9 | crate::front_of_house::hosting::add_to_waitlist();
| ^^^^^^^
| ^^^^^^^ this module is private
|
note: the module `hosting` is defined here
--> src/lib.rs:2:5
|
2 | mod hosting {
| ^^^^^^^^^^^

error[E0603]: module `hosting` is private
--> src/lib.rs:12:21
|
12 | front_of_house::hosting::add_to_waitlist();
| ^^^^^^^
| ^^^^^^^ this module is private
|
note: the module `hosting` is defined here
--> src/lib.rs:2:5
|
2 | mod hosting {
| ^^^^^^^^^^^

error: aborting due to 2 previous errors

Expand Down
16 changes: 14 additions & 2 deletions listings/ch07-managing-growing-projects/listing-07-05/output.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,25 @@ error[E0603]: function `add_to_waitlist` is private
--> src/lib.rs:9:37
|
9 | crate::front_of_house::hosting::add_to_waitlist();
| ^^^^^^^^^^^^^^^
| ^^^^^^^^^^^^^^^ this function is private
|
note: the function `add_to_waitlist` is defined here
--> src/lib.rs:3:9
|
3 | fn add_to_waitlist() {}
| ^^^^^^^^^^^^^^^^^^^^

error[E0603]: function `add_to_waitlist` is private
--> src/lib.rs:12:30
|
12 | front_of_house::hosting::add_to_waitlist();
| ^^^^^^^^^^^^^^^
| ^^^^^^^^^^^^^^^ this function is private
|
note: the function `add_to_waitlist` is defined here
--> src/lib.rs:3:9
|
3 | fn add_to_waitlist() {}
| ^^^^^^^^^^^^^^^^^^^^

error: aborting due to 2 previous errors

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ $ 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/libcore/str/mod.rs:2069:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
thread 'main' panicked at 'byte index 1 is not a char boundary; it is inside 'З' (bytes 0..2) of `Здравствуйте`', src/libcore/str/mod.rs:2154:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
4 changes: 2 additions & 2 deletions listings/ch09-error-handling/listing-09-01/output.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ $ 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', /rustc/5e1a799842ba6ed4a57e91f7ab9435947482f7d8/src/libcore/slice/mod.rs:2806:10
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
thread 'main' panicked at 'index out of bounds: the len is 3 but the index is 99', /rustc/b8cedc00407a4c56a3bda1ed605c6fc166655447/src/libcore/slice/mod.rs:2791:10
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
2 changes: 1 addition & 1 deletion listings/ch09-error-handling/listing-09-04/output.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ $ cargo run
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
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ $ cargo run
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
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
$ cargo run
Compiling chapter10 v0.1.0 (file:///projects/chapter10)
error[E0369]: binary operation `>` cannot be applied to type `T`
error[E0369]: binary operation `>` cannot be applied to type `&T`
--> src/main.rs:5:17
|
5 | if item > largest {
| ---- ^ ------- T
| ---- ^ ------- &T
| |
| T
| &T
|
= note: `T` might need a bound for `std::cmp::PartialOrd`
= note: an implementation of `std::cmp::PartialOrd` might be missing for `&T`

error: aborting due to previous error

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,13 @@ error[E0106]: missing lifetime specifier
--> src/main.rs:9:33
|
9 | fn longest(x: &str, y: &str) -> &str {
| ^ expected lifetime parameter
| ^ expected named lifetime parameter
|
= help: this function's return type contains a borrowed value, but the signature does not say whether it is borrowed from `x` or `y`
help: consider introducing a named lifetime parameter
|
9 | fn longest<'lifetime>(x: &str, y: &str) -> &'lifetime str {
| ^^^^^^^^^^^ ^^^^^^^^^^

error: aborting due to previous error

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

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


failures:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ failures:
I got the value 8
thread 'main' panicked at 'assertion failed: `(left == right)`
left: `5`,
right: `10`', src/lib.rs:19:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
right: `10`', src/lib.rs:20:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace


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

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


failures:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ failures:
thread 'main' panicked at 'assertion failed: `(left == right)`
left: `4`,
right: `5`', src/lib.rs:11:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace


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

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


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

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


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

---- tests::greater_than_100 stdout ----
thread 'main' panicked at 'Guess value must be greater than or equal to 1, got 200.', src/lib.rs:13:13
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
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."`,
expected substring: `"Guess value must be less than or equal to 100"`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ I got the value 8
thread 'main' panicked at 'assertion failed: `(left == right)`
left: `5`,
right: `10`', src/lib.rs:19:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace


failures:
Expand Down
2 changes: 1 addition & 1 deletion listings/ch12-an-io-project/listing-12-07/output.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ $ cargo run
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
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
2 changes: 1 addition & 1 deletion listings/ch12-an-io-project/listing-12-08/output.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ $ cargo run
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
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
2 changes: 1 addition & 1 deletion listings/ch12-an-io-project/listing-12-16/output.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ failures:
thread 'main' panicked at 'assertion failed: `(left == right)`
left: `["safe, fast, productive."]`,
right: `[]`', src/lib.rs:44:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace


failures:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,13 @@ error[E0106]: missing lifetime specifier
--> src/lib.rs:28:51
|
28 | pub fn search(query: &str, contents: &str) -> Vec<&str> {
| ^ expected lifetime parameter
| ^ expected named lifetime parameter
|
= help: this function's return type contains a borrowed value, but the signature does not say whether it is borrowed from `query` or `contents`
help: consider introducing a named lifetime parameter
|
28 | pub fn search<'lifetime>(query: &str, contents: &str) -> Vec<&'lifetime str> {
| ^^^^^^^^^^^ ^^^^^^^^^^

error: aborting due to previous error

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ failures:
thread 'main' panicked at 'assertion failed: `(left == right)`
left: `1`,
right: `2`', src/lib.rs:43:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace


failures:
Expand Down

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

4 changes: 2 additions & 2 deletions listings/ch15-smart-pointers/listing-15-23/output.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +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 'main' panicked at 'already borrowed: BorrowMutError', src/libcore/result.rs:1188:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
thread 'main' panicked at 'already borrowed: BorrowMutError', /rustc/b8cedc00407a4c56a3bda1ed605c6fc166655447/src/libcore/cell.rs:878:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace


failures:
Expand Down
11 changes: 9 additions & 2 deletions listings/ch16-fearless-concurrency/listing-16-14/output.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,15 @@ $ cargo run
error[E0277]: `std::rc::Rc<std::sync::Mutex<i32>>` cannot be sent between threads safely
--> src/main.rs:11:22
|
11 | let handle = thread::spawn(move || {
| ^^^^^^^^^^^^^ `std::rc::Rc<std::sync::Mutex<i32>>` cannot be sent between threads safely
11 | let handle = thread::spawn(move || {
| ______________________^^^^^^^^^^^^^_-
| | |
| | `std::rc::Rc<std::sync::Mutex<i32>>` cannot be sent between threads safely
12 | | let mut num = counter.lock().unwrap();
13 | |
14 | | *num += 1;
15 | | });
| |_________- within this `[closure@src/main.rs:11:36: 15:10 counter:std::rc::Rc<std::sync::Mutex<i32>>]`
|
= help: within `[closure@src/main.rs:11:36: 15:10 counter:std::rc::Rc<std::sync::Mutex<i32>>]`, the trait `std::marker::Send` is not implemented for `std::rc::Rc<std::sync::Mutex<i32>>`
= note: required because it appears within the type `[closure@src/main.rs:11:36: 15:10 counter:std::rc::Rc<std::sync::Mutex<i32>>]`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,9 @@ error[E0277]: the size for values of type `(dyn std::ops::Fn(i32) -> i32 + 'stat
= note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
= note: the return type of a function must have a statically known size

error[E0308]: mismatched types
--> src/lib.rs:2:5
|
1 | fn returns_closure() -> dyn Fn(i32) -> i32 {
| ------------------ expected `(dyn std::ops::Fn(i32) -> i32 + 'static)` because of return type
2 | |x| x + 1
| ^^^^^^^^^ expected trait `std::ops::Fn`, found closure
|
= note: expected trait object `(dyn std::ops::Fn(i32) -> i32 + 'static)`
found closure `[closure@src/lib.rs:2:5: 2:14]`

error: aborting due to 2 previous errors
error: aborting due to previous error

Some errors have detailed explanations: E0277, E0308.
For more information about an error, try `rustc --explain E0277`.
For more information about this error, try `rustc --explain E0277`.
error: could not compile `functions-example`.

To learn more, run the command again with --verbose.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
$ cargo check
Checking hello v0.1.0 (file:///projects/hello)
error[E0599]: no function or associated item named `new` found for type `hello::ThreadPool` in the current scope
error[E0599]: no function or associated item named `new` found for struct `hello::ThreadPool` in the current scope
--> src/bin/main.rs:11:28
|
11 | let pool = ThreadPool::new(4);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
$ cargo check
Checking hello v0.1.0 (file:///projects/hello)
error[E0599]: no method named `execute` found for type `hello::ThreadPool` in the current scope
error[E0599]: no method named `execute` found for struct `hello::ThreadPool` in the current scope
--> src/bin/main.rs:16:14
|
16 | pool.execute(|| {
Expand Down
Loading