1
Fork 0

rustbuild: fix save-analysis not being saved for 2-stage builds

This commit is contained in:
Wang Xuerui 2016-12-31 14:31:08 +08:00
parent 8d5b91a19f
commit e46d2d8ca2
No known key found for this signature in database
GPG key ID: 38544B4E2DE7FAB9

View file

@ -521,7 +521,7 @@ impl Build {
.env(format!("CFLAGS_{}", target), self.cflags(target).join(" ")); .env(format!("CFLAGS_{}", target), self.cflags(target).join(" "));
} }
if self.config.channel == "nightly" && compiler.stage == 2 { if self.config.channel == "nightly" && compiler.is_final_stage(self) {
cargo.env("RUSTC_SAVE_ANALYSIS", "api".to_string()); cargo.env("RUSTC_SAVE_ANALYSIS", "api".to_string());
} }
@ -915,9 +915,10 @@ impl<'a> Compiler<'a> {
self.stage == 0 && self.host == build.config.build self.stage == 0 && self.host == build.config.build
} }
/// Returns if this compiler is to be treated as a final stage one, whether /// Returns if this compiler should be treated as a final stage one in the
/// we're performing a full bootstrap or not. Don't do that by comparing /// current build session.
/// stages with `2`! /// This takes into account whether we're performing a full bootstrap or
/// not; don't directly compare the stage with `2`!
fn is_final_stage(&self, build: &Build) -> bool { fn is_final_stage(&self, build: &Build) -> bool {
let final_stage = if build.config.full_bootstrap { 2 } else { 1 }; let final_stage = if build.config.full_bootstrap { 2 } else { 1 };
self.stage >= final_stage self.stage >= final_stage