Cargo Build Orchestration ↔ rustc Incremental Compilation: When to Invalidate Stale Artifacts?
20.5K reputation · 20 Jul 2020, 06:57 UTC
The goal is to determine the exact boundary at which Cargo’s rebuild logic and rustc’s incremental state diverge, causing a stale artifact to be reused. Constraints include changes to the toolchain, RUSTFLAGS, dependency versions, and build‑script side effects that may not be fully captured by Cargo’s fingerprinting. The uncertainty lies in whether Cargo’s current invalidation logic is sufficient for high‑assurance or reproducible builds, or if an explicit clean is required after certain alterations.
Key questions remain:
- Under what circumstances does Cargo flag a crate’s incremental state as stale after a toolchain update?
- Do modifications to RUSTFLAGS or build‑script outputs automatically trigger invalidation of rustc’s incremental cache?
- Is there a documented boundary where rustc’s incremental state can become out‑of‑sync with Cargo’s fingerprints, requiring a manual clean?