Skip to content

Commit 07412c8

Browse files
committed
Auto merge of #38736 - xen0n:save-the-save-analysis, r=alexcrichton
rustbuild: save the save analysis Fixes #38734. ~~call me the nightly firefighter~~ r? @alexcrichton
2 parents 90c80e0 + e46d2d8 commit 07412c8

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/bootstrap/lib.rs

+10-1
Original file line numberDiff line numberDiff line change
@@ -521,7 +521,7 @@ impl Build {
521521
.env(format!("CFLAGS_{}", target), self.cflags(target).join(" "));
522522
}
523523

524-
if self.config.channel == "nightly" && compiler.stage == 2 {
524+
if self.config.channel == "nightly" && compiler.is_final_stage(self) {
525525
cargo.env("RUSTC_SAVE_ANALYSIS", "api".to_string());
526526
}
527527

@@ -922,4 +922,13 @@ impl<'a> Compiler<'a> {
922922
fn is_snapshot(&self, build: &Build) -> bool {
923923
self.stage == 0 && self.host == build.config.build
924924
}
925+
926+
/// Returns if this compiler should be treated as a final stage one in the
927+
/// current build session.
928+
/// This takes into account whether we're performing a full bootstrap or
929+
/// not; don't directly compare the stage with `2`!
930+
fn is_final_stage(&self, build: &Build) -> bool {
931+
let final_stage = if build.config.full_bootstrap { 2 } else { 1 };
932+
self.stage >= final_stage
933+
}
925934
}

0 commit comments

Comments
 (0)