Skip to content

Commit 1cae0c5

Browse files
committed
bootstrap: mirror mk's local-rebuild changes
The rustc for a local-rebuild is assumed to use the current bootstrap key and already match the current stage1 features.
1 parent 3406c55 commit 1cae0c5

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

src/bootstrap/build/config.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ pub struct Config {
6767
pub target: Vec<String>,
6868
pub rustc: Option<String>,
6969
pub cargo: Option<String>,
70+
pub rebuild: bool,
7071

7172
// libstd features
7273
pub debug_jemalloc: bool,
@@ -315,6 +316,7 @@ impl Config {
315316
("RPATH", self.rust_rpath),
316317
("OPTIMIZE_TESTS", self.rust_optimize_tests),
317318
("DEBUGINFO_TESTS", self.rust_debuginfo_tests),
319+
("LOCAL_REBUILD", self.rebuild),
318320
}
319321

320322
match key {

src/bootstrap/build/mod.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -510,6 +510,14 @@ impl Build {
510510
.arg("-j").arg(self.jobs().to_string())
511511
.arg("--target").arg(target);
512512

513+
let stage;
514+
if compiler.stage == 0 && self.config.rebuild {
515+
// Assume the local-rebuild rustc already has stage1 features.
516+
stage = 1;
517+
} else {
518+
stage = compiler.stage;
519+
}
520+
513521
// Customize the compiler we're running. Specify the compiler to cargo
514522
// as our shim and then pass it some various options used to configure
515523
// how the actual compiler itself is called.
@@ -518,7 +526,7 @@ impl Build {
518526
// src/bootstrap/{rustc,rustdoc.rs}
519527
cargo.env("RUSTC", self.out.join("bootstrap/debug/rustc"))
520528
.env("RUSTC_REAL", self.compiler_path(compiler))
521-
.env("RUSTC_STAGE", compiler.stage.to_string())
529+
.env("RUSTC_STAGE", stage.to_string())
522530
.env("RUSTC_DEBUGINFO", self.config.rust_debuginfo.to_string())
523531
.env("RUSTC_CODEGEN_UNITS",
524532
self.config.rust_codegen_units.to_string())
@@ -744,7 +752,7 @@ impl Build {
744752
// In stage0 we're using a previously released stable compiler, so we
745753
// use the stage0 bootstrap key. Otherwise we use our own build's
746754
// bootstrap key.
747-
let bootstrap_key = if compiler.is_snapshot(self) {
755+
let bootstrap_key = if compiler.is_snapshot(self) && !self.config.rebuild {
748756
&self.bootstrap_key_stage0
749757
} else {
750758
&self.bootstrap_key

0 commit comments

Comments
 (0)