rfcs icon indicating copy to clipboard operation
rfcs copied to clipboard

Target Stages, an improvement of the incremental system

Open blyxyas opened this issue 1 month ago • 2 comments

The current model for incremental recompilations doesn't share progress between compiler activities, leading to unnecessary rebuilds.

This PR introduces two concepts (target stages and stage dependencies) that would help alleviate that problem, via extracting some unstable fields from crate hashing into their own parts of the incremental system, and separating concerns between the different compilation stages.

So, cargo check isn't affected by -Clto=true and cargo build can reuse artifacts produced by cargo check.

Rendered

blyxyas avatar Nov 20 '25 21:11 blyxyas

I've not got much experience with compiler work, so apologies if this question isn't well formed, but will this completely change the contents of the build/{debug,release}/incremental directory? Or will the data that is currently stored there (not sure what this data is, haven't been able to find much of a definition in the cargo or rustc docs) remain after these changes, and just be supplemented?

loftyinclination avatar Nov 23 '25 14:11 loftyinclination

The contents of the incremental compilation directory created by rustc are already entirely unstable. It is just a bunch of caches of rustc internal data structures and a bunch of cached object files.

bjorn3 avatar Nov 23 '25 14:11 bjorn3