Skip to content

Commit 92c12b3

Browse files
committed
keep Rustc private and use Assemble instead
Signed-off-by: onur-ozkan <[email protected]>
1 parent 74125fe commit 92c12b3

File tree

4 files changed

+17
-12
lines changed

4 files changed

+17
-12
lines changed

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

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -948,9 +948,9 @@ fn cp_rustc_component_to_ci_sysroot(builder: &Builder<'_>, sysroot: &Path, conte
948948

949949
#[derive(Debug, PartialOrd, Ord, Clone, PartialEq, Eq, Hash)]
950950
pub struct Rustc {
951-
pub target: TargetSelection,
951+
target: TargetSelection,
952952
/// The **previous** compiler used to compile this compiler.
953-
pub compiler: Compiler,
953+
compiler: Compiler,
954954
/// Whether to build a subset of crates, rather than the whole compiler.
955955
///
956956
/// This should only be requested by the user, not used within bootstrap itself.
@@ -960,6 +960,7 @@ pub struct Rustc {
960960
}
961961

962962
impl Rustc {
963+
#[cfg(test)]
963964
pub fn new(compiler: Compiler, target: TargetSelection) -> Self {
964965
Self { target, compiler, crates: Default::default() }
965966
}
@@ -1045,7 +1046,8 @@ impl Step for Rustc {
10451046

10461047
let compiler_to_use = builder.compiler_for(compiler.stage, compiler.host, target);
10471048
if compiler_to_use != compiler {
1048-
builder.ensure(Rustc::new(compiler_to_use, target));
1049+
let _ = builder.compiler(compiler_to_use.stage, target);
1050+
10491051
let msg = if compiler_to_use.host == target {
10501052
format!(
10511053
"Uplifting rustc (stage{} -> stage{})",
@@ -1574,7 +1576,7 @@ impl Step for CodegenBackend {
15741576
let target = self.target;
15751577
let backend = self.backend;
15761578

1577-
builder.ensure(Rustc::new(compiler, target));
1579+
let _ = builder.compiler(compiler.stage, target);
15781580

15791581
if builder.config.keep_stage.contains(&compiler.stage) {
15801582
trace!("`keep-stage` requested");
@@ -2052,7 +2054,11 @@ impl Step for Assemble {
20522054
"target_compiler.host" = ?target_compiler.host,
20532055
"building compiler libraries to link to"
20542056
);
2055-
let actual_stage = builder.ensure(Rustc::new(build_compiler, target_compiler.host));
2057+
let actual_stage = builder.ensure(Rustc {
2058+
compiler: build_compiler,
2059+
target: target_compiler.host,
2060+
crates: vec![],
2061+
});
20562062
// Current build_compiler.stage might be uplifted instead of being built; so update it
20572063
// to not fail while linking the artifacts.
20582064
debug!(

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -729,7 +729,7 @@ impl Step for RustcDev {
729729
return None;
730730
}
731731

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

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

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

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

957957
// Build cargo command.

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

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

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

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

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

16661665
if suite.ends_with("fulldeps") {
1667-
builder.ensure(compile::Rustc::new(compiler, target));
1666+
let _ = builder.compiler(compiler.stage, target);
16681667
}
16691668

16701669
if suite == "debuginfo" {
@@ -2823,7 +2822,7 @@ impl Step for CrateRustdoc {
28232822
// the target rustdoc (`ci-rustc-sysroot` vs `stage2`). In that case, we need to ensure this
28242823
// explicitly to make sure it ends up in the stage2 sysroot.
28252824
builder.ensure(compile::Std::new(compiler, target));
2826-
builder.ensure(compile::Rustc::new(compiler, target));
2825+
let _ = builder.compiler(compiler.stage, target);
28272826

28282827
let mut cargo = tool::prepare_tool_cargo(
28292828
builder,
@@ -2914,7 +2913,7 @@ impl Step for CrateRustdocJsonTypes {
29142913
// `compiler`, then it would cause rustdoc to be built *again*, which
29152914
// isn't really necessary.
29162915
let compiler = builder.compiler_for(builder.top_stage, target, target);
2917-
builder.ensure(compile::Rustc::new(compiler, target));
2916+
let _ = builder.compiler(compiler.stage, target);
29182917

29192918
let cargo = tool::prepare_tool_cargo(
29202919
builder,

0 commit comments

Comments
 (0)