Files
rust/tests
Jonathan Brouwer f65463527e Rollup merge of #162240 - charliermarsh:charlie/incremental-session-gc, r=bjorn3
Garbage-collect old incremental compilation sessions

## Summary

rustc cleans up old incremental-cache snapshots twice during a compilation: once at startup (after loading the previous cache), and then again after finishing and finalizing the new cache.

In rust-lang/rust#147821, we started skipping the current session during cleanup. But that means we're also skipping cleanup _after_ the session has finished, so we're keeping _both_ the previous and the completed snapshot on disk. (The snapshots don't accumulate indefinitely -- the "extra" snapshot gets removed when the next compilation starts, but that compilation then leaves another snapshot behind when it finishes.)

This PR modifies the logic to skip the current session while it is still active, but remove it once finalized.

Testing it locally for [Ruff](https://github.com/astral-sh/ruff) and [uv](https://github.com/astral-sh/uv), the target directory shrinks significantly... The query caches are almost exactly 50% smaller, and `target` as a whole is 27.3% smaller in Ruff and 31.1% smaller in uv.
2026-09-14 15:15:56 +02:00
..
2026-09-11 17:08:12 +02:00
2026-09-11 17:08:12 +02:00