pub fn build_directives(manifest_dir: &Path) -> Vec<String>Expand description
The cargo directives build_script prints for the crate at manifest_dir
once the lint is enabled: what to watch, then the warnings.
Once a build script prints a rerun-if-* directive, cargo reruns it only when
one of them fires and replays its cached warnings in between, so every source
file the lint found is watched on the error path too: a “failed to parse”
warning must not outlive the fix (#1738). A src/ directory holding the crate
root is also watched as a whole (cargo scans it recursively), which covers a
module file created after the mod line naming it. A crate root anywhere
else, such as the lib.rs next to Cargo.toml of every scaffolded R package,
is watched file by file only: a recursive watch of the manifest directory
would take in target/, vendor/ and .cargo/ and rerun the script after
every build.
Cargo.toml holds [lib] path (#1745) but is watched only while no crate
root file can be found or read. Then no source file is watched, and without
the manifest nothing would ever rerun the lint to clear its warning. A
healthy crate leaves it unwatched: every scaffolded configure touches
Cargo.toml, and watching it would rebuild the crate on every install (a
crate cargo builds but the lint cannot read, such as an inline
lib = { path = ... }, pays that cost until the spelling is rewritten).
Moving the root file away is still seen, since a watched file that
disappears reruns the script (#1752).