Build layers
Per-crate differential caching and layer planning inside .rusty/.
Build layers are rusty's project-local answer to "which crates can skip compilation this run?"
Each workspace keeps a layer index under .rusty/ mapping crate identities (name@version) to artifact cache keys for a given profile (debug or release).
Inspect layers
rusty layers list --profile release
rusty layers plan --profile release
rusty layers why serde --profile release| Command | Output |
|---|---|
list | Cached crate layers for this project |
plan | Forecast hit/miss before building |
why | Show the layer key inputs for one crate |
plan is the command you run in CI before a long release build to see whether the cache will actually help.
How keys are formed
Layer keys digest:
- Source tree content (via CAS manifests)
- Dependency graph inputs
- Active
rustcversion - Target triple and profile
- Enabled features and relevant flags
rusty layers why prints the resolved key and whether the artifact cache currently holds it.
RUSTC_WRAPPER integration
During builds rusty sets RUSTC_WRAPPER to $RUSTY_HOME/bin/rusty-wrapper. The wrapper intercepts rustc invocations, stores successful outputs in the artifact cache, and updates the layer index.
You do not configure this manually for normal rusty build usage — it is wired through environment preparation.
Profiles
Pass --release or --profile <name> consistently across layers, build, and test so keys align:
rusty layers plan --release
rusty build --releaseMismatching profile flags between plan and build produces confusing miss forecasts.
Relationship to the artifact cache
Layers are the index. The artifact cache (rusty cache *) holds the payload — compiled object files and metadata groups keyed by the layer digest.
See Caching guide for operational patterns.