Skip to content

Commit 1c964f6

Browse files
authored
Fix a broken link and check internal links (#2195)
In #2153 I aimed to fix a link but broke it. In this PR, I fix it and add [`mdbook-linkcheck`](https://github.com/Michael-F-Bryan/mdbook-linkcheck) to avoid future cases. Some past fixes that could have been prevented, in addition to mine in this PR: * #811 * #2064 * #2146 Note: `mdbook-linkcheck` may also check external links with a configuration change. It can be beneficial to check also external links from time to time. I ran it here and found 3 broken links. Maintainers - sorry for the lack of a preceding issue. We can discuss it here. Some remaining work is to fix the outdated internal links in the translations, not done here. Let me know what you think about the proposed contribution. This PR completes #1502.
1 parent 16c4724 commit 1c964f6

File tree

13 files changed

+40
-21
lines changed

13 files changed

+40
-21
lines changed

.github/workflows/build.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,11 @@ jobs:
147147
MDBOOK_OUTPUT='{"xgettext": {"pot-file": "messages.pot"}}' mdbook build -d po
148148
msgfmt -o /dev/null --statistics po/messages.pot
149149
150+
- name: Install mdbook-linkcheck
151+
# Opt-in for checking links in translations - add the language below.
152+
if: contains(fromJSON('["en", ]'), matrix.language)
153+
run: cargo install mdbook-linkcheck --locked --version 0.7.7
154+
150155
- name: Build ${{ matrix.language }} translation
151156
run: |
152157
.github/workflows/build.sh ${{ matrix.language }} book/comprehensive-rust-${{ matrix.language }}

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,10 @@ The course is built using a few tools:
5353
- [mdbook-exerciser](mdbook-exerciser/)
5454
- [mdbook-course](mdbook-course/)
5555

56+
In addition,
57+
[mdbook-linkcheck](https://github.com/Michael-F-Bryan/mdbook-linkcheck) checks
58+
the internal links.
59+
5660
First install Rust by following the instructions on https://rustup.rs/. Then
5761
clone this repository:
5862

@@ -68,6 +72,7 @@ cargo install mdbook
6872
cargo install --locked mdbook-svgbob
6973
cargo install --locked mdbook-i18n-helpers
7074
cargo install --locked i18n-report
75+
cargo install --locked mdbook-linkcheck
7176
cargo install --locked --path mdbook-exerciser
7277
cargo install --locked --path mdbook-course
7378
```

book.toml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ linkcolor = "blue"
4646
urlcolor = "red"
4747

4848
[output.html]
49-
curly-quotes = true
49+
smart-punctuation = true
5050
additional-js = [
5151
"theme/speaker-notes.js",
5252
]
@@ -278,3 +278,12 @@ use-boolean-and = true
278278

279279
[output.exerciser]
280280
output-directory = "comprehensive-rust-exercises"
281+
282+
[output.linkcheck]
283+
optional = true
284+
follow-web-links = false # change to true to check web links
285+
exclude = [
286+
"comprehensive-rust.pdf",
287+
"comprehensive-rust-exercises.zip",
288+
# "crates.io", # uncomment when follow-web-links is true
289+
]

src/android/aidl/types/arrays.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ signature:
1313
<details>
1414

1515
- In Android 13 or higher, fixed-size arrays are supported, i.e. `T[N]` becomes
16-
`[T; N]`. Fixed-size arrays can have multiple dimensions (e.g. int[3][4]). In
17-
the Java backend, fixed-size arrays are represented as array types.
16+
`[T; N]`. Fixed-size arrays can have multiple dimensions (e.g. `int[3][4]`).
17+
In the Java backend, fixed-size arrays are represented as array types.
1818
- Arrays in parcelable fields always get translated to `Vec<T>`.
1919

2020
</details>

src/android/interoperability/with-c.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ fn main() {
1919
```
2020

2121
We already saw this in the
22-
[Safe FFI Wrapper exercise](../../exercises/day-3/safe-ffi-wrapper.md).
22+
[Safe FFI Wrapper exercise](../../unsafe-rust/exercise.md).
2323

2424
> This assumes full knowledge of the target platform. Not recommended for
2525
> production.

src/concurrency/async-exercises/dining-philosophers.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ minutes: 20
44

55
# Dining Philosophers --- Async
66

7-
See [dining philosophers](concurrency/sync-exercises/dining-philosophers.md) for
8-
a description of the problem.
7+
See [dining philosophers](../sync-exercises/dining-philosophers.md) for a
8+
description of the problem.
99

1010
As before, you will need a local
1111
[Cargo installation](../../cargo/running-locally.md) for this exercise. Copy the

src/concurrency/shared-state/mutex.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ minutes: 14
66

77
[`Mutex<T>`][1] ensures mutual exclusion _and_ allows mutable access to `T`
88
behind a read-only interface (another form of
9-
[interior mutability](../../borrowing/interior-mutability)):
9+
[interior mutability](../../borrowing/interior-mutability.md)):
1010

1111
```rust,editable
1212
use std::sync::Mutex;

src/glossary.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,16 @@ h1#glossary ~ ul > li:first-line {
2929
<!-- i18n:comment breaks to ensure a nice formatting. -->
3030

3131
- allocate:\
32-
Dynamic memory allocation on [the heap](memory-management/stack-vs-heap.md).
32+
Dynamic memory allocation on [the heap](memory-management/review.md).
3333
- argument:\
3434
Information that is passed into a function or method.
3535
- Bare-metal Rust:\
3636
Low-level Rust development, often deployed to a system without an operating
3737
system. See [Bare-metal Rust](bare-metal.md).
3838
- block:\
39-
See [Blocks](control-flow/blocks.md) and _scope_.
39+
See [Blocks](control-flow-basics/blocks-and-scopes.md) and _scope_.
4040
- borrow:\
41-
See [Borrowing](ownership/borrowing.md).
41+
See [Borrowing](borrowing/shared.md).
4242
- borrow checker:\
4343
The part of the Rust compiler which checks that all borrows are valid.
4444
- brace:\
@@ -55,7 +55,7 @@ h1#glossary ~ ul > li:first-line {
5555
- concurrency:\
5656
The execution of multiple tasks or processes at the same time.
5757
- Concurrency in Rust:\
58-
See [Concurrency in Rust](concurrency.md).
58+
See [Concurrency in Rust](concurrency/welcome.md).
5959
- constant:\
6060
A value that does not change during the execution of a program.
6161
- control flow:\
@@ -199,6 +199,6 @@ h1#glossary ~ ul > li:first-line {
199199
Type that holds no data, written as a tuple with no members.
200200
- unsafe:\
201201
The subset of Rust which allows you to trigger _undefined behavior_. See
202-
[Unsafe Rust](unsafe.html).
202+
[Unsafe Rust](unsafe-rust/unsafe.md).
203203
- variable:\
204204
A memory location storing data. Variables are valid in a _scope_.

src/index.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,10 @@ Building on this, you're invited to dive into one or more specialized topics:
3838
- [Bare-metal](bare-metal.md): a whole-day class on using Rust for bare-metal
3939
(embedded) development. Both microcontrollers and application processors are
4040
covered.
41-
- [Concurrency](concurrency.md): a whole-day class on concurrency in Rust. We
42-
cover both classical concurrency (preemptively scheduling using threads and
43-
mutexes) and async/await concurrency (cooperative multitasking using futures).
41+
- [Concurrency](concurrency/welcome.md): a whole-day class on concurrency in
42+
Rust. We cover both classical concurrency (preemptively scheduling using
43+
threads and mutexes) and async/await concurrency (cooperative multitasking
44+
using futures).
4445

4546
## Non-Goals
4647

src/other-resources.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ A small selection of other guides and tutorial for Rust:
3636

3737
- [Learn Rust the Dangerous Way](http://cliffle.com/p/dangerust/): covers Rust
3838
from the perspective of low-level C programmers.
39-
- [Rust for Embedded C Programmers](https://docs.opentitan.org/doc/ug/rust_for_c/):
39+
- [Rust for Embedded C Programmers](https://opentitan.org/book/doc/rust_for_c_devs.html):
4040
covers Rust from the perspective of developers who write firmware in C.
4141
- [Rust for professionals](https://overexact.com/rust-for-professionals/):
4242
covers the syntax of Rust using side-by-side comparisons with other languages

0 commit comments

Comments
 (0)