Skip to content

Commit 66ef2b6

Browse files
Merge branch 'main' into patch-1
2 parents 26f571b + 6f0b1a8 commit 66ef2b6

File tree

310 files changed

+7855
-17989
lines changed

Some content is hidden

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

310 files changed

+7855
-17989
lines changed

.git-blame-ignore-revs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Ran dprint fmt on the repo
2+
3a30e4c1fbe641afc066b3af9eb01dcdf5ed8b24

.github/workflows/main.yml

Lines changed: 8 additions & 14 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,17 +47,13 @@ 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
55-
- name: Run `mdbook-trpl-note` package tests
56-
working-directory: packages/mdbook-trpl-note
57-
run: |
58-
cargo test
59-
- name: Run `mdbook-trpl-listing` package tests
60-
working-directory: packages/mdbook-trpl-listing
55+
- name: Run `mdbook-trpl` package tests
56+
working-directory: packages/mdbook-trpl
6157
run: |
6258
cargo test
6359
lint:
@@ -77,10 +73,8 @@ jobs:
7773
mkdir bin
7874
curl -sSL https://github.com/rust-lang/mdBook/releases/download/v0.4.21/mdbook-v0.4.21-x86_64-unknown-linux-gnu.tar.gz | tar -xz --directory=bin
7975
echo "$(pwd)/bin" >> "${GITHUB_PATH}"
80-
- name: Install mdbook-trpl-note
81-
run: cargo install --path packages/mdbook-trpl-note
82-
- name: Install mdbook-trpl-listing
83-
run: cargo install --path packages/mdbook-trpl-listing
76+
- name: Install mdbook-trpl binaries
77+
run: cargo install --path packages/mdbook-trpl
8478
- name: Install aspell
8579
run: sudo apt-get install aspell
8680
- name: Install shellcheck

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,5 @@ target
66
tmp
77

88
.nova
9+
.vscode
10+
.zed

2018-edition/src/ch17-03-oo-design-patterns.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
The 2018 edition of the book is no longer distributed with Rust's documentation.
44

55
If you came here via a link or web search, you may want to check out [the current
6-
version of the book](../ch19-03-oo-design-patterns.html) instead.
6+
version of the book](../ch18-03-oo-design-patterns.html) instead.
77

88
If you have an internet connection, you can [find a copy distributed with
99
Rust

ADMIN_TASKS.md

Lines changed: 23 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ occasional maintenance tasks.
1414
does)
1515
- Inspect the changes (by looking at the files changed according to git) and
1616
their effects (by looking at the files in `tmp/book-before` and
17-
`tmp/book-after`) and commit them if they look good
17+
`tmp/book-after`) and commit them if they look good
1818
- Grep for `manual-regeneration` and follow the instructions in those places to
1919
update output that cannot be generated by a script
2020

@@ -36,9 +36,8 @@ create a new release artifact, for example if there have been code changes due
3636
to edits or due to updating Rust and `rustfmt`, do the following:
3737

3838
- Create a git tag for the release and push it to GitHub, or create a new tag
39-
by going to the GitHub UI, [drafting a new
40-
release](https://github.com/rust-lang/book/releases/new), and entering a new
41-
tag instead of selecting an existing tag
39+
by going to the GitHub UI, [drafting a new release](https://github.com/rust-lang/book/releases/new), and entering a new
40+
tag instead of selecting an existing tag
4241
- Run `cargo run --bin release_listings`, which will generate
4342
`tmp/listings.tar.gz`
4443
- Upload `tmp/listings.tar.gz` in the GitHub UI for the draft release
@@ -54,50 +53,50 @@ extracted into a file. To do that:
5453
- Find where the new listing should go in the `listings` directory.
5554
- There is one subdirectory for each chapter
5655
- Numbered listings should use `listing-[chapter num]-[listing num]` for
57-
their directory names.
56+
their directory names.
5857
- Listings without a number should start with `no-listing-` followed by a
59-
number that indicates its position in the chapter relative to the other
60-
listings without numbers in the chapter, then a short description that
61-
someone could read to find the code they're looking for.
58+
number that indicates its position in the chapter relative to the other
59+
listings without numbers in the chapter, then a short description that
60+
someone could read to find the code they're looking for.
6261
- Listings used only for displaying the output of the code (for example, when
63-
we say "if we had written x instead of y, we would get this compiler
64-
error:" but we don't actually show code x) should be named with
65-
`output-only-` followed by a number that indicates its position in the
66-
chapter relative to the other listings used only for output, then a short
67-
description that authors or contributors could read to find the code
68-
they're looking for.
62+
we say "if we had written x instead of y, we would get this compiler
63+
error:" but we don't actually show code x) should be named with
64+
`output-only-` followed by a number that indicates its position in the
65+
chapter relative to the other listings used only for output, then a short
66+
description that authors or contributors could read to find the code
67+
they're looking for.
6968
- **Remember to adjust surrounding listing numbers as appropriate!**
7069
- Create a full Cargo project in that directory, either by using `cargo new` or
7170
copying another listing as a starting point.
7271
- Add the code and any surrounding code needed to create a full working example.
7372
- If you only want to show part of the code in the file, use anchor comments
7473
(`// ANCHOR: some_tag` and `// ANCHOR_END: some_tag`) to mark the parts of
75-
the file you want to show.
74+
the file you want to show.
7675
- For Rust code, use the `{{#rustdoc_include [filename:some_tag]}}` directive
7776
within the code blocks in the text. The `rustdoc_include` directive gives the
78-
code that doesn't get displayed to `rustdoc` for `mdbook test` purposes.
77+
code that doesn't get displayed to `rustdoc` for `mdbook test` purposes.
7978
- For anything else, use the `{{#include [filename:some_tag]}}` directive.
8079
- If you want to display the output of a command in the text as well, create an
8180
`output.txt` file in the listing's directory as follows:
8281
- Run the command, like `cargo run` or `cargo test`, and copy all of the
83-
output.
82+
output.
8483
- Create a new `output.txt` file with the first line `$ [the command you
8584
ran]`.
8685
- Paste the output you just copied.
8786
- Run `./tools/update-rustc.sh`, which should perform some normalization on
88-
the compiler output.
87+
the compiler output.
8988
- Include the output in the text with the `{{#include [filename]}}` directive.
9089
- Add and commit output.txt.
9190
- If you want to display output but for some reason it can't be generated by a
9291
script (say, because of user input or external events like making a web
93-
request), keep the output inline but make a comment that contains
94-
`manual-regeneration` and instructions for manually updating the inline
95-
output.
92+
request), keep the output inline but make a comment that contains
93+
`manual-regeneration` and instructions for manually updating the inline
94+
output.
9695
- If you don't want this example to even be attempted to be formatted by
9796
`rustfmt` (for example because the example doesn't parse on purpose), add a
98-
`rustfmt-ignore` file in the listing's directory and the reason it's not
99-
being formatted as the contents of that file (in case it's a rustfmt bug that
100-
might get fixed someday).
97+
`rustfmt-ignore` file in the listing's directory and the reason it's not
98+
being formatted as the contents of that file (in case it's a rustfmt bug that
99+
might get fixed someday).
101100

102101
## See the effect of some change on the rendered book
103102

CONTRIBUTING.md

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,35 @@ of the print version. The snapshot files reflect what has been sent or not, so
1111
they only get updated when edits are sent to No Starch. **Do not submit pull
1212
requests changing files in the `nostarch` directory, they will be closed.**
1313

14+
We use [`rustfmt`][rustfmt] to apply standard formatting to Rust code in the
15+
repo and [`dprint`][dprint] to apply standing formatting to the Markdown source
16+
and the non-Rust code in the project.
17+
18+
[rustfmt]: https://github.com/rust-lang/rustfmt
19+
[dprint]: https://dprint.dev
20+
21+
You will normally have `rustfmt` installed if you have a Rust toolchain
22+
installed; if for some reason you do not have a copy of `rustfmt`, you can add
23+
it by running the following command:
24+
25+
```sh
26+
rustup component add rustfmt
27+
```
28+
29+
To install `dprint`, you can run the following command:
30+
31+
```sh
32+
cargo install dprint
33+
```
34+
35+
Or follow the [instructions][install-dprint] on the `dprint` website.
36+
37+
[install-dprint]: https://dprint.dev/install/
38+
39+
To format Rust code, you can run `rustfmt <path to file>`, and to format other
40+
files, you can pass `dprint <path to file>`. Many text editors also have native
41+
support or extensions for both `rustfmt` and `dprint`.
42+
1443
## Checking for Fixes
1544

1645
The book rides the Rust release trains. Therefore, if you see a problem on
@@ -45,8 +74,7 @@ or pull request.
4574

4675
[nostarch]: https://nostarch.com/rust-programming-language-2nd-edition
4776

48-
So far, we've been doing a larger revision to coincide with [Rust
49-
Editions](https://doc.rust-lang.org/edition-guide/). Between those larger
77+
So far, we've been doing a larger revision to coincide with [Rust Editions](https://doc.rust-lang.org/edition-guide/). Between those larger
5078
revisions, we will only be correcting errors. If your issue or pull request
5179
isn't strictly fixing an error, it might sit until the next time that we're
5280
working on a large revision: expect on the order of months or years. Thank you

Cargo.toml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,6 @@ exclude = [
66
"linkchecker", # linkchecker is part of the CI workflow
77
"listings", # these are intentionally distinct from the workspace
88
"tmp", # listings are built here when updating output via tools/update-rustc.sh
9-
"packages/trpl", # manages its own dependencies as a standalone crate
10-
11-
# These are used as path dependencies in `rust-lang/rust` (since we are not
12-
# publishing them to crates.io), so they cannot be part of this workspace,
13-
# because path dependencies do not get built as a crate within the hosting
14-
# workspace.
15-
"packages/mdbook-trpl-listing",
16-
"packages/mdbook-trpl-note",
179
]
1810

1911
[workspace.dependencies]

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,11 @@ $ cargo install mdbook --locked --version <version_num>
3535

3636
The book also uses two mdbook plugins which are part of this repository. If you
3737
do not install them, you will see warnings when building and the output will not
38-
look right, but you *will* still be able to build the book. To use the plugins,
38+
look right, but you _will_ still be able to build the book. To use the plugins,
3939
you should run:
4040

4141
```bash
42-
$ cargo install --locked --path packages/mdbook-trpl-listing
43-
$ cargo install --locked --path packages/mdbook-trpl-note
42+
$ cargo install --locked --path packages/mdbook-trpl
4443
```
4544

4645
## Building
@@ -55,6 +54,7 @@ The output will be in the `book` subdirectory. To check it out, open it in
5554
your web browser.
5655

5756
_Firefox:_
57+
5858
```bash
5959
$ firefox book/index.html # Linux
6060
$ open -a "Firefox" book/index.html # OS X
@@ -63,6 +63,7 @@ $ start firefox.exe .\book\index.html # Windows (Cmd)
6363
```
6464

6565
_Chrome:_
66+
6667
```bash
6768
$ google-chrome book/index.html # Linux
6869
$ open -a "Google Chrome" book/index.html # OS X
@@ -89,8 +90,7 @@ to keep the online version of the book close to the print version when
8990
possible, it may take longer than you're used to for us to address your issue
9091
or pull request.
9192

92-
So far, we've been doing a larger revision to coincide with [Rust
93-
Editions](https://doc.rust-lang.org/edition-guide/). Between those larger
93+
So far, we've been doing a larger revision to coincide with [Rust Editions](https://doc.rust-lang.org/edition-guide/). Between those larger
9494
revisions, we will only be correcting errors. If your issue or pull request
9595
isn't strictly fixing an error, it might sit until the next time that we're
9696
working on a large revision: expect on the order of months or years. Thank you

ci/dictionary.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ BTreeSet
6161
BufRead
6262
BufReader
6363
BuildHasher
64+
byteorder
6465
Cacher
6566
cacher
6667
Cagain
@@ -104,6 +105,7 @@ CustomSmartPointer
104105
CustomSmartPointers
105106
data's
106107
DataStruct
108+
dbea
107109
deallocate
108110
deallocated
109111
deallocating
@@ -162,6 +164,7 @@ Enums
162164
eprintln
163165
Erlang
164166
ErrorKind
167+
Español
165168
eval
166169
executables
167170
ExitCode
@@ -309,6 +312,8 @@ microcontroller
309312
microcontrollers
310313
millis
311314
minigrep
315+
Miri
316+
miri
312317
mixup
313318
mkdir
314319
MockMessenger
@@ -388,6 +393,7 @@ PendingReviewPost
388393
PlaceholderType
389394
polymorphism
390395
PoolCreationError
396+
por
391397
portia
392398
postfix
393399
powershell
@@ -454,6 +460,7 @@ RUSTFLAGS
454460
Rustonomicon
455461
rustfix
456462
rustfmt
463+
RustLangES
457464
rustup
458465
sampleproject
459466
screenshot
@@ -566,6 +573,7 @@ Uncomment
566573
uncommenting
567574
unevaluated
568575
unhandled
576+
unicode
569577
Uninstalling
570578
uninstall
571579
unittests
@@ -598,6 +606,7 @@ Vlissides
598606
vscode
599607
vtable
600608
waitlist
609+
wasi
601610
wasn
602611
weakt
603612
WeatherForecast
@@ -616,4 +625,5 @@ WriteMessage
616625
xcode
617626
xpression
618627
yyyy
628+
zerocopy
619629
ZipImpl

dprint.jsonc

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
{
2+
"typescript": {
3+
},
4+
"json": {
5+
},
6+
"markdown": {
7+
},
8+
"malva": {
9+
},
10+
"excludes": [
11+
"**/node_modules",
12+
"**/*-lock.json",
13+
"**/target",
14+
// We don’t to apply auto-formatting to this *yet*, at a minimum. It may be
15+
// helpful as a way of replacing some of the manual formatting we do in both
16+
// the nostarch script and the script for pulling data back over from docx,
17+
// though, so we may *start* doing so in the future.
18+
"nostarch",
19+
// These should never change at this point
20+
"2018-edition",
21+
"first-edition",
22+
"second-edition",
23+
"redirects",
24+
// has empty list items which look like headings to a formatter
25+
".github/ISSUE_TEMPLATE/bug_report.md",
26+
],
27+
"plugins": [
28+
"https://plugins.dprint.dev/typescript-0.93.3.wasm",
29+
"https://plugins.dprint.dev/json-0.19.4.wasm",
30+
"https://plugins.dprint.dev/markdown-0.17.8.wasm",
31+
"https://plugins.dprint.dev/g-plane/malva-v0.11.0.wasm",
32+
],
33+
}

0 commit comments

Comments
 (0)