mirror of https://github.com/rust-lang/book
1.57
This commit is contained in:
parent
5f2729cdc5
commit
5f9358faeb
|
@ -12,8 +12,8 @@ jobs:
|
|||
- name: Install Rust
|
||||
run: |
|
||||
rustup set profile minimal
|
||||
rustup toolchain install 1.56 -c rust-docs
|
||||
rustup default 1.56
|
||||
rustup toolchain install 1.57 -c rust-docs
|
||||
rustup default 1.57
|
||||
- name: Install mdbook
|
||||
run: |
|
||||
mkdir bin
|
||||
|
|
|
@ -21,9 +21,14 @@ warning: unnecessary parentheses around assigned value
|
|||
--> src/main.rs:2:13
|
||||
|
|
||||
2 | let x = (let y = 6);
|
||||
| ^^^^^^^^^^^ help: remove these parentheses
|
||||
| ^ ^
|
||||
|
|
||||
= note: `#[warn(unused_parens)]` on by default
|
||||
help: remove these parentheses
|
||||
|
|
||||
2 - let x = (let y = 6);
|
||||
2 + let x = let y = 6;
|
||||
|
|
||||
|
||||
For more information about this error, try `rustc --explain E0658`.
|
||||
warning: `functions` (bin "functions") generated 1 warning
|
||||
|
|
|
@ -6,7 +6,7 @@ error[E0596]: cannot borrow `*some_string` as mutable, as it is behind a `&` ref
|
|||
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
|
||||
|
||||
For more information about this error, try `rustc --explain E0596`.
|
||||
error: could not compile `ownership` due to previous error
|
||||
|
|
|
@ -4,7 +4,7 @@ error[E0597]: `string2` does not live long enough
|
|||
--> src/main.rs:6:44
|
||||
|
|
||||
6 | result = longest(string1.as_str(), string2.as_str());
|
||||
| ^^^^^^^ borrowed value does not live long enough
|
||||
| ^^^^^^^^^^^^^^^^ borrowed value does not live long enough
|
||||
7 | }
|
||||
| - `string2` dropped here while still borrowed
|
||||
8 | println!("The longest string is {}", result);
|
||||
|
|
|
@ -1,13 +1,10 @@
|
|||
$ cargo run
|
||||
Compiling chapter10 v0.1.0 (file:///projects/chapter10)
|
||||
error[E0515]: cannot return value referencing local variable `result`
|
||||
error[E0515]: cannot return reference to local variable `result`
|
||||
--> src/main.rs:11:5
|
||||
|
|
||||
11 | result.as_str()
|
||||
| ------^^^^^^^^^
|
||||
| |
|
||||
| returns a value referencing data owned by the current function
|
||||
| `result` is borrowed here
|
||||
| ^^^^^^^^^^^^^^^ returns a reference to data owned by the current function
|
||||
|
||||
For more information about this error, try `rustc --explain E0515`.
|
||||
error: could not compile `chapter10` due to previous error
|
||||
|
|
|
@ -7,7 +7,7 @@ error[E0596]: cannot borrow `self.sent_messages` as mutable, as it is behind a `
|
|||
| ----- help: consider changing that to be a mutable reference: `&mut self`
|
||||
...
|
||||
58 | self.sent_messages.push(String::from(message));
|
||||
| ^^^^^^^^^^^^^^^^^^ `self` is a `&` reference, so the data it refers to cannot be borrowed as mutable
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `self` is a `&` reference, so the data it refers to cannot be borrowed as mutable
|
||||
|
||||
For more information about this error, try `rustc --explain E0596`.
|
||||
error: could not compile `limit-tracker` due to previous error
|
||||
|
|
|
@ -4,7 +4,7 @@ error[E0277]: can't compare `{integer}` with `&{integer}`
|
|||
--> src/main.rs:6:5
|
||||
|
|
||||
6 | assert_eq!(5, y);
|
||||
| ^^^^^^^^^^^^^^^^^ no implementation for `{integer} == &{integer}`
|
||||
| ^^^^^^^^^^^^^^^^ no implementation for `{integer} == &{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)
|
||||
|
|
|
@ -1 +1 @@
|
|||
1.56
|
||||
1.57
|
||||
|
|
|
@ -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.56 or later with
|
||||
This version of the text assumes you’re using Rust 1.57 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