Skip to content

Commit e66adf6

Browse files
authored
Improve contributor experience for the dev-guide itself (#973)
- Fix typos in the README - Don't echo all instructions in the linkcheck.sh shellscript; this is noisy and unhelpful when developing locally. Verbose output is still enabled in CI. - Link to the index page for compiler docs, not `rustc_middle`. Note that the compiler docs are not a guide - that's us! - Remove outdated instructions about avoiding 429s. These should no longer be occurring locally now that we're using caching. - Consolidate info about `mdbook` and `mdbook-linkcheck` near each other
1 parent 59de3a0 commit e66adf6

File tree

2 files changed

+14
-57
lines changed

2 files changed

+14
-57
lines changed

README.md

Lines changed: 11 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,10 @@ some new part of the compiler that they haven't worked on before.
99
[You can read the latest version of the guide here.](https://rustc-dev-guide.rust-lang.org/)
1010

1111
You may also find the rustdocs [for the compiler itself][rustdocs] useful.
12+
Note that these are not intended as a guide; it's recommended that you search
13+
for the docs you're looking for instead of reading them top to bottom.
1214

13-
[rustdocs]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/
15+
[rustdocs]: https://doc.rust-lang.org/nightly/nightly-rustc
1416

1517
### Contributing to the guide
1618

@@ -35,37 +37,10 @@ rustdocs][rustdocs].
3537

3638
### Build Instructions
3739

38-
Deactivate the CI testing link validations by commenting out the `[output.linkcheck]` field in the `book.toml` configuration file like this:
39-
40-
```toml
41-
[book]
42-
title = "Guide to Rustc Development"
43-
author = "Rustc developers"
44-
description = "A guide to developing rustc"
45-
46-
[build]
47-
create-missing = false
48-
49-
[output.html]
50-
git-repository-url = "https://github.com/rust-lang/rustc-dev-guide"
51-
52-
[output.html.fold]
53-
enable = true
54-
level = 1
55-
56-
# [output.linkcheck]
57-
# follow-web-links = false
58-
# exclude = [ "crates\\.io", "gcc\\.godbolt\\.org", "youtube\\.com", "youtu\\.be", "dl\\.acm\\.org", "cs\\.bgu\\.ac\\.il" ]
59-
# cache-timeout = 172800
60-
# warning-policy = "error"
61-
```
62-
63-
These validations can cause errors during local builds (see Link Validations section below). Please **do not** commit these `book.toml` file changes when you submit a pull request.
64-
6540
To build a local static HTML site, install [`mdbook`](https://github.com/rust-lang/mdBook) with:
6641

6742
```
68-
> cargo install mdbook
43+
> cargo install mdbook mdbook-linkcheck
6944
```
7045

7146
and execute the following command in the root of the repository:
@@ -76,6 +51,11 @@ and execute the following command in the root of the repository:
7651

7752
The build files are found in the `book` directory.
7853

54+
### Link Validations
55+
56+
We use `mdbook-linkcheck` to validate URLs included in our documentation.
57+
`linkcheck` will be run automatically when you build with the instructions in the section above.
58+
7959
### Pre-commit script
8060

8161
We also test that line lengths are less than 100 columns. To test this locally,
@@ -95,36 +75,11 @@ On Windows:
9575
New-Item -Path .git/hooks/pre-commit -ItemType HardLink -Value <absolute_path/to/check_line_lengths.sh>
9676
```
9777

98-
### Link Validations
99-
100-
We use `mdbook-linkcheck` to validate URLs included in our documentation. To perform link checks, uncomment the `[output.linkcheck]` field in the `book.toml` configuration file and install `mdbook-linkcheck` with:
101-
102-
```bash
103-
> cargo install mdbook-linkcheck
104-
```
105-
106-
You will need recent versions of `mdbook` and `mdbook-linkcheck` to check links.
107-
`linkcheck` will be run automatically when you build with the instructions in the section above.
108-
109-
**Please note**: You may receive errors like the following when link-checking is enabled on local `mdbook` builds:
110-
111-
```
112-
error: The server responded with 429 Too Many Requests for "https://github.com/rust-lang/rust/tree/master/src/tools/compiletest"
113-
114-
┌── tests/intro.md:6:1 ───
115-
116-
6 │ [`src/tools/compiletest`] directory). This section gives a brief
117-
│ ^ Server responded with 429 Too Many Requests
118-
```
119-
120-
There is not a workaround for this error at the moment. Comment out the `[output.linkcheck]` field in the `book.toml` using the build instructions above to complete a local site build without link validations.
121-
122-
12378
## How to fix toolstate failures
12479

12580
> **NOTE**: Currently, we do not track the rustc-dev-guide toolstate due to
126-
[the spurious failure](https://github.com/rust-lang/rust/pull/71731),
127-
but we leave this instructions for when we do it again in the future.
81+
[spurious failures](https://github.com/rust-lang/rust/pull/71731),
82+
but we leave these instructions for when we do it again in the future.
12883

12984
1. You will get a ping from the toolstate commit. e.g. https://github.com/rust-lang-nursery/rust-toolstate/commit/8ffa0e4c30ac9ba8546b7046e5c4ccc2b96ebdd4
13085

ci/linkcheck.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
#!/usr/bin/env bash
22

3-
set -ev
3+
set -e
44
set -o pipefail
55

66
# https://docs.travis-ci.com/user/environment-variables/#default-environment-variables
77
if [ "$TRAVIS_EVENT_TYPE" = "cron" ] ; then # running in cron job
88
FLAGS=""
99

1010
echo "Doing full link check."
11+
set -x
1112
elif [ "$CI" = "true" ] ; then # running in PR CI build
1213
if [ -z "$TRAVIS_COMMIT_RANGE" ]; then
1314
echo "error: unexpected state: TRAVIS_COMMIT_RANGE must be non-empty in CI"
@@ -18,6 +19,7 @@ elif [ "$CI" = "true" ] ; then # running in PR CI build
1819
FLAGS="--no-cache -f $CHANGED_FILES"
1920

2021
echo "Checking files changed in $TRAVIS_COMMIT_RANGE: $CHANGED_FILES"
22+
set -x
2123
else # running locally
2224
COMMIT_RANGE=master...
2325
CHANGED_FILES=$(git diff --name-only $COMMIT_RANGE | tr '\n' ' ')

0 commit comments

Comments
 (0)