Skip to content

fix: stabilize -Zrustdoc-depinfo#17020

Draft
weihanglo wants to merge 1 commit into
rust-lang:masterfrom
weihanglo:rustdoc-depinfo
Draft

fix: stabilize -Zrustdoc-depinfo#17020
weihanglo wants to merge 1 commit into
rust-lang:masterfrom
weihanglo:rustdoc-depinfo

Conversation

@weihanglo
Copy link
Copy Markdown
Member

What does this PR try to resolve?

With this stabilization,
cargo doc unconditionally emits rustdoc depinfo
via rustdoc --emit=dep-info.
Before this, cargo doc used to track file changes via filesystem traversal just like build scripts, and it cannot detect these cases:

  • Cargo target source files are outside the package root, e.g., lib.path = "../lib.rs"
  • Using include_str! to include files outisde pakcage root, e.g., #[doc = include_str!("../outside/pkgroot")]
  • path attribute pointing to outside package root, e.g., #[path = "../outside/pkgroot"]
  • Using env! in doc attribute, e.g., #[doc = env!("…")]

The depinfo files are emitted to Cargo's fingerprint which is a private location so we don't have to commit any stability around it if we want to move it somewhere else in future versions.

Fixes #15370

How to test and review this PR?

While this is a bugfix, I assume we still need an FCP for it.

With this stabilization,
`cargo doc` unconditionally emits rustdoc depinfo
via `rustdoc --emit=dep-info`.
Before this, `cargo doc` used to track file changes
via filesystem traversal.

The depinfo files are emitted to Cargo's fingerprint
which is a private location so we don't have to commit any stability
around it if we want to move it somewhere else in future versions.
@weihanglo weihanglo added the T-cargo Team: Cargo label May 20, 2026
@rustbot rustbot added A-build-execution Area: anything dealing with executing the compiler A-documenting-cargo-itself Area: Cargo's documentation A-rebuild-detection Area: rebuild detection and fingerprinting A-unstable Area: nightly unstable support S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels May 20, 2026
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented May 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
Copy link
Copy Markdown
Member Author

weihanglo commented May 20, 2026

Oops. This is not going to work without flagging every cargo doc test case nightly-only 🥲

@weihanglo weihanglo marked this pull request as draft May 20, 2026 21:00
@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label May 20, 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-documenting-cargo-itself Area: Cargo's documentation A-rebuild-detection Area: rebuild detection and fingerprinting A-unstable Area: nightly unstable support T-cargo Team: Cargo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Tracking Issue for -Zrustdoc-depinfo

3 participants