Skip to content

Commit f84bfea

Browse files
committed
Merge commit '3e9dc46aa563ca0c53ec826c41b05f10c5915925' into translations-2026
2 parents f8dc6b9 + 3e9dc46 commit f84bfea

13 files changed

Lines changed: 184 additions & 190 deletions

ci/dictionary.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1761,6 +1761,7 @@ memoization
17611761
metadata
17621762
Metadata
17631763
metaprogramming
1764+
metavariable
17641765
mibbit
17651766
Mibbit
17661767
microcontroller

nostarch/appendix.md

Lines changed: 35 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -183,8 +183,10 @@ Table B-1: Operators
183183
|`-`|`- expr`|Arithmetic negation|`Neg`|
184184
|`-`|`expr - expr`|Arithmetic subtraction|`Sub`|
185185
|`-=`|`var -= expr`|Arithmetic subtraction and assignment|`SubAssign`|
186-
|`->`|`fn(...) -> type`, <code>\|\| -> type</code>|Function and closure return type||
187-
|`.`|`expr.ident`|Member access||
186+
|`->`|`fn(...) -> type`, <code>\|...\| -> type</code>|Function and closure return type||
187+
|`.`|`expr.ident`|Field access||
188+
|`.`|`expr.ident(expr, ...)`|Method call||
189+
|`.`|`expr.0`, `expr.1`, etc.|Tuple indexing||
188190
|`..`|`..`, `expr..`, `..expr`, `expr..expr`|Right-exclusive range literal|`PartialOrd`|
189191
|`..=`|`..=expr`, `expr..=expr`|Right-inclusive range literal|`PartialOrd`|
190192
|`..`|`..expr`|Struct literal update syntax||
@@ -230,14 +232,14 @@ Table B-2: Stand-Alone Syntax
230232
|Symbol|Explanation|
231233
|------|-----------|
232234
|`'ident`|Named lifetime or loop label|
233-
|`...u8`, `...i32`, `...f64`, `...usize`, etc.|Numeric literal of specific type|
235+
|Digits immediately followed by `u8`, `i32`, `f64`, `usize`, and so on|Numeric literal of specific type|
234236
|`"..."`|String literal|
235237
|`r"..."`, `r#"..."#`, `r##"..."##`, etc.|Raw string literal, escape characters not processed|
236238
|`b"..."`|Byte string literal; constructs an array of bytes instead of a string|
237239
|`br"..."`, `br#"..."#`, `br##"..."##`, etc.|Raw byte string literal, combination of raw and byte string literal|
238240
|`'...'`|Character literal|
239241
|`b'...'`|ASCII byte literal|
240-
|<code>\|\| expr</code>|Closure|
242+
|<code>\|...\| expr</code>|Closure|
241243
|`!`|Always empty bottom type for diverging functions|
242244
|`_`|“Ignored” pattern binding; also used to make integer literals readable|
243245

@@ -298,8 +300,8 @@ Table B-6: Macros and Attributes
298300
|`#[meta]`|Outer attribute|
299301
|`#![meta]`|Inner attribute|
300302
|`$ident`|Macro substitution|
301-
|`$ident:kind`|Macro capture|
302-
|`$(…)…`|Macro repetition|
303+
|`$ident:kind`|Macro metavariable|
304+
|`$(...)...`|Macro repetition|
303305
|`ident!(...)`, `ident!{...}`, `ident![...]`|Macro invocation|
304306

305307
Table B-7 shows symbols that create comments.
@@ -315,9 +317,9 @@ Table B-7: Comments
315317
|`/*!...*/`|Inner block doc comment|
316318
|`/**...*/`|Outer block doc comment|
317319

318-
Table B-8 shows symbols that appear in the context of using tuples.
320+
Table B-8 shows the contexts in which parentheses are used.
319321

320-
Table B-8: Tuples
322+
Table B-8: Parentheses
321323

322324
|Symbol|Explanation|
323325
|------|-----------|
@@ -328,7 +330,6 @@ Table B-8: Tuples
328330
|`(expr, ...)`|Tuple expression|
329331
|`(type, ...)`|Tuple type|
330332
|`expr(expr, ...)`|Function call expression; also used to initialize tuple `struct`s and tuple `enum` variants|
331-
|`expr.0`, `expr.1`, etc.|Tuple indexing|
332333

333334
Table B-9 shows the contexts in which curly braces are used.
334335

@@ -337,7 +338,7 @@ Table B-9: Curly Brackets
337338
|Context|Explanation|
338339
|-------|-----------|
339340
|`{...}`|Block expression|
340-
|`Type {...}`|`struct` literal|
341+
|`Type {...}`|Struct literal|
341342

342343
Table B-10 shows the contexts in which square brackets are used.
343344

@@ -542,14 +543,11 @@ The `rustfmt` tool reformats your code according to the community code style.
542543
Many collaborative projects use `rustfmt` to prevent arguments about which
543544
style to use when writing Rust: everyone formats their code using the tool.
544545

545-
To install `rustfmt`, enter the following:
546-
547-
```
548-
$ rustup component add rustfmt
549-
```
550-
551-
This command gives you `rustfmt` and `cargo-fmt`, similar to how Rust gives you
552-
both `rustc` and `cargo`. To format any Cargo project, enter the following:
546+
Rust installations include `rustfmt` by default, so you should already have the
547+
programs `rustfmt` and `cargo-fmt` on your system. These two commands are
548+
analogous to `rustc` and `cargo` in that `rustfmt` allows finer-grained control
549+
and `cargo-fmt` understands conventions of a project that uses Cargo. To format
550+
any Cargo project, enter the following:
553551

554552
```
555553
$ cargo fmt
@@ -561,9 +559,9 @@ on `rustfmt`, see its documentation at *https://github.com/rust-lang/rustfmt*.
561559

562560
### Fix Your Code with rustfix
563561

564-
The rustfix tool is included with Rust installations and can automatically fix
562+
The `rustfix` tool is included with Rust installations and can automatically fix
565563
compiler warnings that have a clear way to correct the problem that’s likely
566-
what you want. It’s likely you’ve seen compiler warnings before. For example,
564+
what you want. You’ve probably seen compiler warnings before. For example,
567565
consider this code:
568566

569567
Filename: src/main.rs
@@ -575,8 +573,8 @@ fn main() {
575573
}
576574
```
577575

578-
Here, we’re defining variable `x` as mutable, but we never actually mutate it.
579-
Rust warns us about that:
576+
Here, we’re defining the variable `x` as mutable, but we never actually mutate
577+
it. Rust warns us about that:
580578

581579
```
582580
$ cargo build
@@ -614,21 +612,16 @@ fn main() {
614612
}
615613
```
616614

617-
The `x` variable is now immutable, and the warning no longer appears.
615+
The variable `x` is now immutable, and the warning no longer appears.
618616

619617
You can also use the `cargo fix` command to transition your code between
620618
different Rust editions. Editions are covered in Appendix E at *appendix-05-editions.md*.
621619

622620
### More Lints with Clippy
623621

624622
The Clippy tool is a collection of lints to analyze your code so you can catch
625-
common mistakes and improve your Rust code.
626-
627-
To install Clippy, enter the following:
628-
629-
```
630-
$ rustup component add clippy
631-
```
623+
common mistakes and improve your Rust code. Clippy is included with standard
624+
Rust installations.
632625

633626
To run Clippy’s lints on any Cargo project, enter the following:
634627

@@ -639,7 +632,7 @@ $ cargo clippy
639632
For example, say you write a program that uses an approximation of a
640633
mathematical constant, such as pi, as this program does:
641634

642-
Filename: src/main.rs
635+
src/main.rs
643636

644637
```
645638
fn main() {
@@ -649,6 +642,8 @@ fn main() {
649642
}
650643
```
651644

645+
646+
652647
Running `cargo clippy` on this project results in this error:
653648

654649
```
@@ -665,10 +660,11 @@ error: approximate value of `f{32, 64}::consts::PI` found
665660

666661
This error lets you know that Rust already has a more precise `PI` constant
667662
defined, and that your program would be more correct if you used the constant
668-
instead. You would then change your code to use the `PI` constant. The
669-
following code doesn’t result in any errors or warnings from Clippy:
663+
instead. You would then change your code to use the `PI` constant.
670664

671-
Filename: src/main.rs
665+
The following code doesn’t result in any errors or warnings from Clippy:
666+
667+
src/main.rs
672668

673669
```
674670
fn main() {
@@ -678,19 +674,21 @@ fn main() {
678674
}
679675
```
680676

677+
678+
681679
For more information on Clippy, see its documentation at *https://github.com/rust-lang/rust-clippy*.
682680

683681
### IDE Integration Using rust-analyzer
684682

685-
To help IDE integration, the Rust community recommends using
683+
To help with IDE integration, the Rust community recommends using
686684
`rust-analyzer`. This tool is a set of
687-
compiler-centric utilities that speaks the Language Server Protocol, which is a specification for IDEs and programming languages to
685+
compiler-centric utilities that speak Language Server Protocol, which is a specification for IDEs and programming languages to
688686
communicate with each other. Different clients can use `rust-analyzer`, such as
689687
the Rust analyzer plug-in for Visual Studio Code at *https://marketplace.visualstudio.com/items?itemName=rust-lang.rust-analyzer*.
690688

691689
Visit the `rust-analyzer` project’s home page
692690
for installation instructions, then install the language server support in your
693-
particular IDE. Your IDE will gain abilities such as autocompletion, jump to
691+
particular IDE. Your IDE will gain capabilities such as autocompletion, jump to
694692
definition, and inline errors.
695693

696694
## Appendix E - Editions

nostarch/appendix_b.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,10 @@ type | |
4646
| `-` | `- expr` | Arithmetic negation | `Neg` |
4747
| `-` | `expr - expr` | Arithmetic subtraction | `Sub` |
4848
| `-=` | `var -= expr` | Arithmetic subtraction and assignment | `SubAssign` |
49-
| `->` | `fn(...) -> type`, `|| -> type` | Function and closure return type |
50-
|
51-
| `. | `expr.ident` | Member access | |
49+
| `->` | `fn(...) -> type`, `|...| -> type` | Function and closure return type | |
50+
| `.` | `expr.ident` | Field access | |
51+
| `.` | `expr.ident(expr, ...)` | Method call | |
52+
| `.` | `expr.0`, `expr.1`, etc. | Tuple indexing | |
5253
| `..` | `..`, `expr..`, `..expr`, `expr..expr` | Right-exclusive range literal
5354
| `PartialOrd` |
5455
| `..=` | `..=expr`, `expr..=expr` | Right-inclusive range literal |
@@ -98,8 +99,8 @@ Table B-2: Stand-Alone Syntax
9899
| Symbol | Explanation |
99100
|---|---|
100101
| `'ident` | Named lifetime or loop label |
101-
| `...u8`, `...i32`, `...f64`, `...usize`, and so on | Numeric literal of
102-
specific type |
102+
| Digits immediately followed by `u8`, `i32`, `f64`, `usize`, and so on |
103+
Numeric literal of specific type |
103104
| `"..."` | String literal |
104105
| `r"..."`, `r#"..."#`, `r##"..."##`, and so on | Raw string literal; escape
105106
characters not processed |
@@ -109,7 +110,7 @@ string |
109110
combination of raw and byte string literal |
110111
| `'...'` | Character literal |
111112
| `b'...'` | ASCII byte literal |
112-
| `|| expr` | Closure |
113+
| `|...| expr` | Closure |
113114
| `!` | Always-empty bottom type for diverging functions |
114115
| `_` | “Ignored” pattern binding; also used to make integer literals readable |
115116

@@ -164,7 +165,7 @@ Table B-5: Trait Bound Constraints
164165

165166
| Symbol | Explanation |
166167
|---|---|
167-
| T: U` | Generic parameter `T` constrained to types that implement `U` |
168+
| `T: U` | Generic parameter `T` constrained to types that implement `U` |
168169
| `T: 'a` | Generic type `T` must outlive lifetime `'a` (meaning the type
169170
cannot transitively contain any references with lifetimes shorter than `'a`) |
170171
| `T: 'static` | Generic type `T` contains no borrowed references other than
@@ -183,8 +184,8 @@ Table B-6: Macros and Attributes
183184
| `#[meta]` | Outer attribute |
184185
| `#![meta]` | Inner attribute |
185186
| `$ident` | Macro substitution |
186-
| `$ident:kind` | Macro capture |
187-
| `$(…)…` | Macro repetition |
187+
| `$ident:kind` | Macro metavariable |
188+
| `$(...)...` | Macro repetition |
188189
| `ident!(...)`, `ident!{...}`, `ident![...]` | Macro invocation |
189190

190191
Table B-7 shows symbols that create comments.
@@ -200,9 +201,9 @@ Table B-7: Comments
200201
| `/*!...*/` | Inner block doc comment |
201202
| `/**...*/` | Outer block doc comment |
202203

203-
Table B-8 shows symbols that appear in the context of using tuples.
204+
Table B-8 shows the contexts in which parentheses are used.
204205

205-
Table B-8: Tuples
206+
Table B-8: Parentheses
206207

207208
| Symbol | Explanation |
208209
|---|---|
@@ -214,7 +215,6 @@ Table B-8: Tuples
214215
| `(type, ...)` | Tuple type |
215216
| `expr(expr, ...)` | Function call expression; also used to initialize tuple
216217
`struct`s and tuple `enum` variants |
217-
| `expr.0`, `expr.1`, and so on | Tuple indexing |
218218

219219
Table B-9 shows the contexts in which curly brackets are used.
220220

@@ -223,7 +223,7 @@ Table B-9: Curly Brackets
223223
| Context | Explanation |
224224
|---|---|
225225
| `{...}` | Block expression |
226-
| `Type {...}` | `struct` literal |
226+
| `Type {...}` | Struct literal |
227227

228228
Table B-10 shows the contexts in which square brackets are used.
229229

nostarch/appendix_d.md

Lines changed: 18 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ style to use when writing Rust: everyone formats their code using the tool.
2020

2121
Rust installations include `rustfmt` by default, so you should already have the
2222
programs `rustfmt` and `cargo-fmt` on your system. These two commands are
23-
analagous to `rustc` and `cargo` in that `rustfmt` allows finer-grained control
23+
analogous to `rustc` and `cargo` in that `rustfmt` allows finer-grained control
2424
and `cargo-fmt` understands conventions of a project that uses Cargo. To format
2525
any Cargo project, enter the following:
2626

@@ -42,34 +42,30 @@ example, consider this code:
4242
Filename: src/main.rs
4343

4444
```
45-
fn do_something() {}
46-
4745
fn main() {
48-
for i in 0..100 {
49-
do_something();
50-
}
46+
let mut x = 42;
47+
println!("{x}");
5148
}
5249
```
5350

54-
Here, we’re calling the `do_something` function 100 times, but we never use the
55-
variable `i` in the body of the `for` loop. Rust warns us about that:
51+
Here, we’re defining the variable `x` as mutable, but we never actually mutate
52+
it. Rust warns us about that:
5653

5754
```
5855
$ cargo build
5956
Compiling myprogram v0.1.0 (file:///projects/myprogram)
60-
warning: unused variable: `i`
61-
--> src/main.rs:4:9
57+
warning: variable does not need to be mutable
58+
--> src/main.rs:2:9
6259
|
63-
4 | for i in 0..100 {
64-
| ^ help: consider using `_i` instead
60+
2 | let mut x = 0;
61+
| ----^
62+
| |
63+
| help: remove this `mut`
6564
|
66-
= note: #[warn(unused_variables)] on by default
67-
68-
Finished dev [unoptimized + debuginfo] target(s) in 0.50s
65+
= note: `#[warn(unused_mut)]` on by default
6966
```
7067

71-
The warning suggests that we use `_i` as a name instead: the underscore
72-
indicates that we intend for this variable to be unused. We can automatically
68+
The warning suggests that we remove the `mut` keyword. We can automatically
7369
apply that suggestion using the `rustfix` tool by running the command `cargo
7470
fix`:
7571

@@ -86,16 +82,13 @@ code:
8682
Filename: src/main.rs
8783

8884
```
89-
fn do_something() {}
90-
9185
fn main() {
92-
for _i in 0..100 {
93-
do_something();
94-
}
86+
let x = 42;
87+
println!("{x}");
9588
}
9689
```
9790

98-
The `for` loop variable is now named `_i`, and the warning no longer appears.
91+
The variable `x` is now immutable, and the warning no longer appears.
9992

10093
You can also use the `cargo fix` command to transition your code between
10194
different Rust editions. Editions are covered in Appendix E.
@@ -157,7 +150,7 @@ fn main() {
157150
```
158151

159152
For more information on Clippy, see its documentation at
160-
*https://github.com/rust-lang/rust-clippy**.*
153+
*https://github.com/rust-lang/rust-clippy*.
161154

162155
## IDE Integration Using rust-analyzer
163156

@@ -171,5 +164,5 @@ languages to communicate with each other. Different clients can use
171164
Visit the `rust-analyzer` project’s home page at
172165
*https://rust-analyzer.github.io* for installation instructions, then install
173166
the language server support in your particular IDE. Your IDE will gain
174-
capabilities such as autocompletion, jump to definition, and inline errors
167+
capabilities such as autocompletion, jump to definition, and inline errors.
175168

0 commit comments

Comments
 (0)