about summary refs log tree commit diff
diff options
context:
space:
mode:
authorjyn <github@jyn.dev>2023-05-25 23:56:15 -0500
committerjyn <github@jyn.dev>2023-05-26 00:00:58 -0500
commitb42ff20c560fb53982b3f77d3fed5c459a01b545 (patch)
treec2f6176cb1caef55cd97bb15ca68bbdede49ce44
parent0004b3b984b19646c1f78b09ba497b7bd6e882c1 (diff)
Revert "Enable incremental independent of stage"
This reverts commit 827f656ebb1230f31af6d968c4bfe69a79914ffc.

Incremental is not sound to use across stages. Arbitrary changes to the compiler can invalidate the
incremental cache - even changes to normal queries, not incremental itself! - and we do not
currently enable `incremental-verify-ich` in bootstrap. Since 2018, we highly recommend and nudge
users towards stage 1 builds instead of stage 2, and using `keep-stage` for anything other than
libstd is very rare.

I don't think the risk of unsoundness is worth the very minor speedup when building libstd. Disable
incremental to avoid spurious panics and miscompilations when building with the stage 1 and 2
sysroot.
-rw-r--r--src/bootstrap/builder.rs5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs
index cf7c6596c02..685824278ff 100644
--- a/src/bootstrap/builder.rs
+++ b/src/bootstrap/builder.rs
@@ -1783,7 +1783,10 @@ impl<'a> Builder<'a> {
             cargo.env("RUSTC_TLS_MODEL_INITIAL_EXEC", "1");
         }
 
-        if self.config.incremental {
+        // Ignore incremental modes except for stage0, since we're
+        // not guaranteeing correctness across builds if the compiler
+        // is changing under your feet.
+        if self.config.incremental && compiler.stage == 0 {
             cargo.env("CARGO_INCREMENTAL", "1");
         } else {
             // Don't rely on any default setting for incr. comp. in Cargo