Skip to content

Commit

Permalink
force current stage when --stage is expilicitly used
Browse files Browse the repository at this point in the history
Allows users to build std with stage2 compiler without using `full-bootstrap`.

Signed-off-by: onur-ozkan <[email protected]>
  • Loading branch information
onur-ozkan committed Dec 15, 2023
1 parent 9d49eb7 commit dfed8af
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/bootstrap/src/core/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -977,7 +977,7 @@ impl<'a> Builder<'a> {

/// Similar to `compiler`, except handles the full-bootstrap option to
/// silently use the stage1 compiler instead of a stage2 compiler if one is
/// requested.
/// requested. This behaviour is ignored if `--stage` is explicitly set.
///
/// Note that this does *not* have the side effect of creating
/// `compiler(stage, host)`, unlike `compiler` above which does have such
Expand All @@ -992,7 +992,9 @@ impl<'a> Builder<'a> {
host: TargetSelection,
target: TargetSelection,
) -> Compiler {
if self.build.force_use_stage2(stage) {
if self.config.explicit_stage {
self.compiler(stage, host)
} else if self.build.force_use_stage2(stage) {
self.compiler(2, self.config.build)
} else if self.build.force_use_stage1(stage, target) {
self.compiler(1, self.config.build)
Expand Down
3 changes: 3 additions & 0 deletions src/bootstrap/src/core/config/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,8 @@ pub struct Config {

pub on_fail: Option<String>,
pub stage: u32,
/// Indicates whether `--stage` was explicitly used or not.
pub explicit_stage: bool,
pub keep_stage: Vec<u32>,
pub keep_stage_std: Vec<u32>,
pub src: PathBuf,
Expand Down Expand Up @@ -1216,6 +1218,7 @@ impl Config {
config.incremental = flags.incremental;
config.dry_run = if flags.dry_run { DryRun::UserSelected } else { DryRun::Disabled };
config.dump_bootstrap_shims = flags.dump_bootstrap_shims;
config.explicit_stage = flags.stage.is_some();
config.keep_stage = flags.keep_stage;
config.keep_stage_std = flags.keep_stage_std;
config.color = flags.color;
Expand Down

0 comments on commit dfed8af

Please sign in to comment.