- 
                Notifications
    
You must be signed in to change notification settings  - Fork 2.7k
 
Description
Problem
At work, our main workspace gets stuck in a permanently dirty state where only a full cargo clean allows it to fix itself.
It appears like cargo is of two minds whether certain dependencies are stale: when evaluating depA it thinks its fresh but when looking at crate1 which uses depA it reports that its Dirty causing a whole chain of crates to get perpetually rechecked / rebuilt.
The problem is that the cache never gets updated / the affected crates never get rebuilt so followup runs reach the same conclusion and will always rebuild the affected crates.
Steps
- Run 
cargo buildorcargo checkon affected workspace - Repeat
 - Run 
cargo clean cargo build/cargo checknow works as expected.
I haven't been able to reproduce this outside of our work repository yet so I'm unable to share a MVCE at this time.
Possible Solution(s)
No response
Notes
I've included a filtered output of cargo check --verbose.
       Fresh hyper-util v0.1.14
       Fresh rkyv v0.7.44
       Fresh crc32fast v1.4.2
       Fresh tokio v1.45.0
       Dirty <workspace>-a v0.1.0 (PATH): the dependency <workspace>_proc was rebuilt (1761733737.968668037s, 286h 26m 15s after last build at 1760702562.265344617s)
    Checking <workspace>-a v0.1.0 (PATH)
       Fresh <workspace>-c v0.0.1 (PATH)
       Dirty <workspace>-d v0.1.0 (PATH): the dependency crc32fast was rebuilt (1760620769.157896236s, 23h 43m 9s after last build at 1760535380.652542855s)
    Checking <workspace>-d v0.1.0 (PATH)
       Fresh serde-value v0.7.0
       Dirty <workspace>-e v0.0.1 (PATH): the dependency rkyv was rebuilt (1760702561.999607786s, 45h 49m 16s after last build at 1760537605.018571092s)
    Checking <workspace>-e v0.0.1 (PATH)
       Dirty <workspace>-f v0.0.1 (PATH): the dependency tokio was rebuilt (1760620770.329166748s, 23h 43m 1s after last build at 1760535389.035129015s)
    Checking <workspace>-f v0.0.1 (PATH)
       Dirty <workspace>-g v0.1.0 (PATH): the dependency hyper_util was rebuilt (1760620773.396682246s, 23h 43m 4s after last build at 1760535389.804449249s)
    Checking <workspace>-g v0.1.0 (PATH)
       Dirty ptree v0.1.0 (PATH): the dependency serde_value was rebuilt (1760620770.810881011s, 23h 43m 1s after last build at 1760535389.857334782s)
    Checking ptree v0.1.0 (PATH)
       Fresh <workspace>-proc v0.0.1 (PATH)
       Dirty <workspace>-h v0.1.0 (PATH): the dependency <workspace>_a was rebuilt
    Checking <workspace>-h v0.1.0 (PATH)
       Dirty <workspace>-i v0.1.0 (PATH): the dependency <workspace>_d was rebuilt
    Checking <workspace>-i v0.1.0 (PATH)
       Dirty <workspace>-j v0.1.0 (PATH): the dependency <workspace>_d was rebuilt
    Checking <workspace>-j v0.1.0 (PATH)
       Dirty <workspace>-k v0.1.0 (PATH): the dependency <workspace>_a was rebuilt
    Checking <workspace>-k v0.1.0 (PATH)
       Dirty <workspace>-l v0.1.0 (PATH): the dependency <workspace>_i was rebuilt
    Checking <workspace>-l v0.1.0 (PATH)
    ....
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 5.77s
One interesting tidbit is that a proc macro crate seems to be involved (at least in this specific instance of the problem). The same output is produced by followup check runs so the cache doesn't get fixed. Note: even running cargo build does nothing to fix the cache.
Another note: it seems like there might be an interaction with git? it seems like this only manifests when switching between git branches.
Version
1.90.0-nightly (840b83a10 2025-07-30)
release: 1.90.0-nightly
commit-hash: 840b83a10fb0e039a83f4d70ad032892c287570a
commit-date: 2025-07-30
host: aarch64-apple-darwin
libgit2: 1.9.1 (sys:0.20.2 vendored)
libcurl: 8.7.1 (sys:0.4.82+curl-8.14.1 system ssl:(SecureTransport) LibreSSL/3.3.6)
ssl: OpenSSL 3.5.0 8 Apr 2025
os: Mac OS 15.6.1 [64-bit]