I'm a bit confused about what exactly the stage0 and stage1 compilers are. I thought stage0 is the previous beta compiler and stage1 is the checkout built with the stage0 compiler. However, changing files in the checkout also triggers a (partial) rebuild of the stage0 compiler. Why is that?
stage0 is only the compiler, there are no standard library binaries included. So the first thing the stage0 compiler does is build its libstd
if you modify libstd/libcore or similar, then stage0 will rebuild that, causing a full stage 1 rebuild
you can prevent this by passing
--keep-stage 0 to your command line
So if I currently have a stage0 and stage1 compiler (default config), I run touch src/librustc/lib.rs && ./x.py build --stage 1. This first skips building stage0 std and test and then does:
Building stage0 compiler artifacts (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
Compiling rustc v0.0.0 (/home/nikic/rust/src/librustc)
It does not rebuild the stage0 libstd, but does seem to rebuild the stage0 compiler (or at least the parts that were changed)
oh, well, not quite. It's building the compiler artifacts with the
stage0 compiler (because it doesn't have a stage1 compiler yet)
the compiler that is being built is the stage 1 compiler
Ah, so I guess I should be interpreting "building stageN artifacts" not as "building artifacts for use in stageN" but rather "building artifacts using stageN for use in stageN+1", right?
That’s how I understand it, yes.