Adapting rustbuild to incremental compilation

As incremental compilation gets closer to working, I was thinking we should make it easier to take advantage of it from rustbuild. Under the current setup, we would get some advantage building the stage1 rustc, however, that rustc would then be used to rebuild the libs, and since incremental is not designed to reuse results across rustc compiler versions we would not see many benefits there.

In practice though, unless you are changing the libs, you can reuse your old libs, no problem. Similarly, if you are hacking on the libs, you could probably re-use your stage1 and just rebuild the libs with it. (Or maybe you just want to rebuild the libs with stage0?)

I’m actually not sure what is the best design here.

@arielb1 had some notes on internals with an idea about “rustbuild lock” to kind of declare more persistently that you want to leave something untouched: Brainstorming improvements for new rustc devs

I remember @brson had an idea for defining the current “role”.

Anyway, I am opening this thread to talk about it. :slight_smile:

cc @arielb1 @alexcrichton @michaelwoerister @brson

I know I’d love to do this, my ideal situation being:

  • You enter “rustc” development mode
  • First build, you build everything. While building the stage2 compiler you enable incremental mode
  • On any future changes, we use the cached stage1 compiler to produce a new stage2 compiler, using all incremental artifacts from before
  • The stage2 compiler will use the libraries produced in the first step, it’ll never be used to produce those libs again.

That way you get full incrementality all the time for the entire compiler and you can use the generated compiler immediately.

In theory shouldn’t be too hard to implement, but is that what you’re thinking?

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.