Skip to content

Commit 2ae6025

Browse files
committed
force current stage when --stage is expilicitly used
Allows users to build std with stage2 compiler without using `full-bootstrap`. Signed-off-by: onur-ozkan <[email protected]>
1 parent 9d49eb7 commit 2ae6025

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

src/bootstrap/src/core/builder.rs

+5-3
Original file line numberDiff line numberDiff line change
@@ -975,9 +975,9 @@ impl<'a> Builder<'a> {
975975
self.ensure(compile::Assemble { target_compiler: Compiler { stage, host } })
976976
}
977977

978-
/// Similar to `compiler`, except handles the full-bootstrap option to
978+
/// Similar to `compiler`, except handles the full-bootstrap option to
979979
/// silently use the stage1 compiler instead of a stage2 compiler if one is
980-
/// requested.
980+
/// requested. This behaviour is ignored if `--stage` is explicitly set.
981981
///
982982
/// Note that this does *not* have the side effect of creating
983983
/// `compiler(stage, host)`, unlike `compiler` above which does have such
@@ -992,7 +992,9 @@ impl<'a> Builder<'a> {
992992
host: TargetSelection,
993993
target: TargetSelection,
994994
) -> Compiler {
995-
if self.build.force_use_stage2(stage) {
995+
if self.config.explicit_stage {
996+
self.compiler(stage, host)
997+
} else if self.build.force_use_stage2(stage) {
996998
self.compiler(2, self.config.build)
997999
} else if self.build.force_use_stage1(stage, target) {
9981000
self.compiler(1, self.config.build)

src/bootstrap/src/core/config/config.rs

+3
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,8 @@ pub struct Config {
184184

185185
pub on_fail: Option<String>,
186186
pub stage: u32,
187+
/// Indicates whether `--stage` was explicitly used or not.
188+
pub explicit_stage: bool,
187189
pub keep_stage: Vec<u32>,
188190
pub keep_stage_std: Vec<u32>,
189191
pub src: PathBuf,
@@ -1216,6 +1218,7 @@ impl Config {
12161218
config.incremental = flags.incremental;
12171219
config.dry_run = if flags.dry_run { DryRun::UserSelected } else { DryRun::Disabled };
12181220
config.dump_bootstrap_shims = flags.dump_bootstrap_shims;
1221+
config.explicit_stage = flags.stage.is_some();
12191222
config.keep_stage = flags.keep_stage;
12201223
config.keep_stage_std = flags.keep_stage_std;
12211224
config.color = flags.color;

0 commit comments

Comments
 (0)