Skip to content

bootstrap: Chaning src/rustdoc-json-types doesn't rebuild rustdoc #142738

@aDotInTheVoid

Description

@aDotInTheVoid
Member

Summary

Changing src/rustdoc-json-types doesn't always rebuild rustdoc.

jsondoclint checks that the value of Crate::format_version is the thing it expects from it's path dependency on
rustdoc_json_types

assert_eq!(krate.format_version, FORMAT_VERSION);

If src/rustdoc-json-types is changed, jsondoclint gets rebuilt when rustdoc doesn't, causing test failures.

Command used

$ ./x clean
Building bootstrap
    Finished `dev` profile [unoptimized] target(s) in 0.06s
Build completed successfully in 0:00:01
$ git diff # no output
$ ./x test ./tests/rustdoc-json/
# tests pass

Then modify src/rustdoc-json-types/lib.rs to bump the FORMAT_VERSION

diff --git a/src/rustdoc-json-types/lib.rs b/src/rustdoc-json-types/lib.rs
index 1f93895ae07..72a3720c7b4 100644
--- a/src/rustdoc-json-types/lib.rs
+++ b/src/rustdoc-json-types/lib.rs
@@ -38,7 +38,7 @@
 // are deliberately not in a doc comment, because they need not be in public docs.)
 //
 // Latest feature: Pretty printing of inline attributes changed
-pub const FORMAT_VERSION: u32 = 48;
+pub const FORMAT_VERSION: u32 = 666;

 /// The root of the emitted JSON blob.
 ///

Then trying the tests again fails:

$ ./x test ./tests/rustdoc-json/nested.rs --force-rerun
Building bootstrap
    Finished `dev` profile [unoptimized] target(s) in 0.14s
/home/gh-aDotInTheVoid/rust3/build/aarch64-unknown-linux-gnu/ci-llvm/bin/llvm-strip does not exist; skipping copy
Creating a sysroot for stage2 compiler (use `rustup toolchain link 'name' build/host/stage2`)
Building stage0 tool compiletest (aarch64-unknown-linux-gnu)
    Finished `release` profile [optimized] target(s) in 0.18s
Building stage0 tool jsondocck (aarch64-unknown-linux-gnu)
    Finished `release` profile [optimized] target(s) in 0.16s
Building stage0 tool jsondoclint (aarch64-unknown-linux-gnu)
   Compiling rustdoc-json-types v0.1.0 (/home/gh-aDotInTheVoid/rust3/src/rustdoc-json-types)
   Compiling jsondoclint v0.1.0 (/home/gh-aDotInTheVoid/rust3/src/tools/jsondoclint)
    Finished `release` profile [optimized] target(s) in 9.46s
Testing stage2 compiletest suite=rustdoc-json mode=rustdoc-json (aarch64-unknown-linux-gnu)

running 1 tests

[rustdoc-json] tests/rustdoc-json/nested.rs ... F


failures:

---- [rustdoc-json] tests/rustdoc-json/nested.rs stdout ----

error: jsondoclint failed!
status: exit status: 101
command: "/home/gh-aDotInTheVoid/rust3/build/aarch64-unknown-linux-gnu/stage0-tools-bin/jsondoclint" "/home/gh-aDotInTheVoid/rust3/build/aarch64-unknown-linux-gnu/test/rustdoc-json/nested/nested.json"
stdout: none
--- stderr -------------------------------

thread 'main' panicked at src/tools/jsondoclint/src/main.rs:57:5:
assertion `left == right` failed
  left: 48
 right: 666
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
------------------------------------------



failures:
    [rustdoc-json] tests/rustdoc-json/nested.rs

test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 164 filtered out; finished in 436.19ms

Some tests failed in compiletest suite=rustdoc-json mode=rustdoc-json host=aarch64-unknown-linux-gnu target=aarch64-unknown-linux-gnu
Build completed unsuccessfully in 0:00:11

jsondoclint has been rebuilt, but rustdoc hasn't, so they disagree on the format version.

Expected behaviour

Changes to src/rustdoc-json-types, a path dependency of src/librustdoc, cause rustdoc to be rebuilt.

Actual behaviour

See §Command used. rustdoc doesn't get rebuilt.

Bootstrap configuration (bootstrap.toml)

profile = "tools"
change-id = "ignore"

[rust]
deny-warnings = false

Operating system

Ubuntu 24.04.1 LTS (Noble Numbat)

HEAD

8de4c72

Additional context

Running touch ./src/librustdoc/lib.rs works around this. Historically, all changes to rustdoc-json-types also needed rustdoc changes, so this was unlikely to be ran into.

Build Log

gh-aDotInTheVoid@dev-desktop-eu-1:~/rust3$ ./x clean
Building bootstrap
   Compiling build_helper v0.1.0 (/home/gh-aDotInTheVoid/rust3/src/build_helper)
   Compiling bootstrap v0.0.0 (/home/gh-aDotInTheVoid/rust3/src/bootstrap)
    Finished `dev` profile [unoptimized] target(s) in 17.83s
WARNING: The `change-id` is missing in the `bootstrap.toml`. This means that you will not be able to track the major changes made to the bootstrap configurations.
NOTE: to silence this warning, add `change-id = 142379` or `change-id = "ignore"` at the top of `bootstrap.toml`
Updating submodule library/backtrace
remote: Enumerating objects: 21, done.
remote: Counting objects: 100% (21/21), done.
remote: Compressing objects: 100% (2/2), done.
remote: Total 11 (delta 9), reused 10 (delta 9), pack-reused 0 (from 0)
Unpacking objects: 100% (11/11), 2.41 KiB | 822.00 KiB/s, done.
From https://github.com/rust-lang/backtrace-rs
 + 57c7529...b65ab93 master     -> origin/master  (forced update)
Submodule path 'library/backtrace': checked out 'b65ab935fb2e0d59dba8966ffca09c9cc5a5f57c'
downloading https://ci-artifacts.rust-lang.org/rustc-builds/2fcf1776b9ccef89993dfe40e9f5c4908e2d2d48/rust-std-nightly-aarch64-unknown-linux-gnu.tar.xz
############################################################################################################################################## 100.0%
extracting /home/gh-aDotInTheVoid/rust3/build/cache/2fcf1776b9ccef89993dfe40e9f5c4908e2d2d48-false/rust-std-nightly-aarch64-unknown-linux-gnu.tar.xz to /home/gh-aDotInTheVoid/rust3/build/aarch64-unknown-linux-gnu/ci-rustc
downloading https://ci-artifacts.rust-lang.org/rustc-builds/2fcf1776b9ccef89993dfe40e9f5c4908e2d2d48/rustc-nightly-aarch64-unknown-linux-gnu.tar.xz
############################################################################################################################################## 100.0%
extracting /home/gh-aDotInTheVoid/rust3/build/cache/2fcf1776b9ccef89993dfe40e9f5c4908e2d2d48-false/rustc-nightly-aarch64-unknown-linux-gnu.tar.xz to /home/gh-aDotInTheVoid/rust3/build/aarch64-unknown-linux-gnu/ci-rustc
downloading https://ci-artifacts.rust-lang.org/rustc-builds/2fcf1776b9ccef89993dfe40e9f5c4908e2d2d48/rustc-dev-nightly-aarch64-unknown-linux-gnu.tar.xz
############################################################################################################################################## 100.0%
extracting /home/gh-aDotInTheVoid/rust3/build/cache/2fcf1776b9ccef89993dfe40e9f5c4908e2d2d48-false/rustc-dev-nightly-aarch64-unknown-linux-gnu.tar.xz to /home/gh-aDotInTheVoid/rust3/build/aarch64-unknown-linux-gnu/ci-rustc
WARNING: The `change-id` is missing in the `bootstrap.toml`. This means that you will not be able to track the major changes made to the bootstrap configurations.
NOTE: to silence this warning, add `change-id = 142379` or `change-id = "ignore"` at the top of `bootstrap.toml`
NOTE: this message was printed twice to make it more likely to be seen
Build completed successfully in 0:01:02

gh-aDotInTheVoid@dev-desktop-eu-1:/rust3$ ./x clean
Building bootstrap
Finished dev profile [unoptimized] target(s) in 0.06s
Build completed successfully in 0:00:01
gh-aDotInTheVoid@dev-desktop-eu-1:
/rust3$ git diff
gh-aDotInTheVoid@dev-desktop-eu-1:~/rust3$ ./x test ./tests/rustdoc-json/
extracting /home/gh-aDotInTheVoid/rust3/build/cache/2025-05-26/rust-std-beta-aarch64-unknown-linux-gnu.tar.xz
extracting /home/gh-aDotInTheVoid/rust3/build/cache/2025-05-26/rustc-beta-aarch64-unknown-linux-gnu.tar.xz
extracting /home/gh-aDotInTheVoid/rust3/build/cache/2025-05-26/cargo-beta-aarch64-unknown-linux-gnu.tar.xz
Building bootstrap
Compiling proc-macro2 v1.0.89
Compiling unicode-ident v1.0.13
Compiling libc v0.2.172
Compiling memchr v2.7.4
Compiling version_check v0.9.5
Compiling typenum v1.17.0
Compiling shlex v1.3.0
Compiling serde v1.0.215
Compiling rustix v1.0.7
Compiling regex-syntax v0.8.5
Compiling crossbeam-utils v0.8.20
Compiling cfg-if v1.0.0
Compiling bitflags v2.6.0
Compiling pkg-config v0.3.31
Compiling linux-raw-sys v0.9.3
Compiling anstyle v1.0.10
Compiling heck v0.5.0
Compiling clap_lex v0.7.2
Compiling log v0.4.22
Compiling serde_json v1.0.132
Compiling same-file v1.0.6
Compiling semver v1.0.23
Compiling ryu v1.0.18
Compiling bootstrap v0.0.0 (/home/gh-aDotInTheVoid/rust3/src/bootstrap)
Compiling itoa v1.0.11
Compiling home v0.5.9
Compiling termcolor v1.4.1
Compiling walkdir v2.5.0
Compiling cc v1.2.23
Compiling clap_builder v4.5.20
Compiling generic-array v0.14.7
Compiling aho-corasick v1.1.3
Compiling object v0.36.5
Compiling crossbeam-epoch v0.9.18
Compiling quote v1.0.37
Compiling crossbeam-deque v0.8.5
Compiling syn v2.0.87
Compiling cmake v0.1.54
Compiling cpufeatures v0.2.15
Compiling filetime v0.2.25
Compiling lzma-sys v0.1.20
Compiling regex-automata v0.4.9
Compiling block-buffer v0.10.4
Compiling crypto-common v0.1.6
Compiling digest v0.10.7
Compiling sha2 v0.10.8
Compiling xattr v1.5.0
Compiling fd-lock v4.0.4
Compiling tar v0.4.43
Compiling toml v0.5.11
Compiling clap_derive v4.5.18
Compiling serde_derive v1.0.215
Compiling bstr v1.10.0
Compiling globset v0.4.15
Compiling opener v0.5.2
Compiling ignore v0.4.23
Compiling clap v4.5.20
Compiling clap_complete v4.5.37
Compiling xz2 v0.1.7
Compiling build_helper v0.1.0 (/home/gh-aDotInTheVoid/rust3/src/build_helper)
Finished dev profile [unoptimized] target(s) in 21.81s
extracting /home/gh-aDotInTheVoid/rust3/build/cache/2025-05-27/rustfmt-nightly-aarch64-unknown-linux-gnu.tar.xz to /home/gh-aDotInTheVoid/rust3/build/aarch64-unknown-linux-gnu/rustfmt
extracting /home/gh-aDotInTheVoid/rust3/build/cache/2025-05-27/rustc-nightly-aarch64-unknown-linux-gnu.tar.xz to /home/gh-aDotInTheVoid/rust3/build/aarch64-unknown-linux-gnu/rustfmt
extracting /home/gh-aDotInTheVoid/rust3/build/cache/2fcf1776b9ccef89993dfe40e9f5c4908e2d2d48-false/rust-std-nightly-aarch64-unknown-linux-gnu.tar.xz to /home/gh-aDotInTheVoid/rust3/build/aarch64-unknown-linux-gnu/ci-rustc
extracting /home/gh-aDotInTheVoid/rust3/build/cache/2fcf1776b9ccef89993dfe40e9f5c4908e2d2d48-false/rustc-nightly-aarch64-unknown-linux-gnu.tar.xz to /home/gh-aDotInTheVoid/rust3/build/aarch64-unknown-linux-gnu/ci-rustc
extracting /home/gh-aDotInTheVoid/rust3/build/cache/2fcf1776b9ccef89993dfe40e9f5c4908e2d2d48-false/rustc-dev-nightly-aarch64-unknown-linux-gnu.tar.xz to /home/gh-aDotInTheVoid/rust3/build/aarch64-unknown-linux-gnu/ci-rustc
extracting /home/gh-aDotInTheVoid/rust3/build/cache/llvm-55d436467c351b56253deeba209ae2553d1c243f-false/rust-dev-nightly-aarch64-unknown-linux-gnu.tar.xz to /home/gh-aDotInTheVoid/rust3/build/aarch64-unknown-linux-gnu/ci-llvm
/home/gh-aDotInTheVoid/rust3/build/aarch64-unknown-linux-gnu/ci-llvm/bin/llvm-strip does not exist; skipping copy
Creating a sysroot for stage2 compiler (use rustup toolchain link 'name' build/host/stage2)
Building stage0 tool compiletest (aarch64-unknown-linux-gnu)
Compiling proc-macro2 v1.0.95
Compiling unicode-ident v1.0.18
Compiling crossbeam-utils v0.8.21
Compiling cfg-if v1.0.1
Compiling serde v1.0.219
Compiling memchr v2.7.5
Compiling autocfg v1.4.0
Compiling libc v0.2.174
Compiling parking_lot_core v0.9.11
Compiling once_cell v1.21.3
Compiling lazy_static v1.5.0
Compiling smallvec v1.15.1
Compiling pin-project-lite v0.2.16
Compiling serde_json v1.0.140
Compiling scopeguard v1.2.0
Compiling regex-syntax v0.8.5
Compiling rayon-core v1.12.1
Compiling regex-syntax v0.6.29
Compiling thiserror v1.0.69
Compiling semver v1.0.26
Compiling camino v1.1.10
Compiling utf8-width v0.1.7
Compiling ryu v1.0.20
Compiling utf8parse v0.2.2
Compiling itoa v1.0.15
Compiling anstyle v1.0.11
Compiling unicode-width v0.2.1
Compiling overload v0.1.1
Compiling diff v0.1.13
Compiling equivalent v1.0.2
Compiling same-file v1.0.6
Compiling hashbrown v0.15.4
Compiling sharded-slab v0.1.7
Compiling thread_local v1.1.9
Compiling nu-ansi-term v0.46.0
Compiling html-escape v0.2.13
Compiling either v1.15.0
Compiling colored v2.2.0
Compiling home v0.5.11
Compiling miropt-test-tools v0.1.0 (/home/gh-aDotInTheVoid/rust3/src/tools/miropt-test-tools)
Compiling anstyle-parse v0.2.7
Compiling walkdir v2.5.0
Compiling glob v0.3.2
Compiling tracing-core v0.1.30
Compiling anstyle-lossy v1.1.4
Compiling unified-diff v0.2.1
Compiling getopts v0.2.23
Compiling lock_api v0.4.13
Compiling aho-corasick v1.1.3
Compiling quote v1.0.40
Compiling indexmap v2.9.0
Compiling crossbeam-epoch v0.9.18
Compiling anstyle-svg v0.1.8
Compiling syn v2.0.103
Compiling crossbeam-deque v0.8.6
Compiling parking_lot v0.12.4
Compiling rayon v1.10.0
Compiling regex-automata v0.1.10
Compiling regex-automata v0.4.9
Compiling matchers v0.1.0
Compiling serde_derive v1.0.219
Compiling tracing-attributes v0.1.29
Compiling thiserror-impl v1.0.69
Compiling regex v1.11.1
Compiling tracing v0.1.37
Compiling tracing-subscriber v0.3.18
Compiling build_helper v0.1.0 (/home/gh-aDotInTheVoid/rust3/src/build_helper)
Compiling rustfix v0.8.1
Compiling compiletest v0.0.0 (/home/gh-aDotInTheVoid/rust3/src/tools/compiletest)
Finished release profile [optimized] target(s) in 18.71s
Building stage0 tool jsondocck (aarch64-unknown-linux-gnu)
Compiling thiserror v2.0.12
Compiling memchr v2.7.5
Compiling ucd-trie v0.1.7
Compiling serde v1.0.219
Compiling once_cell v1.21.3
Compiling shlex v1.3.0
Compiling fs-err v2.11.0
Compiling syn v2.0.103
Compiling aho-corasick v1.1.3
Compiling regex-automata v0.4.9
Compiling thiserror-impl v2.0.12
Compiling pest v2.8.0
Compiling serde_json v1.0.140
Compiling pest_meta v2.8.0
Compiling regex v1.11.1
Compiling pest_generator v2.8.0
Compiling pest_derive v2.8.0
Compiling jsonpath-rust v1.0.2
Compiling jsondocck v0.1.0 (/home/gh-aDotInTheVoid/rust3/src/tools/jsondocck)
Finished release profile [optimized] target(s) in 11.58s
Building stage0 tool jsondoclint (aarch64-unknown-linux-gnu)
Compiling anstyle-query v1.1.3
Compiling is_terminal_polyfill v1.70.1
Compiling colorchoice v1.0.4
Compiling clap_lex v0.7.5
Compiling heck v0.5.0
Compiling strsim v0.11.1
Compiling anyhow v1.0.98
Compiling rustc-hash v2.1.1
Compiling syn v2.0.103
Compiling anstream v0.6.19
Compiling clap_builder v4.5.40
Compiling serde_derive v1.0.219
Compiling clap_derive v4.5.40
Compiling clap v4.5.40
Compiling serde v1.0.219
Compiling rustdoc-json-types v0.1.0 (/home/gh-aDotInTheVoid/rust3/src/rustdoc-json-types)
Compiling serde_json v1.0.140
Compiling jsondoclint v0.1.0 (/home/gh-aDotInTheVoid/rust3/src/tools/jsondoclint)
Finished release profile [optimized] target(s) in 17.42s
Testing stage2 compiletest suite=rustdoc-json mode=rustdoc-json (aarch64-unknown-linux-gnu)

running 165 tests
........................................................................................ 88/165
.............i..iiiiiii......................i...............................

test result: ok. 156 passed; 0 failed; 9 ignored; 0 measured; 0 filtered out; finished in 2.55s

Build completed successfully in 0:02:23
gh-aDotInTheVoid@dev-desktop-eu-1:/rust3$ vim ./src/rustdoc-json-types/lib.rs
gh-aDotInTheVoid@dev-desktop-eu-1:
/rust3$ git diff
diff --git a/src/rustdoc-json-types/lib.rs b/src/rustdoc-json-types/lib.rs
index 1f93895ae07..72a3720c7b4 100644
--- a/src/rustdoc-json-types/lib.rs
+++ b/src/rustdoc-json-types/lib.rs
@@ -38,7 +38,7 @@
// are deliberately not in a doc comment, because they need not be in public docs.)
//
// Latest feature: Pretty printing of inline attributes changed
-pub const FORMAT_VERSION: u32 = 48;
+pub const FORMAT_VERSION: u32 = 666;

/// The root of the emitted JSON blob.
///
gh-aDotInTheVoid@dev-desktop-eu-1:~/rust3$ ./x test ./tests/rustdoc-json/nested.rs --force-rerun
Building bootstrap
Finished dev profile [unoptimized] target(s) in 0.14s
/home/gh-aDotInTheVoid/rust3/build/aarch64-unknown-linux-gnu/ci-llvm/bin/llvm-strip does not exist; skipping copy
Creating a sysroot for stage2 compiler (use rustup toolchain link 'name' build/host/stage2)
Building stage0 tool compiletest (aarch64-unknown-linux-gnu)
Finished release profile [optimized] target(s) in 0.18s
Building stage0 tool jsondocck (aarch64-unknown-linux-gnu)
Finished release profile [optimized] target(s) in 0.16s
Building stage0 tool jsondoclint (aarch64-unknown-linux-gnu)
Compiling rustdoc-json-types v0.1.0 (/home/gh-aDotInTheVoid/rust3/src/rustdoc-json-types)
Compiling jsondoclint v0.1.0 (/home/gh-aDotInTheVoid/rust3/src/tools/jsondoclint)
Finished release profile [optimized] target(s) in 9.46s
Testing stage2 compiletest suite=rustdoc-json mode=rustdoc-json (aarch64-unknown-linux-gnu)

running 1 tests

[rustdoc-json] tests/rustdoc-json/nested.rs ... F

failures:

---- [rustdoc-json] tests/rustdoc-json/nested.rs stdout ----

error: jsondoclint failed!
status: exit status: 101
command: "/home/gh-aDotInTheVoid/rust3/build/aarch64-unknown-linux-gnu/stage0-tools-bin/jsondoclint" "/home/gh-aDotInTheVoid/rust3/build/aarch64-unknown-linux-gnu/test/rustdoc-json/nested/nested.json"
stdout: none
--- stderr -------------------------------

thread 'main' panicked at src/tools/jsondoclint/src/main.rs:57:5:
assertion left == right failed
left: 48
right: 666
note: run with RUST_BACKTRACE=1 environment variable to display a backtrace

failures:
[rustdoc-json] tests/rustdoc-json/nested.rs

test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 164 filtered out; finished in 436.19ms

Some tests failed in compiletest suite=rustdoc-json mode=rustdoc-json host=aarch64-unknown-linux-gnu target=aarch64-unknown-linux-gnu
Build completed unsuccessfully in 0:00:11
gh-aDotInTheVoid@dev-desktop-eu-1:~/rust3$



</p>
</details>

Activity

added
T-bootstrapRelevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)
C-bugCategory: This is a bug.
on Jun 19, 2025
added
needs-triageThis issue may need triage. Remove it if it has been sufficiently triaged.
on Jun 19, 2025
removed
needs-triageThis issue may need triage. Remove it if it has been sufficiently triaged.
on Jun 19, 2025
self-assigned this
on Jun 19, 2025
added 2 commits that reference this issue on Jun 20, 2025
833efa1
64a7fcf
added a commit that references this issue on Jun 20, 2025
fac1beb
added a commit that references this issue on Jun 23, 2025
2c8c5c8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

A-contributor-roadblockArea: Makes things more difficult for new or seasoned contributors to RustA-rustdoc-jsonArea: Rustdoc JSON backendC-bugCategory: This is a bug.T-bootstrapRelevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

    Participants

    @aDotInTheVoid@jieyouxu@rustbot

    Issue actions

      bootstrap: Chaning `src/rustdoc-json-types` doesn't rebuild `rustdoc` · Issue #142738 · rust-lang/rust