Skip to content

feat: rebuild(-ish) rustdoc json for different version of same crates#16773

Open
motorailgun wants to merge 2 commits intorust-lang:masterfrom
motorailgun:rustdoc-rebuild
Open

feat: rebuild(-ish) rustdoc json for different version of same crates#16773
motorailgun wants to merge 2 commits intorust-lang:masterfrom
motorailgun:rustdoc-rebuild

Conversation

@motorailgun
Copy link
Copy Markdown
Contributor

@motorailgun motorailgun commented Mar 20, 2026

Fix #16291.

What does this PR try to resolve?

As discussed in the linked issue, cargo rustdoc --output-format=json doesn't rebuild for same crate name but with different versions. This is because current cargo implementation around rustdoc only specifies output paths/names by only its crate names, but not with version(hash) info.

This PR forces new layout for json output, and uplift the file into backward-compatible place.

How to test and review this PR?

  • JSON file's path could just be doc/<crate-name>-<hash>.json as this option is still unstable.
  • Uplifting will always happen even if uplifted json is fresh, and/or new layout is manually specified. (could not figure out how to prevent)

@rustbot rustbot added A-build-execution Area: anything dealing with executing the compiler A-layout Area: target output directory layout, naming, and organization S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Mar 20, 2026
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Mar 20, 2026

r? @epage

rustbot has assigned @epage.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: @ehuss, @epage, @weihanglo
  • @ehuss, @epage, @weihanglo expanded to ehuss, epage, weihanglo
  • Random selection from ehuss, epage, weihanglo

@motorailgun motorailgun force-pushed the rustdoc-rebuild branch 2 times, most recently from a1ef71b to 04024f4 Compare March 21, 2026 02:47
@motorailgun motorailgun force-pushed the rustdoc-rebuild branch 2 times, most recently from be69519 to 2f32d53 Compare March 26, 2026 18:45
@motorailgun motorailgun requested a review from weihanglo March 26, 2026 19:15
@motorailgun
Copy link
Copy Markdown
Contributor Author

Updated to use new directory layout.

@rustbot

This comment has been minimized.

@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Apr 1, 2026

This PR was rebased onto a different master commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-build-execution Area: anything dealing with executing the compiler A-layout Area: target output directory layout, naming, and organization S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

cargo rustdoc --output-format=json sometimes doesn't rebuild for different versions of same crate name.

5 participants