-
Notifications
You must be signed in to change notification settings - Fork 2.9k
cargo doc doesn't detect dirty sources from parent directories #12266
Copy link
Copy link
Closed
Labels
A-rebuild-detectionArea: rebuild detection and fingerprintingArea: rebuild detection and fingerprintingC-bugCategory: bugCategory: bugCommand-docS-blocked-externalStatus: ❌ blocked on something out of the direct control of the Cargo project, e.g., upstream fixStatus: ❌ blocked on something out of the direct control of the Cargo project, e.g., upstream fixZ-rustdoc-depinfoNightly: rustdoc-depinfo integrationNightly: rustdoc-depinfo integration
Metadata
Metadata
Assignees
Labels
A-rebuild-detectionArea: rebuild detection and fingerprintingArea: rebuild detection and fingerprintingC-bugCategory: bugCategory: bugCommand-docS-blocked-externalStatus: ❌ blocked on something out of the direct control of the Cargo project, e.g., upstream fixStatus: ❌ blocked on something out of the direct control of the Cargo project, e.g., upstream fixZ-rustdoc-depinfoNightly: rustdoc-depinfo integrationNightly: rustdoc-depinfo integration
Type
Fields
Give feedbackNo fields configured for issues without a type.
Problem
When sources aren't in a subdirectory of the cargo manifest,
cargo docfails to detect changes to those sources. The issue only occurs withcargo doc(not check or build). It isn't affected by the working directory (using--manifest-path), and using an absolute vs. relative path for the source makes no difference.Steps
Use the following directory structure and
Cargo.tomlwith an emptylib.rs:Running
cargo doc --manifest-path=manifest/Cargo.toml -vshould succeed. Now add a syntax error tolib.rs. Subsequentcargo docruns will say that the crate isFreshand exit without detecting the syntax error.Removing
manifest/targetmanually or bycargo cleaning will force a rebuild, but changes tolib.rsseem to never cause rebuilds.Possible Solution(s)
No response
Notes
This behavior was encountered on Fuchsia, where we primarily use a different build system (GN+ninja) but have experimental support for generating cargo manifests for rust targets. The
Cargo.tomls are generated in an out directory and contain absolute paths pointing to the source root for each crate. We initially thought the issue had to do with the absolute paths or our use of symlinks, but it appears that change detection forcargo docis broken for ANY sources that aren't in the same dir or subdirs of the manifest.Version