mirror of https://github.com/rust-lang/book
Update to Rust 1.55
This commit is contained in:
parent
e7d05cec4b
commit
126aa9faa8
|
@ -12,8 +12,8 @@ jobs:
|
|||
- name: Install Rust
|
||||
run: |
|
||||
rustup set profile minimal
|
||||
rustup toolchain install 1.54 -c rust-docs
|
||||
rustup default 1.54
|
||||
rustup toolchain install 1.55 -c rust-docs
|
||||
rustup default 1.55
|
||||
- name: Install mdbook
|
||||
run: |
|
||||
mkdir bin
|
||||
|
|
|
@ -16,9 +16,5 @@ error[E0308]: mismatched types
|
|||
= note: expected reference `&String`
|
||||
found reference `&{integer}`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0308`.
|
||||
error: could not compile `guessing_game`
|
||||
|
||||
To learn more, run the command again with --verbose.
|
||||
error: could not compile `guessing_game` due to previous error
|
||||
|
|
|
@ -9,6 +9,5 @@ warning: unused `Result` that must be used
|
|||
= note: `#[warn(unused_must_use)]` on by default
|
||||
= note: this `Result` may be an `Err` variant, which should be handled
|
||||
|
||||
warning: 1 warning emitted
|
||||
|
||||
warning: `guessing_game` (bin "guessing_game") generated 1 warning
|
||||
Finished dev [unoptimized + debuginfo] target(s) in 0.59s
|
||||
|
|
|
@ -12,9 +12,5 @@ error[E0384]: cannot assign twice to immutable variable `x`
|
|||
4 | x = 6;
|
||||
| ^^^^^ cannot assign twice to immutable variable
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0384`.
|
||||
error: could not compile `variables`
|
||||
|
||||
To learn more, run the command again with --verbose.
|
||||
error: could not compile `variables` due to previous error
|
||||
|
|
|
@ -6,9 +6,5 @@ error[E0308]: mismatched types
|
|||
3 | spaces = spaces.len();
|
||||
| ^^^^^^^^^^^^ expected `&str`, found `usize`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0308`.
|
||||
error: could not compile `variables`
|
||||
|
||||
To learn more, run the command again with --verbose.
|
||||
error: could not compile `variables` due to previous error
|
||||
|
|
|
@ -25,9 +25,6 @@ warning: unnecessary parentheses around assigned value
|
|||
|
|
||||
= note: `#[warn(unused_parens)]` on by default
|
||||
|
||||
error: aborting due to 2 previous errors; 1 warning emitted
|
||||
|
||||
For more information about this error, try `rustc --explain E0658`.
|
||||
error: could not compile `functions`
|
||||
|
||||
To learn more, run the command again with --verbose.
|
||||
warning: `functions` (bin "functions") generated 1 warning
|
||||
error: could not compile `functions` due to 2 previous errors; 1 warning emitted
|
||||
|
|
|
@ -10,9 +10,5 @@ error[E0308]: mismatched types
|
|||
8 | x + 1;
|
||||
| - help: consider removing this semicolon
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0308`.
|
||||
error: could not compile `functions`
|
||||
|
||||
To learn more, run the command again with --verbose.
|
||||
error: could not compile `functions` due to previous error
|
||||
|
|
|
@ -6,9 +6,5 @@ error[E0308]: mismatched types
|
|||
4 | if number {
|
||||
| ^^^^^^ expected `bool`, found integer
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0308`.
|
||||
error: could not compile `branches`
|
||||
|
||||
To learn more, run the command again with --verbose.
|
||||
error: could not compile `branches` due to previous error
|
||||
|
|
|
@ -8,9 +8,5 @@ error[E0308]: `if` and `else` have incompatible types
|
|||
| |
|
||||
| expected because of this
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0308`.
|
||||
error: could not compile `branches`
|
||||
|
||||
To learn more, run the command again with --verbose.
|
||||
error: could not compile `branches` due to previous error
|
||||
|
|
|
@ -6,9 +6,5 @@ error[E0282]: type annotations needed
|
|||
2 | let guess = "42".parse().expect("Not a number!");
|
||||
| ^^^^^ consider giving `guess` a type
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0282`.
|
||||
error: could not compile `no_type_annotations`
|
||||
|
||||
To learn more, run the command again with --verbose.
|
||||
error: could not compile `no_type_annotations` due to previous error
|
||||
|
|
|
@ -8,9 +8,5 @@ error[E0596]: cannot borrow `*some_string` as mutable, as it is behind a `&` ref
|
|||
8 | some_string.push_str(", world");
|
||||
| ^^^^^^^^^^^ `some_string` is a `&` reference, so the data it refers to cannot be borrowed as mutable
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0596`.
|
||||
error: could not compile `ownership`
|
||||
|
||||
To learn more, run the command again with --verbose.
|
||||
error: could not compile `ownership` due to previous error
|
||||
|
|
|
@ -11,9 +11,5 @@ error[E0382]: borrow of moved value: `s1`
|
|||
5 | println!("{}, world!", s1);
|
||||
| ^^ value borrowed here after move
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0382`.
|
||||
error: could not compile `ownership`
|
||||
|
||||
To learn more, run the command again with --verbose.
|
||||
error: could not compile `ownership` due to previous error
|
||||
|
|
|
@ -11,9 +11,5 @@ error[E0499]: cannot borrow `s` as mutable more than once at a time
|
|||
7 | println!("{}, {}", r1, r2);
|
||||
| -- first borrow later used here
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0499`.
|
||||
error: could not compile `ownership`
|
||||
|
||||
To learn more, run the command again with --verbose.
|
||||
error: could not compile `ownership` due to previous error
|
||||
|
|
|
@ -12,9 +12,5 @@ error[E0502]: cannot borrow `s` as mutable because it is also borrowed as immuta
|
|||
8 | println!("{}, {}, and {}", r1, r2, r3);
|
||||
| -- immutable borrow later used here
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0502`.
|
||||
error: could not compile `ownership`
|
||||
|
||||
To learn more, run the command again with --verbose.
|
||||
error: could not compile `ownership` due to previous error
|
||||
|
|
|
@ -12,9 +12,5 @@ help: consider using the `'static` lifetime
|
|||
5 | fn dangle() -> &'static String {
|
||||
| ^^^^^^^^
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0106`.
|
||||
error: could not compile `ownership`
|
||||
|
||||
To learn more, run the command again with --verbose.
|
||||
error: could not compile `ownership` due to previous error
|
||||
|
|
|
@ -12,9 +12,5 @@ error[E0502]: cannot borrow `s` as mutable because it is also borrowed as immuta
|
|||
20 | println!("the first word is: {}", word);
|
||||
| ---- immutable borrow later used here
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0502`.
|
||||
error: could not compile `ownership`
|
||||
|
||||
To learn more, run the command again with --verbose.
|
||||
error: could not compile `ownership` due to previous error
|
||||
|
|
|
@ -8,12 +8,7 @@ error[E0277]: `Rectangle` doesn't implement `std::fmt::Display`
|
|||
|
|
||||
= help: the trait `std::fmt::Display` is not implemented for `Rectangle`
|
||||
= note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead
|
||||
= note: required by `std::fmt::Display::fmt`
|
||||
= note: this error originates in the macro `$crate::format_args_nl` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0277`.
|
||||
error: could not compile `rectangles`
|
||||
|
||||
To learn more, run the command again with --verbose.
|
||||
error: could not compile `rectangles` due to previous error
|
||||
|
|
|
@ -1,33 +1,31 @@
|
|||
$ cargo run
|
||||
Compiling structs v0.1.0 (file:///projects/structs)
|
||||
error[E0106]: missing lifetime specifier
|
||||
--> src/main.rs:2:15
|
||||
--> src/main.rs:3:15
|
||||
|
|
||||
2 | username: &str,
|
||||
3 | username: &str,
|
||||
| ^ expected named lifetime parameter
|
||||
|
|
||||
help: consider introducing a named lifetime parameter
|
||||
|
|
||||
1 | struct User<'a> {
|
||||
2 | username: &'a str,
|
||||
2 | active: bool,
|
||||
3 | username: &'a str,
|
||||
|
|
||||
|
||||
error[E0106]: missing lifetime specifier
|
||||
--> src/main.rs:3:12
|
||||
--> src/main.rs:4:12
|
||||
|
|
||||
3 | email: &str,
|
||||
4 | email: &str,
|
||||
| ^ expected named lifetime parameter
|
||||
|
|
||||
help: consider introducing a named lifetime parameter
|
||||
|
|
||||
1 | struct User<'a> {
|
||||
2 | username: &str,
|
||||
3 | email: &'a str,
|
||||
2 | active: bool,
|
||||
3 | username: &str,
|
||||
4 | email: &'a str,
|
||||
|
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0106`.
|
||||
error: could not compile `structs`
|
||||
|
||||
To learn more, run the command again with --verbose.
|
||||
error: could not compile `structs` due to 2 previous errors
|
||||
|
|
|
@ -7,13 +7,8 @@ error[E0277]: `Rectangle` doesn't implement `Debug`
|
|||
| ^^^^^ `Rectangle` cannot be formatted using `{:?}`
|
||||
|
|
||||
= help: the trait `Debug` is not implemented for `Rectangle`
|
||||
= note: add `#[derive(Debug)]` or manually implement `Debug`
|
||||
= note: required by `std::fmt::Debug::fmt`
|
||||
= note: add `#[derive(Debug)]` to `Rectangle` or manually `impl Debug for Rectangle`
|
||||
= note: this error originates in the macro `$crate::format_args_nl` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0277`.
|
||||
error: could not compile `rectangles`
|
||||
|
||||
To learn more, run the command again with --verbose.
|
||||
error: could not compile `rectangles` due to previous error
|
||||
|
|
|
@ -8,9 +8,5 @@ error[E0277]: cannot add `Option<i8>` to `i8`
|
|||
|
|
||||
= help: the trait `Add<Option<i8>>` is not implemented for `i8`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0277`.
|
||||
error: could not compile `enums`
|
||||
|
||||
To learn more, run the command again with --verbose.
|
||||
error: could not compile `enums` due to previous error
|
||||
|
|
|
@ -9,9 +9,5 @@ error[E0004]: non-exhaustive patterns: `None` not covered
|
|||
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
|
||||
= note: the matched value is of type `Option<i32>`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0004`.
|
||||
error: could not compile `enums`
|
||||
|
||||
To learn more, run the command again with --verbose.
|
||||
error: could not compile `enums` due to previous error
|
||||
|
|
|
@ -24,9 +24,5 @@ note: the module `hosting` is defined here
|
|||
2 | mod hosting {
|
||||
| ^^^^^^^^^^^
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0603`.
|
||||
error: could not compile `restaurant`
|
||||
|
||||
To learn more, run the command again with --verbose.
|
||||
error: could not compile `restaurant` due to 2 previous errors
|
||||
|
|
|
@ -24,9 +24,5 @@ note: the function `add_to_waitlist` is defined here
|
|||
3 | fn add_to_waitlist() {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0603`.
|
||||
error: could not compile `restaurant`
|
||||
|
||||
To learn more, run the command again with --verbose.
|
||||
error: could not compile `restaurant` due to 2 previous errors
|
||||
|
|
|
@ -12,9 +12,5 @@ error[E0502]: cannot borrow `v` as mutable because it is also borrowed as immuta
|
|||
8 | println!("The first element is: {}", first);
|
||||
| ----- immutable borrow later used here
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0502`.
|
||||
error: could not compile `collections`
|
||||
|
||||
To learn more, run the command again with --verbose.
|
||||
error: could not compile `collections` due to previous error
|
||||
|
|
|
@ -8,9 +8,5 @@ error[E0277]: the type `String` cannot be indexed by `{integer}`
|
|||
|
|
||||
= help: the trait `Index<{integer}>` is not implemented for `String`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0277`.
|
||||
error: could not compile `collections`
|
||||
|
||||
To learn more, run the command again with --verbose.
|
||||
error: could not compile `collections` due to previous error
|
||||
|
|
|
@ -11,9 +11,5 @@ error[E0308]: mismatched types
|
|||
= note: expected type `u32`
|
||||
found enum `Result<File, std::io::Error>`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0308`.
|
||||
error: could not compile `error-handling`
|
||||
|
||||
To learn more, run the command again with --verbose.
|
||||
error: could not compile `error-handling` due to previous error
|
||||
|
|
|
@ -1,20 +1,16 @@
|
|||
$ cargo run
|
||||
Compiling error-handling v0.1.0 (file:///projects/error-handling)
|
||||
error[E0277]: the `?` operator can only be used in a function that returns `Result` or `Option` (or another type that implements `FromResidual`)
|
||||
--> src/main.rs:4:36
|
||||
|
|
||||
3 | / fn main() {
|
||||
4 | | let f = File::open("hello.txt")?;
|
||||
| | ^ cannot use the `?` operator in a function that returns `()`
|
||||
5 | | }
|
||||
| |_- this function should return `Result` or `Option` to accept `?`
|
||||
|
|
||||
= help: the trait `FromResidual<Result<Infallible, std::io::Error>>` is not implemented for `()`
|
||||
= note: required by `from_residual`
|
||||
|
||||
error: aborting due to previous error
|
||||
--> src/main.rs:4:36
|
||||
|
|
||||
3 | / fn main() {
|
||||
4 | | let f = File::open("hello.txt")?;
|
||||
| | ^ cannot use the `?` operator in a function that returns `()`
|
||||
5 | | }
|
||||
| |_- this function should return `Result` or `Option` to accept `?`
|
||||
|
|
||||
= help: the trait `FromResidual<Result<Infallible, std::io::Error>>` is not implemented for `()`
|
||||
note: required by `from_residual`
|
||||
|
||||
For more information about this error, try `rustc --explain E0277`.
|
||||
error: could not compile `error-handling`
|
||||
|
||||
To learn more, run the command again with --verbose.
|
||||
error: could not compile `error-handling` due to previous error
|
||||
|
|
|
@ -13,9 +13,5 @@ help: consider restricting type parameter `T`
|
|||
1 | fn largest<T: std::cmp::PartialOrd>(list: &[T]) -> T {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0369`.
|
||||
error: could not compile `chapter10`
|
||||
|
||||
To learn more, run the command again with --verbose.
|
||||
error: could not compile `chapter10` due to previous error
|
||||
|
|
|
@ -6,9 +6,5 @@ error[E0308]: mismatched types
|
|||
7 | let wont_work = Point { x: 5, y: 4.0 };
|
||||
| ^^^ expected integer, found floating-point number
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0308`.
|
||||
error: could not compile `chapter10`
|
||||
|
||||
To learn more, run the command again with --verbose.
|
||||
error: could not compile `chapter10` due to previous error
|
||||
|
|
|
@ -11,9 +11,5 @@ error[E0597]: `x` does not live long enough
|
|||
10 | println!("r: {}", r);
|
||||
| - borrow later used here
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0597`.
|
||||
error: could not compile `chapter10`
|
||||
|
||||
To learn more, run the command again with --verbose.
|
||||
error: could not compile `chapter10` due to previous error
|
||||
|
|
|
@ -12,9 +12,5 @@ help: consider introducing a named lifetime parameter
|
|||
9 | fn longest<'a>(x: &'a str, y: &'a str) -> &'a str {
|
||||
| ^^^^ ^^^^^^^ ^^^^^^^ ^^^
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0106`.
|
||||
error: could not compile `chapter10`
|
||||
|
||||
To learn more, run the command again with --verbose.
|
||||
error: could not compile `chapter10` due to previous error
|
||||
|
|
|
@ -10,9 +10,5 @@ error[E0597]: `string2` does not live long enough
|
|||
8 | println!("The longest string is {}", result);
|
||||
| ------ borrow later used here
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0597`.
|
||||
error: could not compile `chapter10`
|
||||
|
||||
To learn more, run the command again with --verbose.
|
||||
error: could not compile `chapter10` due to previous error
|
||||
|
|
|
@ -20,10 +20,6 @@ error[E0507]: cannot move out of a shared reference
|
|||
| |move occurs because `item` has type `T`, which does not implement the `Copy` trait
|
||||
| help: consider removing the `&`: `item`
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0507, E0508.
|
||||
For more information about an error, try `rustc --explain E0507`.
|
||||
error: could not compile `chapter10`
|
||||
|
||||
To learn more, run the command again with --verbose.
|
||||
error: could not compile `chapter10` due to 2 previous errors
|
||||
|
|
|
@ -9,9 +9,5 @@ error[E0515]: cannot return value referencing local variable `result`
|
|||
| returns a value referencing data owned by the current function
|
||||
| `result` is borrowed here
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0515`.
|
||||
error: could not compile `chapter10`
|
||||
|
||||
To learn more, run the command again with --verbose.
|
||||
error: could not compile `chapter10` due to previous error
|
||||
|
|
|
@ -7,7 +7,7 @@ running 2 tests
|
|||
test expensive_test ... ignored
|
||||
test it_works ... ok
|
||||
|
||||
test result: ok. 1 passed; 0 failed; 1 ignored; 0 measured; 0 filtered out; finished in 0.02s
|
||||
test result: ok. 1 passed; 0 failed; 1 ignored; 0 measured; 0 filtered out; finished in 0.00s
|
||||
|
||||
Doc-tests adder
|
||||
|
||||
|
|
|
@ -9,8 +9,7 @@ warning: unused `Result` that must be used
|
|||
= note: `#[warn(unused_must_use)]` on by default
|
||||
= note: this `Result` may be an `Err` variant, which should be handled
|
||||
|
||||
warning: 1 warning emitted
|
||||
|
||||
warning: `minigrep` (bin "minigrep") generated 1 warning
|
||||
Finished dev [unoptimized + debuginfo] target(s) in 0.71s
|
||||
Running `target/debug/minigrep the poem.txt`
|
||||
Searching for the
|
||||
|
|
|
@ -12,9 +12,5 @@ help: consider introducing a named lifetime parameter
|
|||
28 | pub fn search<'a>(query: &'a str, contents: &'a str) -> Vec<&'a str> {
|
||||
| ^^^^ ^^^^^^^ ^^^^^^^ ^^^
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0106`.
|
||||
error: could not compile `minigrep`
|
||||
|
||||
To learn more, run the command again with --verbose.
|
||||
error: could not compile `minigrep` due to previous error
|
||||
|
|
|
@ -9,9 +9,5 @@ error[E0308]: mismatched types
|
|||
| expected struct `String`, found integer
|
||||
| help: try using a conversion method: `5.to_string()`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0308`.
|
||||
error: could not compile `closure-example`
|
||||
|
||||
To learn more, run the command again with --verbose.
|
||||
error: could not compile `closure-example` due to previous error
|
||||
|
|
|
@ -9,7 +9,6 @@ warning: unused `Map` that must be used
|
|||
= note: `#[warn(unused_must_use)]` on by default
|
||||
= note: iterators are lazy and do nothing unless consumed
|
||||
|
||||
warning: 1 warning emitted
|
||||
|
||||
warning: `iterators` (bin "iterators") generated 1 warning
|
||||
Finished dev [unoptimized + debuginfo] target(s) in 0.47s
|
||||
Running `target/debug/iterators`
|
||||
|
|
|
@ -8,9 +8,5 @@ error[E0434]: can't capture dynamic environment in a fn item
|
|||
|
|
||||
= help: use the `|| { ... }` closure form instead
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0434`.
|
||||
error: could not compile `equal-to-x`
|
||||
|
||||
To learn more, run the command again with --verbose.
|
||||
error: could not compile `equal-to-x` due to previous error
|
||||
|
|
|
@ -14,9 +14,5 @@ error[E0382]: borrow of moved value: `x`
|
|||
6 | println!("can't use x here: {:?}", x);
|
||||
| ^ value borrowed here after move
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0382`.
|
||||
error: could not compile `equal-to-x`
|
||||
|
||||
To learn more, run the command again with --verbose.
|
||||
error: could not compile `equal-to-x` due to previous error
|
||||
|
|
|
@ -22,10 +22,6 @@ error[E0391]: cycle detected when computing drop-check constraints for `List`
|
|||
= note: ...which again requires computing drop-check constraints for `List`, completing the cycle
|
||||
= note: cycle used when computing dropck types for `Canonical { max_universe: U0, variables: [], value: ParamEnvAnd { param_env: ParamEnv { caller_bounds: [], reveal: UserFacing }, value: List } }`
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0072, E0391.
|
||||
For more information about an error, try `rustc --explain E0072`.
|
||||
error: could not compile `cons-list`
|
||||
|
||||
To learn more, run the command again with --verbose.
|
||||
error: could not compile `cons-list` due to 2 previous errors
|
||||
|
|
|
@ -6,9 +6,5 @@ error[E0614]: type `MyBox<{integer}>` cannot be dereferenced
|
|||
14 | assert_eq!(5, *y);
|
||||
| ^^
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0614`.
|
||||
error: could not compile `deref-example`
|
||||
|
||||
To learn more, run the command again with --verbose.
|
||||
error: could not compile `deref-example` due to previous error
|
||||
|
|
|
@ -9,9 +9,5 @@ error[E0040]: explicit use of destructor method
|
|||
| | explicit destructor calls not allowed
|
||||
| help: consider using `drop` function: `drop(c)`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0040`.
|
||||
error: could not compile `drop-example`
|
||||
|
||||
To learn more, run the command again with --verbose.
|
||||
error: could not compile `drop-example` due to previous error
|
||||
|
|
|
@ -10,9 +10,5 @@ error[E0382]: use of moved value: `a`
|
|||
11 | let c = Cons(4, Box::new(a));
|
||||
| ^ value used here after move
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0382`.
|
||||
error: could not compile `cons-list`
|
||||
|
||||
To learn more, run the command again with --verbose.
|
||||
error: could not compile `cons-list` due to previous error
|
||||
|
|
|
@ -9,11 +9,7 @@ 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
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0596`.
|
||||
error: could not compile `limit-tracker`
|
||||
|
||||
To learn more, run the command again with --verbose.
|
||||
error: could not compile `limit-tracker` due to previous error
|
||||
warning: build failed, waiting for other jobs to finish...
|
||||
error: build failed
|
||||
|
|
|
@ -8,9 +8,5 @@ error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable
|
|||
3 | let y = &mut x;
|
||||
| ^^^^^^ cannot borrow as mutable
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0596`.
|
||||
error: could not compile `borrowing`
|
||||
|
||||
To learn more, run the command again with --verbose.
|
||||
error: could not compile `borrowing` due to previous error
|
||||
|
|
|
@ -9,9 +9,5 @@ error[E0277]: can't compare `{integer}` with `&{integer}`
|
|||
= help: the trait `PartialEq<&{integer}>` is not implemented for `{integer}`
|
||||
= note: this error originates in the macro `assert_eq` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0277`.
|
||||
error: could not compile `deref-example`
|
||||
|
||||
To learn more, run the command again with --verbose.
|
||||
error: could not compile `deref-example` due to previous error
|
||||
|
|
|
@ -21,9 +21,5 @@ help: to force the closure to take ownership of `v` (and any other referenced va
|
|||
6 | let handle = thread::spawn(move || {
|
||||
| ^^^^^^^
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0373`.
|
||||
error: could not compile `threads`
|
||||
|
||||
To learn more, run the command again with --verbose.
|
||||
error: could not compile `threads` due to previous error
|
||||
|
|
|
@ -10,9 +10,5 @@ error[E0382]: borrow of moved value: `val`
|
|||
10 | println!("val is {}", val);
|
||||
| ^^^ value borrowed here after move
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0382`.
|
||||
error: could not compile `message-passing`
|
||||
|
||||
To learn more, run the command again with --verbose.
|
||||
error: could not compile `message-passing` due to previous error
|
||||
|
|
|
@ -11,9 +11,5 @@ error[E0382]: use of moved value: `counter`
|
|||
10 | let mut num = counter.lock().unwrap();
|
||||
| ------- use occurs due to use in closure
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0382`.
|
||||
error: could not compile `shared-state`
|
||||
|
||||
To learn more, run the command again with --verbose.
|
||||
error: could not compile `shared-state` due to previous error
|
||||
|
|
|
@ -16,9 +16,5 @@ error[E0277]: `Rc<Mutex<i32>>` cannot be sent between threads safely
|
|||
= help: within `[closure@src/main.rs:11:36: 15:10]`, the trait `Send` is not implemented for `Rc<Mutex<i32>>`
|
||||
= note: required because it appears within the type `[closure@src/main.rs:11:36: 15:10]`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0277`.
|
||||
error: could not compile `shared-state`
|
||||
|
||||
To learn more, run the command again with --verbose.
|
||||
error: could not compile `shared-state` due to previous error
|
||||
|
|
|
@ -14,9 +14,5 @@ error[E0382]: use of moved value: `v`
|
|||
10 | drop(v); // oh no!
|
||||
| ^ value used here after move
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0382`.
|
||||
error: could not compile `threads`
|
||||
|
||||
To learn more, run the command again with --verbose.
|
||||
error: could not compile `threads` due to previous error
|
||||
|
|
|
@ -8,9 +8,5 @@ error[E0277]: the trait bound `String: Draw` is not satisfied
|
|||
|
|
||||
= note: required for the cast to the object type `dyn Draw`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0277`.
|
||||
error: could not compile `gui`
|
||||
|
||||
To learn more, run the command again with --verbose.
|
||||
error: could not compile `gui` due to previous error
|
||||
|
|
|
@ -1,17 +1,13 @@
|
|||
$ cargo build
|
||||
Compiling gui v0.1.0 (file:///projects/gui)
|
||||
error[E0038]: the trait `Clone` cannot be made into an object
|
||||
--> src/lib.rs:2:21
|
||||
--> src/lib.rs:2:29
|
||||
|
|
||||
2 | pub components: Vec<Box<dyn Clone>>,
|
||||
| ^^^^^^^^^^^^^^^^^^^ `Clone` cannot be made into an object
|
||||
| ^^^^^^^^^ `Clone` cannot be made into an object
|
||||
|
|
||||
= note: the trait cannot be made into an object because it requires `Self: Sized`
|
||||
= note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0038`.
|
||||
error: could not compile `gui`
|
||||
|
||||
To learn more, run the command again with --verbose.
|
||||
error: could not compile `gui` due to previous error
|
||||
|
|
|
@ -11,9 +11,5 @@ error[E0308]: mismatched types
|
|||
= note: expected tuple `({integer}, {integer}, {integer})`
|
||||
found tuple `(_, _)`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0308`.
|
||||
error: could not compile `patterns`
|
||||
|
||||
To learn more, run the command again with --verbose.
|
||||
error: could not compile `patterns` due to previous error
|
||||
|
|
|
@ -14,9 +14,5 @@ help: you might want to use `if let` to ignore the variant that isn't matched
|
|||
3 | if let Some(x) = some_option_value { /* */ }
|
||||
|
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0005`.
|
||||
error: could not compile `patterns`
|
||||
|
||||
To learn more, run the command again with --verbose.
|
||||
error: could not compile `patterns` due to previous error
|
||||
|
|
|
@ -12,8 +12,7 @@ warning: irrefutable `if let` pattern
|
|||
= note: this pattern will always match, so the `if let` is useless
|
||||
= help: consider replacing the `if let` with a `let`
|
||||
|
||||
warning: 1 warning emitted
|
||||
|
||||
warning: `patterns` (bin "patterns") generated 1 warning
|
||||
Finished dev [unoptimized + debuginfo] target(s) in 0.39s
|
||||
Running `target/debug/patterns`
|
||||
5
|
||||
|
|
|
@ -8,8 +8,4 @@ error: `..` can only be used once per tuple pattern
|
|||
| |
|
||||
| previously used here
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
error: could not compile `patterns`
|
||||
|
||||
To learn more, run the command again with --verbose.
|
||||
error: could not compile `patterns` due to previous error
|
||||
|
|
|
@ -13,9 +13,5 @@ error[E0499]: cannot borrow `*slice` as mutable more than once at a time
|
|||
| | first mutable borrow occurs here
|
||||
| returning this value requires that `*slice` is borrowed for `'1`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0499`.
|
||||
error: could not compile `unsafe-example`
|
||||
|
||||
To learn more, run the command again with --verbose.
|
||||
error: could not compile `unsafe-example` due to previous error
|
||||
|
|
|
@ -3,17 +3,15 @@ $ cargo run
|
|||
error[E0283]: type annotations needed
|
||||
--> src/main.rs:20:43
|
||||
|
|
||||
2 | fn baby_name() -> String;
|
||||
| ------------------------- required by `Animal::baby_name`
|
||||
...
|
||||
20 | println!("A baby dog is called a {}", Animal::baby_name());
|
||||
| ^^^^^^^^^^^^^^^^^ cannot infer type
|
||||
|
|
||||
= note: cannot satisfy `_: Animal`
|
||||
|
||||
error: aborting due to previous error
|
||||
note: required by `Animal::baby_name`
|
||||
--> src/main.rs:2:5
|
||||
|
|
||||
2 | fn baby_name() -> String;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
For more information about this error, try `rustc --explain E0283`.
|
||||
error: could not compile `traits-example`
|
||||
|
||||
To learn more, run the command again with --verbose.
|
||||
error: could not compile `traits-example` due to previous error
|
||||
|
|
|
@ -12,9 +12,5 @@ error[E0277]: `Point` doesn't implement `std::fmt::Display`
|
|||
= help: the trait `std::fmt::Display` is not implemented for `Point`
|
||||
= note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0277`.
|
||||
error: could not compile `traits-example`
|
||||
|
||||
To learn more, run the command again with --verbose.
|
||||
error: could not compile `traits-example` due to previous error
|
||||
|
|
|
@ -12,9 +12,5 @@ help: use `impl Fn(i32) -> i32` as the return type, as all return paths are of t
|
|||
1 | fn returns_closure() -> impl Fn(i32) -> i32 {
|
||||
| ^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0746`.
|
||||
error: could not compile `functions-example`
|
||||
|
||||
To learn more, run the command again with --verbose.
|
||||
error: could not compile `functions-example` due to previous error
|
||||
|
|
|
@ -8,9 +8,5 @@ error[E0133]: call to unsafe function is unsafe and requires unsafe function or
|
|||
|
|
||||
= note: consult the function's documentation for information on how to avoid undefined behavior
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0133`.
|
||||
error: could not compile `unsafe-example`
|
||||
|
||||
To learn more, run the command again with --verbose.
|
||||
error: could not compile `unsafe-example` due to previous error
|
||||
|
|
|
@ -6,9 +6,5 @@ error[E0433]: failed to resolve: use of undeclared type `ThreadPool`
|
|||
10 | let pool = ThreadPool::new(4);
|
||||
| ^^^^^^^^^^ use of undeclared type `ThreadPool`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0433`.
|
||||
error: could not compile `hello`
|
||||
|
||||
To learn more, run the command again with --verbose.
|
||||
error: could not compile `hello` due to previous error
|
||||
|
|
|
@ -9,9 +9,5 @@ error[E0382]: use of moved value: `receiver`
|
|||
27 | workers.push(Worker::new(id, receiver));
|
||||
| ^^^^^^^^ value moved here, in previous iteration of loop
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0382`.
|
||||
error: could not compile `hello`
|
||||
|
||||
To learn more, run the command again with --verbose.
|
||||
error: could not compile `hello` due to previous error
|
||||
|
|
|
@ -6,9 +6,5 @@ error[E0507]: cannot move out of `worker.thread` which is behind a mutable refer
|
|||
52 | worker.thread.join().unwrap();
|
||||
| ^^^^^^^^^^^^^ move occurs because `worker.thread` has type `JoinHandle<()>`, which does not implement the `Copy` trait
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0507`.
|
||||
error: could not compile `hello`
|
||||
|
||||
To learn more, run the command again with --verbose.
|
||||
error: could not compile `hello` due to previous error
|
||||
|
|
|
@ -6,9 +6,5 @@ error[E0599]: no function or associated item named `new` found for struct `Threa
|
|||
11 | let pool = ThreadPool::new(4);
|
||||
| ^^^ function or associated item not found in `ThreadPool`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0599`.
|
||||
error: could not compile `hello`
|
||||
|
||||
To learn more, run the command again with --verbose.
|
||||
error: could not compile `hello` due to previous error
|
||||
|
|
|
@ -6,9 +6,5 @@ error[E0599]: no method named `execute` found for struct `ThreadPool` in the cur
|
|||
16 | pool.execute(|| {
|
||||
| ^^^^^^^ method not found in `ThreadPool`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0599`.
|
||||
error: could not compile `hello`
|
||||
|
||||
To learn more, run the command again with --verbose.
|
||||
error: could not compile `hello` due to previous error
|
||||
|
|
|
@ -18,10 +18,6 @@ error[E0308]: mismatched types
|
|||
= note: expected enum `Option<JoinHandle<()>>`
|
||||
found struct `JoinHandle<_>`
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0308, E0599.
|
||||
For more information about an error, try `rustc --explain E0308`.
|
||||
error: could not compile `hello`
|
||||
|
||||
To learn more, run the command again with --verbose.
|
||||
error: could not compile `hello` due to 2 previous errors
|
||||
|
|
|
@ -1 +1 @@
|
|||
1.54
|
||||
1.55
|
||||
|
|
|
@ -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.54 or later with
|
||||
This version of the text assumes you’re using Rust 1.55 or later with
|
||||
`edition="2018"` in *Cargo.toml* of all projects to use Rust 2018 Edition
|
||||
idioms. See the [“Installation” section of Chapter 1][install]<!-- ignore -->
|
||||
to install or update Rust, and see the new [Appendix E][editions]<!-- ignore
|
||||
|
|
Loading…
Reference in New Issue