Skip to content

doc: don't use mergeable info and json together - #17336

Merged
weihanglo merged 2 commits into
rust-lang:masterfrom
notriddle:json-merge
Aug 8, 2026
Merged

doc: don't use mergeable info and json together#17336
weihanglo merged 2 commits into
rust-lang:masterfrom
notriddle:json-merge

Conversation

@notriddle

Copy link
Copy Markdown
Contributor

It doesn't do anything, and Cargo doesn't do its fingerprint metadata correctly in this mode.

Fixes a bug we found while working on enabling this feature for the standard library: rust-lang/rust#160724 (comment)

  • I did not use an LLM to create a change in this PR.

@rustbot rustbot added A-build-execution Area: anything dealing with executing the compiler A-layout Area: target output directory layout, naming, and organization Command-doc S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Aug 7, 2026
@rustbot

rustbot commented Aug 7, 2026

Copy link
Copy Markdown
Collaborator

r? @weihanglo

rustbot has assigned @weihanglo.
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: @epage, @weihanglo
  • @epage, @weihanglo expanded to epage, weihanglo
  • Random selection from epage, weihanglo

@weihanglo weihanglo Aug 7, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you walk me through the failure rust-lang/rust#160724 (comment)?

I guess bootstrap pass -Zrustdoc-mergeable-info unconditionally when generating rustdoc JSON, but why?

View changes since the review

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here's the log output around where this is failing. The crash, and the failure, are in Cargo, not Rustdoc. https://triage.rust-lang.org/gha-logs/rust-lang/rust/92954202748#L2026-08-07T20:23:47.1415288Z

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems like bootstrap passes -Zrustdoc-mergeable-info to the JSON doc build because that's the same target it uses for HTML docs. https://github.com/rust-lang/rust/blob/49c80b5a0db8abd63315c04ff34f58629e388281/src/bootstrap/src/core/build_steps/doc.rs#L666-L670

Comment thread src/compiler/mod.rs
// html-non-static-files is required for keeping the original rustdoc emission
let mut arg = if build_runner.bcx.gctx.cli_unstable().rustdoc_mergeable_info {
let mut arg = if wants_json_output {
OsString::from("--emit=dep-info=")

@weihanglo weihanglo Aug 8, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is an issue in rustdoc blocking this: rust-lang/rust#158869. I think this would produce zero JSON output with -Zrustdoc-depinfo.

A bit surprised we didn't have a test catching it.

View changes since the review

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right. That's not working.

To fix it, I think rustdoc needs changed. It was already broken before, though, so can we keep going?

Comment thread tests/testsuite/doc.rs

@weihanglo weihanglo Aug 8, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would you mind following C-TEST so the first commit serves as a repro. In the second commit, the git diff of the snapshot shows the bheavior change.

View changes since the review

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@camelid

camelid commented Aug 8, 2026

Copy link
Copy Markdown
Member

I wonder if Rustdoc should error if output-format json and mergeable info (ie read doc meta or write doc meta) are requested simultaneously. Although long term we'll want to use mergeable metadata with json too I imagine.

@weihanglo

Copy link
Copy Markdown
Member

None of them are blockers btw. Let me know if you want to address or we just merge as-is.

It doesn't do anything, and Cargo doesn't do its fingerprint metadata
correctly in this mode.
@notriddle
notriddle force-pushed the json-merge branch 2 times, most recently from 19e959a to 0b8ea94 Compare August 8, 2026 05:23

@weihanglo weihanglo left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@weihanglo
weihanglo added this pull request to the merge queue Aug 8, 2026
Merged via the queue into rust-lang:master with commit b99aa3e Aug 8, 2026
29 checks passed
@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Aug 8, 2026
@notriddle
notriddle deleted the json-merge branch August 8, 2026 15:55
rust-bors Bot pushed a commit to rust-lang/rust that referenced this pull request Aug 11, 2026
Update cargo submodule

10 commits in b07e5a08651da80108eb65d7dc769ee04589f9bf..eb98b54bc9f3c74519f43d066cb3fd02ebc88df0
2026-08-07 21:51:16 +0000 to 2026-08-11 16:00:29 +0000
- feat(trim-paths): honor workspace prefix override from env (rust-lang/cargo#17349)
- fix(clean): respect target with --doc (rust-lang/cargo#17322)
- chore(renovate): Use a 3day minimum release age (rust-lang/cargo#17346)
- test: Handle non-deterministic compilation order (rust-lang/cargo#17347)
- docs(ref): Add missing config env variables (rust-lang/cargo#17345)
- fix(trim-paths): workspace remap under -Zroot-dir (rust-lang/cargo#17337)
- Fix funding link (rust-lang/cargo#17344)
- fix(trim-paths): `/cargo/deps` fallback sources  (rust-lang/cargo#17338)
- doc: don't use mergeable info and json together (rust-lang/cargo#17336)
- docs: document --output-format for cargo doc (rust-lang/cargo#17325)
@rustbot rustbot added this to the 1.99.0 milestone Aug 12, 2026
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 Command-doc

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants