diff --git a/src/bootstrap/src/core/build_steps/compile.rs b/src/bootstrap/src/core/build_steps/compile.rs index a6a5af22d2520..3c05644f63be8 100644 --- a/src/bootstrap/src/core/build_steps/compile.rs +++ b/src/bootstrap/src/core/build_steps/compile.rs @@ -861,7 +861,8 @@ impl Step for Rustc { } let compiler_to_use = builder.compiler_for(compiler.stage, compiler.host, target); - if compiler_to_use != compiler { + if compiler_to_use != compiler + { builder.ensure(Rustc::new(compiler_to_use, target)); let msg = if compiler_to_use.host == target { format!( @@ -1604,6 +1605,7 @@ impl Step for Sysroot { #[derive(Debug, Copy, PartialOrd, Ord, Clone, PartialEq, Eq, Hash)] pub struct Assemble { + pub host: TargetSelection, /// The compiler which we will produce in this step. Assemble itself will /// take care of ensuring that the necessary prerequisites to do so exist, /// that is, this target can be a stage2 compiler and Assemble will build @@ -1621,6 +1623,7 @@ impl Step for Assemble { fn make_run(run: RunConfig<'_>) { run.builder.ensure(Assemble { + host: run.builder.config.build, target_compiler: run.builder.compiler(run.builder.top_stage + 1, run.target), }); } @@ -1652,10 +1655,7 @@ impl Step for Assemble { // only assume that we can run `build` artifacts, which means that to // produce some other architecture compiler we need to start from // `build` to get there. - // - // FIXME: It may be faster if we build just a stage 1 compiler and then - // use that to bootstrap this compiler forward. - let build_compiler = builder.compiler(target_compiler.stage - 1, builder.config.build); + let build_compiler = builder.compiler_for(target_compiler.stage - 1, self.target_compiler.host, self.target_compiler.host); // If we're downloading a compiler from CI, we can use the same compiler for all stages other than 0. if builder.download_rustc() { diff --git a/src/bootstrap/src/core/builder.rs b/src/bootstrap/src/core/builder.rs index 4e20babc55a68..07fae4b6657c1 100644 --- a/src/bootstrap/src/core/builder.rs +++ b/src/bootstrap/src/core/builder.rs @@ -986,7 +986,7 @@ impl<'a> Builder<'a> { /// obtained through this function, since it ensures that they are valid /// (i.e., built and assembled). pub fn compiler(&self, stage: u32, host: TargetSelection) -> Compiler { - self.ensure(compile::Assemble { target_compiler: Compiler { stage, host } }) + self.ensure(compile::Assemble { host, target_compiler: Compiler { stage, host } }) } /// Similar to `compiler`, except handles the full-bootstrap option to