about summary refs log tree commit diff
diff options
context:
space:
mode:
authorNoah Lev <camelidcamel@gmail.com>2024-12-30 01:22:22 -0800
committerGitHub <noreply@github.com>2024-12-30 17:22:22 +0800
commitcc9a6fa552069b0e69b6bfaa02cc39d2ee19625a (patch)
treeb57cde6f971e31e7381f186d9f0e83256da70fb9
parent6a8c200e6c4866bc5a80c9905916b8d875989c04 (diff)
downloadrust-cc9a6fa552069b0e69b6bfaa02cc39d2ee19625a.tar.gz
rust-cc9a6fa552069b0e69b6bfaa02cc39d2ee19625a.zip
Opt into, rather than out of, linkcheck (#2180)
This makes it less of a hassle to render the book locally.
-rw-r--r--src/doc/rustc-dev-guide/.github/workflows/ci.yml2
-rw-r--r--src/doc/rustc-dev-guide/README.md12
-rwxr-xr-xsrc/doc/rustc-dev-guide/ci/linkcheck.sh2
3 files changed, 9 insertions, 7 deletions
diff --git a/src/doc/rustc-dev-guide/.github/workflows/ci.yml b/src/doc/rustc-dev-guide/.github/workflows/ci.yml
index f7bfb77a33e..07c20d8d88b 100644
--- a/src/doc/rustc-dev-guide/.github/workflows/ci.yml
+++ b/src/doc/rustc-dev-guide/.github/workflows/ci.yml
@@ -57,7 +57,7 @@ jobs:
           cargo install mdbook-mermaid --version ${{ env.MDBOOK_MERMAID_VERSION }}
 
       - name: Check build
-        run: mdbook build
+        run: ENABLE_LINKCHECK=1 mdbook build
 
       - name: Deploy to gh-pages
         if: github.event_name == 'push'
diff --git a/src/doc/rustc-dev-guide/README.md b/src/doc/rustc-dev-guide/README.md
index d32d2386c9e..2a686b5471c 100644
--- a/src/doc/rustc-dev-guide/README.md
+++ b/src/doc/rustc-dev-guide/README.md
@@ -56,12 +56,14 @@ The build files are found in the `book/html` directory.
 
 ### Link Validations
 
-We use `mdbook-linkcheck2` to validate URLs included in our documentation.
-`linkcheck` will be run automatically when you build with the instructions in the section above.
+We use `mdbook-linkcheck2` to validate URLs included in our documentation. Link
+checking is **not** run by default locally, though it is in CI. To enable it
+locally, set the environment variable `ENABLE_LINKCHECK=1` like in the
+following example.
 
-> [!NOTE]
-> The link validation can be skipped by setting the following environment variable:
-> `SKIP_LINKCHECK=1 mdbook ...`
+```console
+$ ENABLE_LINKCHECK=1 mdbook serve
+```
 
 ### Table of Contents
 
diff --git a/src/doc/rustc-dev-guide/ci/linkcheck.sh b/src/doc/rustc-dev-guide/ci/linkcheck.sh
index 9b06f67fc9f..e5184839be0 100755
--- a/src/doc/rustc-dev-guide/ci/linkcheck.sh
+++ b/src/doc/rustc-dev-guide/ci/linkcheck.sh
@@ -9,7 +9,7 @@ set_github_token() {
   jq '.config.output.linkcheck."http-headers"."github\\.com" = ["Authorization: Bearer $GITHUB_TOKEN"]'
 }
 
-if [ ! -z "$SKIP_LINKCHECK" ] ; then
+if [ -z "$ENABLE_LINKCHECK" ] ; then
   echo "Skipping link check."
   exit 0
 fi