Skip to content

Make sure to rebuild rustdoc if src/rustdoc-json-types is changed #142758

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jieyouxu
Copy link
Member

@jieyouxu jieyouxu commented Jun 19, 2025

I think rustdoc-json-types was more recently split out, so this download-rustc logic became outdated as it wasn't tracked. This PR adds src/rustdoc-json-types to be tracked for difference versus upstream, so that we properly rebuild rustdoc if it has changes versus upstream.

Fixes #142738.

Local testing

This is not so easy to test locally because it requires download-rustc. To test this, you need to:

  1. Disable download-rustc inhibition from bootstrap changes versus upstream, by including :!src/bootstrap in
    pub const RUSTC_IF_UNCHANGED_ALLOWED_PATHS: &[&str] = &[
    ":!library",
    ":!src/tools",
    ":!src/librustdoc",
    ":!src/rustdoc-json-types",
    ":!tests",
    ":!triagebot.toml",
    ];
    .
  2. Then, use a config like profile = "tools" which by default uses download-rustc = "if-unchanged".
  3. Run ./x test tests/rustdoc-json one time, to "prime" initial build caches.
  4. Change the FORMAT_VERSION in src/rustdoc-json-types, i.e.
    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;
  5. Observe that without this patch, rustdoc-json tests fail because FORMAT_VERSION mismatch. Observe that with this patch, rustdoc gets properly rebuilt and rustdoc-json tests pass.

cc @aDotInTheVoid

r? Kobzol

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) labels Jun 19, 2025
@aDotInTheVoid
Copy link
Member

Thanks ❤️!

I think rustdoc-json-types was more recently split out

It's been around for ages (#81287), I think this was hidden for so longer because modifying rustdoc-json-types without also modifying librustdoc doesn't make much sense.

@Kobzol
Copy link
Contributor

Kobzol commented Jun 20, 2025

@bors r+ rollup

@bors
Copy link
Collaborator

bors commented Jun 20, 2025

📌 Commit fca6e81 has been approved by Kobzol

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jun 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bootstrap: Chaning src/rustdoc-json-types doesn't rebuild rustdoc
5 participants