Skip to content

Commit 2266746

Browse files
committed
[WIP] Don't require building a stage1 compiler before running cargotest
- Always use a bootstrap compiler for cargo and cargo-credential helpers This seems wrong; I think cargo is intentionally built with stage 2 because it's distributed with other parts of the release. However, I don't know how to avoid it - just changing CargoTest to build it with stage 0 unconditionally still builds rustc because it uses a `ToolRustc` mode. - Don't call `builder.ensure(Rustc)`. It's unnecessary. - Don't use the same compiler for building cargo as for testing.
1 parent d95a6cf commit 2266746

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

src/bootstrap/test.rs

+6-5
Original file line numberDiff line numberDiff line change
@@ -167,9 +167,9 @@ impl Step for Cargotest {
167167
/// This tool in `src/tools` will check out a few Rust projects and run `cargo
168168
/// test` to ensure that we don't regress the test suites there.
169169
fn run(self, builder: &Builder<'_>) {
170-
let compiler = builder.compiler(self.stage, self.host);
171-
builder.ensure(compile::Rustc { compiler, target: compiler.host });
172-
let cargo = builder.ensure(tool::Cargo { compiler, target: compiler.host });
170+
let bootstrap_compiler = builder.compiler(0, self.host);
171+
let cargo = builder
172+
.ensure(tool::Cargo { compiler: bootstrap_compiler, target: bootstrap_compiler.host });
173173

174174
// Note that this is a short, cryptic, and not scoped directory name. This
175175
// is currently to minimize the length of path on Windows where we otherwise
@@ -179,13 +179,14 @@ impl Step for Cargotest {
179179

180180
let _time = util::timeit(&builder);
181181
let mut cmd = builder.tool_cmd(Tool::CargoTest);
182+
let test_compiler = builder.compiler(self.stage, self.host);
182183
try_run(
183184
builder,
184185
cmd.arg(&cargo)
185186
.arg(&out_dir)
186187
.args(builder.config.cmd.test_args())
187-
.env("RUSTC", builder.rustc(compiler))
188-
.env("RUSTDOC", builder.rustdoc(compiler)),
188+
.env("RUSTC", builder.rustc(test_compiler))
189+
.env("RUSTDOC", builder.rustdoc(test_compiler)),
189190
);
190191
}
191192
}

src/bootstrap/tool.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -595,7 +595,7 @@ impl Step for Cargo {
595595

596596
fn make_run(run: RunConfig<'_>) {
597597
run.builder.ensure(Cargo {
598-
compiler: run.builder.compiler(run.builder.top_stage, run.builder.config.build),
598+
compiler: run.builder.compiler(0, run.builder.config.build),
599599
target: run.target,
600600
});
601601
}
@@ -606,7 +606,7 @@ impl Step for Cargo {
606606
compiler: self.compiler,
607607
target: self.target,
608608
tool: "cargo",
609-
mode: Mode::ToolRustc,
609+
mode: Mode::ToolBootstrap,
610610
path: "src/tools/cargo",
611611
is_optional_tool: false,
612612
source_type: SourceType::Submodule,
@@ -621,7 +621,7 @@ impl Step for Cargo {
621621
compiler: self.compiler,
622622
target: self.target,
623623
tool: name,
624-
mode: Mode::ToolRustc,
624+
mode: Mode::ToolBootstrap,
625625
path,
626626
is_optional_tool: true,
627627
source_type: SourceType::Submodule,

0 commit comments

Comments
 (0)