Skip to content

Commit e46d2d8

Browse files
committed
rustbuild: fix save-analysis not being saved for 2-stage builds
1 parent 8d5b91a commit e46d2d8

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/bootstrap/lib.rs

Lines changed: 5 additions & 4 deletions
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

@@ -915,9 +915,10 @@ impl<'a> Compiler<'a> {
915915
self.stage == 0 && self.host == build.config.build
916916
}
917917

918-
/// Returns if this compiler is to be treated as a final stage one, whether
919-
/// we're performing a full bootstrap or not. Don't do that by comparing
920-
/// stages with `2`!
918+
/// Returns if this compiler should be treated as a final stage one in the
919+
/// current build session.
920+
/// This takes into account whether we're performing a full bootstrap or
921+
/// not; don't directly compare the stage with `2`!
921922
fn is_final_stage(&self, build: &Build) -> bool {
922923
let final_stage = if build.config.full_bootstrap { 2 } else { 1 };
923924
self.stage >= final_stage

0 commit comments

Comments
 (0)