mirror of
https://github.com/rust-lang/cargo.git
synced 2025-09-28 11:20:36 +00:00

### What does this PR try to resolve? This leverages the unstable `--emit=depinfo` option from rustdoc, so that rustdoc invocation rebuild can be better tracked without traversing the entire directory. Some design decisions made in the current implementation: * Rustdoc's depinfo doesn't and shouldn't emit to `target/doc`, as the directory is considered part of the final artifact directory. In regard to that, we specify the dep-info output path to the fingerprint directory of rustdoc invocation. It looks like this `target/debug/.fingerprint/serde-12d29d32b3b8b38f/doc-lib-serde.d`. * We also start supporting `-Zchecksum-freshness` as a side effect. Could make it a separate PR if desired. * `-Zbinary-dep-depinfo` is not enabled along with this, since doc generations don't really require any binary dependencies. ### How should we test and review this PR? The tests added has covered these cases: * target src outside package root, e.g., `lib.path = "../lib.rs"` * `#[doc = include_str!("../outside/pkgroot")]` * `#[path = "../outside/pkgroot"]` * `env!` ### Additional information Fixes #12266 Closes #15205