Skip to content

Commit 93c7035

Browse files
committed
update original
1 parent 2b901fe commit 93c7035

File tree

59 files changed

+3743
-13390
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+3743
-13390
lines changed

rustbook-en/.github/workflows/main.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ jobs:
1212
- name: Install Rust
1313
run: |
1414
rustup set profile minimal
15-
rustup toolchain install 1.81 -c rust-docs
16-
rustup default 1.81
15+
rustup toolchain install 1.82 -c rust-docs
16+
rustup default 1.82
1717
- name: Install mdbook
1818
run: |
1919
mkdir bin
@@ -47,8 +47,8 @@ jobs:
4747
- name: Install Rust
4848
run: |
4949
rustup set profile minimal
50-
rustup toolchain install 1.81 -c rust-docs
51-
rustup default 1.81
50+
rustup toolchain install 1.82 -c rust-docs
51+
rustup default 1.82
5252
- name: Run `tools` package tests
5353
run: |
5454
cargo test
Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,4 @@
11
$ cargo build
2-
Downloading crates ...
3-
Downloaded rand_core v0.6.2
4-
Downloaded getrandom v0.2.2
5-
Downloaded rand_chacha v0.3.0
6-
Downloaded ppv-lite86 v0.2.10
7-
Downloaded libc v0.2.86
82
Compiling libc v0.2.86
93
Compiling getrandom v0.2.2
104
Compiling cfg-if v1.0.0
@@ -14,17 +8,20 @@ $ cargo build
148
Compiling rand v0.8.5
159
Compiling guessing_game v0.1.0 (file:///projects/guessing_game)
1610
error[E0308]: mismatched types
17-
--> src/main.rs:22:21
18-
|
19-
22 | match guess.cmp(&secret_number) {
20-
| --- ^^^^^^^^^^^^^^ expected `&String`, found `&{integer}`
21-
| |
22-
| arguments to this method are incorrect
23-
|
24-
= note: expected reference `&String`
25-
found reference `&{integer}`
11+
--> src/main.rs:22:21
12+
|
13+
22 | match guess.cmp(&secret_number) {
14+
| --- ^^^^^^^^^^^^^^ expected `&String`, found `&{integer}`
15+
| |
16+
| arguments to this method are incorrect
17+
|
18+
= note: expected reference `&String`
19+
found reference `&{integer}`
2620
note: method defined here
27-
--> /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/core/src/cmp.rs:839:8
21+
--> file:///home/.rustup/toolchains/1.82/lib/rustlib/src/rust/library/core/src/cmp.rs:838:8
22+
|
23+
838 | fn cmp(&self, other: &Self) -> Ordering;
24+
| ^^^
2825

2926
For more information about this error, try `rustc --explain E0308`.
3027
error: could not compile `guessing_game` (bin "guessing_game") due to 1 previous error
Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,25 @@
11
$ cargo run
22
Compiling enums v0.1.0 (file:///projects/enums)
33
error[E0004]: non-exhaustive patterns: `None` not covered
4-
--> src/main.rs:3:15
5-
|
6-
3 | match x {
7-
| ^ pattern `None` not covered
8-
|
4+
--> src/main.rs:3:15
5+
|
6+
3 | match x {
7+
| ^ pattern `None` not covered
8+
|
99
note: `Option<i32>` defined here
10-
--> /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/core/src/option.rs:574:1
11-
::: /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/core/src/option.rs:578:5
12-
|
13-
= note: not covered
14-
= note: the matched value is of type `Option<i32>`
10+
--> file:///home/.rustup/toolchains/1.82/lib/rustlib/src/rust/library/core/src/option.rs:571:1
11+
|
12+
571 | pub enum Option<T> {
13+
| ^^^^^^^^^^^^^^^^^^
14+
...
15+
575 | None,
16+
| ---- not covered
17+
= note: the matched value is of type `Option<i32>`
1518
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
16-
|
17-
4 ~ Some(i) => Some(i + 1),
18-
5 ~ None => todo!(),
19-
|
19+
|
20+
4 ~ Some(i) => Some(i + 1),
21+
5 ~ None => todo!(),
22+
|
2023

2124
For more information about this error, try `rustc --explain E0004`.
2225
error: could not compile `enums` (bin "enums") due to 1 previous error

rustbook-en/listings/ch09-error-handling/listing-09-10/output.txt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,7 @@ help: consider adding return type
1313
|
1414
3 ~ fn main() -> Result<(), Box<dyn std::error::Error>> {
1515
4 | let greeting_file = File::open("hello.txt")?;
16-
5 +
17-
6 + Ok(())
18-
7 + }
16+
5 + Ok(())
1917
|
2018

2119
For more information about this error, try `rustc --explain E0277`.

rustbook-en/listings/ch15-smart-pointers/output-only-01-comparing-to-reference/output.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@ error[E0277]: can't compare `{integer}` with `&{integer}`
88
|
99
= help: the trait `PartialEq<&{integer}>` is not implemented for `{integer}`
1010
= note: this error originates in the macro `assert_eq` (in Nightly builds, run with -Z macro-backtrace for more info)
11+
help: consider dereferencing here
12+
--> file:///home/.rustup/toolchains/1.82/lib/rustlib/src/rust/library/core/src/macros/mod.rs:46:35
13+
|
14+
46| if !(*left_val == **right_val) {
15+
| +
1116

1217
For more information about this error, try `rustc --explain E0277`.
1318
error: could not compile `deref-example` (bin "deref-example") due to 1 previous error
Lines changed: 26 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,34 @@
11
$ cargo run
22
Compiling shared-state v0.1.0 (file:///projects/shared-state)
33
error[E0277]: `Rc<Mutex<i32>>` cannot be sent between threads safely
4-
--> src/main.rs:11:36
5-
|
6-
11 | let handle = thread::spawn(move || {
7-
| ------------- ^------
8-
| | |
9-
| ______________________|_____________within this `{closure@src/main.rs:11:36: 11:43}`
10-
| | |
11-
| | required by a bound introduced by this call
12-
12 | | let mut num = counter.lock().unwrap();
13-
13 | |
14-
14 | | *num += 1;
15-
15 | | });
16-
| |_________^ `Rc<Mutex<i32>>` cannot be sent between threads safely
17-
|
18-
= help: within `{closure@src/main.rs:11:36: 11:43}`, the trait `Send` is not implemented for `Rc<Mutex<i32>>`, which is required by `{closure@src/main.rs:11:36: 11:43}: Send`
4+
--> src/main.rs:11:36
5+
|
6+
11 | let handle = thread::spawn(move || {
7+
| ------------- ^------
8+
| | |
9+
| ______________________|_____________within this `{closure@src/main.rs:11:36: 11:43}`
10+
| | |
11+
| | required by a bound introduced by this call
12+
12 | | let mut num = counter.lock().unwrap();
13+
13 | |
14+
14 | | *num += 1;
15+
15 | | });
16+
| |_________^ `Rc<Mutex<i32>>` cannot be sent between threads safely
17+
|
18+
= help: within `{closure@src/main.rs:11:36: 11:43}`, the trait `Send` is not implemented for `Rc<Mutex<i32>>`, which is required by `{closure@src/main.rs:11:36: 11:43}: Send`
1919
note: required because it's used within this closure
20-
--> src/main.rs:11:36
21-
|
22-
11 | let handle = thread::spawn(move || {
23-
| ^^^^^^^
20+
--> src/main.rs:11:36
21+
|
22+
11 | let handle = thread::spawn(move || {
23+
| ^^^^^^^
2424
note: required by a bound in `spawn`
25-
--> /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/std/src/thread/mod.rs:688:1
25+
--> file:///home/.rustup/toolchains/1.82/lib/rustlib/src/rust/library/std/src/thread/mod.rs:675:8
26+
|
27+
672 | pub fn spawn<F, T>(f: F) -> JoinHandle<T>
28+
| ----- required by a bound in this function
29+
...
30+
675 | F: Send + 'static,
31+
| ^^^^ required by this bound in `spawn`
2632

2733
For more information about this error, try `rustc --explain E0277`.
2834
error: could not compile `shared-state` (bin "shared-state") due to 1 previous error

0 commit comments

Comments
 (0)