Skip to content

Commit 28d8ac0

Browse files
committed
keep Rustc private and use Assemble instead
Signed-off-by: onur-ozkan <[email protected]>
1 parent 9896694 commit 28d8ac0

File tree

4 files changed

+17
-12
lines changed

4 files changed

+17
-12
lines changed

src/bootstrap/src/core/build_steps/compile.rs

+11-5
Original file line numberDiff line numberDiff line change
@@ -839,9 +839,9 @@ fn cp_rustc_component_to_ci_sysroot(builder: &Builder<'_>, sysroot: &Path, conte
839839

840840
#[derive(Debug, PartialOrd, Ord, Clone, PartialEq, Eq, Hash)]
841841
pub struct Rustc {
842-
pub target: TargetSelection,
842+
target: TargetSelection,
843843
/// The **previous** compiler used to compile this compiler.
844-
pub compiler: Compiler,
844+
compiler: Compiler,
845845
/// Whether to build a subset of crates, rather than the whole compiler.
846846
///
847847
/// This should only be requested by the user, not used within bootstrap itself.
@@ -851,6 +851,7 @@ pub struct Rustc {
851851
}
852852

853853
impl Rustc {
854+
#[cfg(test)]
854855
pub fn new(compiler: Compiler, target: TargetSelection) -> Self {
855856
Self { target, compiler, crates: Default::default() }
856857
}
@@ -923,7 +924,8 @@ impl Step for Rustc {
923924

924925
let compiler_to_use = builder.compiler_for(compiler.stage, compiler.host, target);
925926
if compiler_to_use != compiler {
926-
builder.ensure(Rustc::new(compiler_to_use, target));
927+
let _ = builder.compiler(compiler_to_use.stage, target);
928+
927929
let msg = if compiler_to_use.host == target {
928930
format!(
929931
"Uplifting rustc (stage{} -> stage{})",
@@ -1424,7 +1426,7 @@ impl Step for CodegenBackend {
14241426
let target = self.target;
14251427
let backend = self.backend;
14261428

1427-
builder.ensure(Rustc::new(compiler, target));
1429+
let _ = builder.compiler(compiler.stage, target);
14281430

14291431
if builder.config.keep_stage.contains(&compiler.stage) {
14301432
builder.info(
@@ -1861,7 +1863,11 @@ impl Step for Assemble {
18611863
// link to these. (FIXME: Is that correct? It seems to be correct most
18621864
// of the time but I think we do link to these for stage2/bin compilers
18631865
// when not performing a full bootstrap).
1864-
let actual_stage = builder.ensure(Rustc::new(build_compiler, target_compiler.host));
1866+
let actual_stage = builder.ensure(Rustc {
1867+
compiler: build_compiler,
1868+
target: target_compiler.host,
1869+
crates: vec![],
1870+
});
18651871
// Current build_compiler.stage might be uplifted instead of being built; so update it
18661872
// to not fail while linking the artifacts.
18671873
build_compiler.stage = actual_stage;

src/bootstrap/src/core/build_steps/dist.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -727,7 +727,7 @@ impl Step for RustcDev {
727727
return None;
728728
}
729729

730-
builder.ensure(compile::Rustc::new(compiler, target));
730+
let _ = builder.compiler(compiler.stage, target);
731731

732732
let tarball = Tarball::new(builder, "rustc-dev", &target.triple);
733733

src/bootstrap/src/core/build_steps/doc.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -953,7 +953,7 @@ macro_rules! tool_doc {
953953
// Rustdoc needs the rustc sysroot available to build.
954954
// FIXME: is there a way to only ensure `check::Rustc` here? Last time I tried it failed
955955
// with strange errors, but only on a full bors test ...
956-
builder.ensure(compile::Rustc::new(compiler, target));
956+
let _ = builder.compiler(compiler.stage, target);
957957
}
958958

959959
// Build cargo command.

src/bootstrap/src/core/build_steps/test.rs

+4-5
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,6 @@ impl Step for Cargotest {
251251
/// test` to ensure that we don't regress the test suites there.
252252
fn run(self, builder: &Builder<'_>) {
253253
let compiler = builder.compiler(self.stage, self.host);
254-
builder.ensure(compile::Rustc::new(compiler, compiler.host));
255254
let cargo = builder.ensure(tool::Cargo { compiler, target: compiler.host });
256255

257256
// Note that this is a short, cryptic, and not scoped directory name. This
@@ -369,7 +368,7 @@ impl Step for RustAnalyzer {
369368

370369
// We don't need to build the whole Rust Analyzer for the proc-macro-srv test suite,
371370
// but we do need the standard library to be present.
372-
builder.ensure(compile::Rustc::new(compiler, host));
371+
let _ = builder.compiler(compiler.stage, host);
373372

374373
let workspace_path = "src/tools/rust-analyzer";
375374
// until the whole RA test suite runs on `i686`, we only run
@@ -1662,7 +1661,7 @@ NOTE: if you're sure you want to do this, please open an issue as to why. In the
16621661
};
16631662

16641663
if suite.ends_with("fulldeps") {
1665-
builder.ensure(compile::Rustc::new(compiler, target));
1664+
let _ = builder.compiler(compiler.stage, target);
16661665
}
16671666

16681667
if suite == "debuginfo" {
@@ -2813,7 +2812,7 @@ impl Step for CrateRustdoc {
28132812
// the target rustdoc (`ci-rustc-sysroot` vs `stage2`). In that case, we need to ensure this
28142813
// explicitly to make sure it ends up in the stage2 sysroot.
28152814
builder.ensure(compile::Std::new(compiler, target));
2816-
builder.ensure(compile::Rustc::new(compiler, target));
2815+
let _ = builder.compiler(compiler.stage, target);
28172816

28182817
let mut cargo = tool::prepare_tool_cargo(
28192818
builder,
@@ -2904,7 +2903,7 @@ impl Step for CrateRustdocJsonTypes {
29042903
// `compiler`, then it would cause rustdoc to be built *again*, which
29052904
// isn't really necessary.
29062905
let compiler = builder.compiler_for(builder.top_stage, target, target);
2907-
builder.ensure(compile::Rustc::new(compiler, target));
2906+
let _ = builder.compiler(compiler.stage, target);
29082907

29092908
let cargo = tool::prepare_tool_cargo(
29102909
builder,

0 commit comments

Comments
 (0)