Skip to content

Commit b81ef72

Browse files
committed
update original
1 parent 657918c commit b81ef72

101 files changed

Lines changed: 3163 additions & 2765 deletions

File tree

Some content is hidden

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

rustbook-en/ci/dictionary.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,7 @@ eprintln
168168
Erlang
169169
ErrorKind
170170
Español
171+
ETAPS
171172
eval
172173
executables
173174
ExitCode
@@ -624,6 +625,7 @@ wasi
624625
wasn
625626
weakt
626627
WeatherForecast
628+
webpage
627629
WebSocket
628630
whitespace
629631
wildcard

rustbook-en/listings/ch11-writing-automated-tests/no-listing-10-result-in-tests/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ pub fn add(left: u64, right: u64) -> u64 {
22
left + right
33
}
44

5+
// ANCHOR: here
56
#[cfg(test)]
67
mod tests {
78
use super::*;
89

9-
// ANCHOR: here
1010
#[test]
1111
fn it_works() -> Result<(), String> {
1212
let result = add(2, 2);
@@ -17,5 +17,5 @@ mod tests {
1717
Err(String::from("two plus two does not equal four"))
1818
}
1919
}
20-
// ANCHOR_END: here
2120
}
21+
// ANCHOR_END: here

rustbook-en/listings/ch15-smart-pointers/listing-15-14/output.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ $ cargo run
22
Compiling drop-example v0.1.0 (file:///projects/drop-example)
33
Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.60s
44
Running `target/debug/drop-example`
5-
CustomSmartPointers created.
5+
CustomSmartPointers created
66
Dropping CustomSmartPointer with data `other stuff`!
77
Dropping CustomSmartPointer with data `my stuff`!

rustbook-en/listings/ch15-smart-pointers/listing-15-14/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,5 @@ fn main() {
1515
let d = CustomSmartPointer {
1616
data: String::from("other stuff"),
1717
};
18-
println!("CustomSmartPointers created.");
18+
println!("CustomSmartPointers created");
1919
}

rustbook-en/listings/ch15-smart-pointers/listing-15-15/src/main.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ fn main() {
1313
let c = CustomSmartPointer {
1414
data: String::from("some data"),
1515
};
16-
println!("CustomSmartPointer created.");
16+
println!("CustomSmartPointer created");
1717
c.drop();
18-
println!("CustomSmartPointer dropped before the end of main.");
18+
println!("CustomSmartPointer dropped before the end of main");
1919
}
2020
// ANCHOR_END: here

rustbook-en/listings/ch15-smart-pointers/listing-15-16/output.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ $ cargo run
22
Compiling drop-example v0.1.0 (file:///projects/drop-example)
33
Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.73s
44
Running `target/debug/drop-example`
5-
CustomSmartPointer created.
5+
CustomSmartPointer created
66
Dropping CustomSmartPointer with data `some data`!
7-
CustomSmartPointer dropped before the end of main.
7+
CustomSmartPointer dropped before the end of main

rustbook-en/listings/ch15-smart-pointers/listing-15-16/src/main.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ fn main() {
1313
let c = CustomSmartPointer {
1414
data: String::from("some data"),
1515
};
16-
println!("CustomSmartPointer created.");
16+
println!("CustomSmartPointer created");
1717
drop(c);
18-
println!("CustomSmartPointer dropped before the end of main.");
18+
println!("CustomSmartPointer dropped before the end of main");
1919
}
2020
// ANCHOR_END: here

rustbook-en/listings/ch15-smart-pointers/listing-15-25/src/main.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// ANCHOR: here
12
use crate::List::{Cons, Nil};
23
use std::cell::RefCell;
34
use std::rc::Rc;
@@ -16,5 +17,6 @@ impl List {
1617
}
1718
}
1819
}
20+
// ANCHOR_END: here
1921

2022
fn main() {}

rustbook-en/nostarch/appendix.md

Lines changed: 112 additions & 110 deletions
Large diffs are not rendered by default.

rustbook-en/nostarch/appendix_a.md

Lines changed: 53 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -10,62 +10,62 @@ directory, so all fixes need to be made in `/src/`.
1010

1111
The following lists contain keywords that are reserved for current or future
1212
use by the Rust language. As such, they cannot be used as identifiers (except
13-
as raw identifiers, as we’ll discuss in “Raw Identifiers” on page XX).
14-
*Identifiers* are names of functions, variables, parameters, struct fields,
15-
modules, crates, constants, macros, static values, attributes, types, traits,
16-
or lifetimes.
13+
as raw identifiers, as we discuss in the “Raw
14+
Identifiers” section). *Identifiers* are names
15+
of functions, variables, parameters, struct fields, modules, crates, constants,
16+
macros, static values, attributes, types, traits, or lifetimes.
1717

18-
## Keywords Currently in Use
18+
### Keywords Currently in Use
1919

2020
The following is a list of keywords currently in use, with their functionality
2121
described.
2222

23-
* **`as` **: perform primitive casting, disambiguate the specific trait
24-
containing an item, or rename items in `use` statements
25-
* **`async` **: return a `Future` instead of blocking the current thread
26-
* **`await` **: suspend execution until the result of a `Future` is ready
27-
* **`break` **: exit a loop immediately
28-
* **`const` **: define constant items or constant raw pointers
29-
* **`continue` **: continue to the next loop iteration
30-
* **`crate` **: in a module path, refers to the crate root
31-
* **`dyn` **: dynamic dispatch to a trait object
32-
* **`else` **: fallback for `if` and `if let` control flow constructs
33-
* **`enum` **: define an enumeration
34-
* **`extern` **: link an external function or variable
35-
* **`false` **: Boolean false literal
36-
* **`fn` **: define a function or the function pointer type
37-
* **`for` **: loop over items from an iterator, implement a trait, or specify a
38-
higher-ranked lifetime
39-
* **`if` **: branch based on the result of a conditional expression
40-
* **`impl` **: implement inherent or trait functionality
41-
* **`in` **: part of `for` loop syntax
42-
* **`let` **: bind a variable
43-
* **`loop` **: loop unconditionally
44-
* **`match` **: match a value to patterns
45-
* **`mod` **: define a module
46-
* **`move` **: make a closure take ownership of all its captures
47-
* **`mut` **: denote mutability in references, raw pointers, or pattern bindings
48-
* **`pub` **: denote public visibility in struct fields, `impl` blocks, or
49-
modules
50-
* **`ref` **: bind by reference
51-
* **`return` **: return from function
52-
* **`Self` **: a type alias for the type we are defining or implementing
53-
* **`self` **: method subject or current module
54-
* **`static` **: global variable or lifetime lasting the entire program
55-
execution
56-
* **`struct` **: define a structure
57-
* **`super` **: parent module of the current module
58-
* **`trait` **: define a trait
59-
* **`true` **: Boolean true literal
60-
* **`type` **: define a type alias or associated type
61-
* **`union` **: define a union; is a keyword only when used in a union
62-
declaration
63-
* **`unsafe` **: denote unsafe code, functions, traits, or implementations
64-
* **`use` **: bring symbols into scope
65-
* **`where` **: denote clauses that constrain a type
66-
* **`while` **: loop conditionally based on the result of an expression
67-
68-
## Keywords Reserved for Future Use
23+
* **`as`**: Perform primitive casting, disambiguate the specific trait
24+
containing an item, or rename items in `use` statements.
25+
* **`async`**: Return a `Future` instead of blocking the current thread.
26+
* **`await`**: Suspend execution until the result of a `Future` is ready.
27+
* **`break`**: Exit a loop immediately.
28+
* **`const`**: Define constant items or constant raw pointers.
29+
* **`continue`**: Continue to the next loop iteration.
30+
* **`crate`**: In a module path, refers to the crate root.
31+
* **`dyn`**: Dynamic dispatch to a trait object.
32+
* **`else`**: Fallback for `if` and `if let` control flow constructs.
33+
* **`enum`**: Define an enumeration.
34+
* **`extern`**: Link an external function or variable.
35+
* **`false`**: Boolean false literal.
36+
* **`fn`**: Define a function or the function pointer type.
37+
* **`for`**: Loop over items from an iterator, implement a trait, or specify a
38+
higher ranked lifetime.
39+
* **`if`**: Branch based on the result of a conditional expression.
40+
* **`impl`**: Implement inherent or trait functionality.
41+
* **`in`**: Part of `for` loop syntax.
42+
* **`let`**: Bind a variable.
43+
* **`loop`**: Loop unconditionally.
44+
* **`match`**: Match a value to patterns.
45+
* **`mod`**: Define a module.
46+
* **`move`**: Make a closure take ownership of all its captures.
47+
* **`mut`**: Denote mutability in references, raw pointers, or pattern bindings.
48+
* **`pub`**: Denote public visibility in struct fields, `impl` blocks, or
49+
modules.
50+
* **`ref`**: Bind by reference.
51+
* **`return`**: Return from function.
52+
* **`Self`**: A type alias for the type we are defining or implementing.
53+
* **`self`**: Method subject or current module.
54+
* **`static`**: Global variable or lifetime lasting the entire program
55+
execution.
56+
* **`struct`**: Define a structure.
57+
* **`super`**: Parent module of the current module.
58+
* **`trait`**: Define a trait.
59+
* **`true`**: Boolean true literal.
60+
* **`type`**: Define a type alias or associated type.
61+
* **`union`**: Define a union; is a keyword only when
62+
used in a union declaration.
63+
* **`unsafe`**: Denote unsafe code, functions, traits, or implementations.
64+
* **`use`**: Bring symbols into scope.
65+
* **`where`**: Denote clauses that constrain a type.
66+
* **`while`**: Loop conditionally based on the result of an expression.
67+
68+
### Keywords Reserved for Future Use
6969

7070
The following keywords do not yet have any functionality but are reserved by
7171
Rust for potential future use:
@@ -75,6 +75,7 @@ Rust for potential future use:
7575
* `box`
7676
* `do`
7777
* `final`
78+
* `gen`
7879
* `macro`
7980
* `override`
8081
* `priv`
@@ -84,7 +85,7 @@ Rust for potential future use:
8485
* `virtual`
8586
* `yield`
8687

87-
## Raw Identifiers
88+
### Raw Identifiers
8889

8990
*Raw identifiers* are the syntax that lets you use keywords where they wouldn’t
9091
normally be allowed. You use a raw identifier by prefixing a keyword with `r#`.

0 commit comments

Comments
 (0)