fix(toolchain): invalidate target/ + sccache after a nightly bump#384
Merged
Conversation
toolchain-sync probes candidate nightlies in a per-candidate scratch
CARGO_TARGET_DIR, then commits the bump and exits without touching the
main caches. Both retain the OLD nightly's artifacts, so the next
build dies with E0514 'found crate X compiled by an incompatible
version of rustc' (observed: assert_cmd/winnow/tempfile/toml_parser).
Two caches must be invalidated, not one:
1. cargo clean — main target/ rlibs/rmeta carry the old rustc
commit-hash; cargo fingerprints do not force a
full rebuild across a nightly bump.
2. sccache --stop-server — the long-lived sccache daemon caches its
compiler-version detection keyed by the rustc
binary mtime/size. Under rustup, rustc is a
toolchain-agnostic proxy (~/.cargo/bin/rustc ->
rustup) whose bytes never change across a bump,
so the daemon keeps serving the OLD nightly's
objects and re-poisons target/ right after a
cargo clean. Restarting forces a fresh rustc -vV
probe. A full 30 GiB cache wipe is unnecessary.
Both run only in the 'found newer nightly' success branch, not the
'no bump available' branch.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
After
just toolchain-syncbumps therust-toolchain.tomlnightly pin, the next local build dies with:(also hit
winnow,tempfile,toml_parser). This blocked pre-push gates this session.Root cause — two stale caches, not one
toolchain-syncprobes candidate nightlies in a per-candidate scratchCARGO_TARGET_DIR(it already knows sharing the maintarget/across toolchains throws E0514), then commits the bump and exits without touching the main caches:target/— rlibs/rmeta carry the old rustc commit-hash; cargo fingerprints don't reliably force a full rebuild across a nightly bump.rustcbinary's mtime/size. Under rustup,~/.cargo/bin/rustcis a toolchain-agnostic proxy (symlink →rustup) whose bytes never change across a bump, so the daemon keeps serving the OLD nightly's objects and re-poisonstarget/right after acargo clean. This is whycargo cleanalone didn't fix it.Fix
After
toolchain-synccommits a bump (only in the "found newer nightly" branch, not "no bump available"), run:cargo clean— clear the old-nightlytarget/.sccache --stop-server— force the daemon to re-proberustc -vVon next invocation, restoring correct cache keying. A full 30 GiB cache wipe is unnecessary; the daemon restart is the targeted fix.Verification
cargo clean+sccache --stop-server; fullcargo build --workspace --all-targetsclean afterward.cargo-check,lint-tests,tests,lint-ci-windows) — the exact gates that were failing with E0514 before the cache fix.