Skip to content

Commit 4181ae8

Browse files
committed
Remove compiler_for from test::CodegenGCC
1 parent 09a7ed6 commit 4181ae8

File tree

1 file changed

+31
-51
lines changed
  • src/bootstrap/src/core/build_steps

1 file changed

+31
-51
lines changed

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

Lines changed: 31 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -3580,7 +3580,7 @@ impl Step for CodegenCranelift {
35803580

35813581
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
35823582
pub struct CodegenGCC {
3583-
compiler: Compiler,
3583+
compilers: RustcPrivateCompilers,
35843584
target: TargetSelection,
35853585
}
35863586

@@ -3596,7 +3596,7 @@ impl Step for CodegenGCC {
35963596
fn make_run(run: RunConfig<'_>) {
35973597
let builder = run.builder;
35983598
let host = run.build_triple();
3599-
let compiler = run.builder.compiler_for(run.builder.top_stage, host, host);
3599+
let compilers = RustcPrivateCompilers::new(run.builder, run.builder.top_stage, host);
36003600

36013601
if builder.doc_tests == DocTests::Only {
36023602
return;
@@ -3625,68 +3625,41 @@ impl Step for CodegenGCC {
36253625
return;
36263626
}
36273627

3628-
builder.ensure(CodegenGCC { compiler, target: run.target });
3628+
builder.ensure(CodegenGCC { compilers, target: run.target });
36293629
}
36303630

36313631
fn run(self, builder: &Builder<'_>) {
3632-
let compiler = self.compiler;
3632+
let compilers = self.compilers;
36333633
let target = self.target;
36343634

36353635
let gcc = builder.ensure(Gcc { target });
36363636

36373637
builder.ensure(
3638-
compile::Std::new(compiler, target)
3638+
compile::Std::new(compilers.build_compiler(), target)
36393639
.extra_rust_args(&["-Csymbol-mangling-version=v0", "-Cpanic=abort"]),
36403640
);
36413641

3642-
// If we're not doing a full bootstrap but we're testing a stage2
3643-
// version of libstd, then what we're actually testing is the libstd
3644-
// produced in stage1. Reflect that here by updating the compiler that
3645-
// we're working with automatically.
3646-
let compiler = builder.compiler_for(compiler.stage, compiler.host, target);
3647-
3648-
let build_cargo = || {
3649-
let mut cargo = builder::Cargo::new(
3650-
builder,
3651-
compiler,
3652-
Mode::Codegen, // Must be codegen to ensure dlopen on compiled dylibs works
3653-
SourceType::InTree,
3654-
target,
3655-
Kind::Run,
3656-
);
3657-
3658-
cargo.current_dir(&builder.src.join("compiler/rustc_codegen_gcc"));
3659-
cargo
3660-
.arg("--manifest-path")
3661-
.arg(builder.src.join("compiler/rustc_codegen_gcc/build_system/Cargo.toml"));
3662-
compile::rustc_cargo_env(builder, &mut cargo, target);
3663-
add_cg_gcc_cargo_flags(&mut cargo, &gcc);
3642+
let _msg = builder.msg_test("rustc_codegen_gcc", compilers.build_compiler());
36643643

3665-
// Avoid incremental cache issues when changing rustc
3666-
cargo.env("CARGO_BUILD_INCREMENTAL", "false");
3667-
cargo.rustflag("-Cpanic=abort");
3668-
3669-
cargo
3670-
};
3671-
3672-
builder.info(&format!(
3673-
"{} GCC stage{} ({} -> {})",
3674-
Kind::Test.description(),
3675-
compiler.stage,
3676-
&compiler.host,
3677-
target
3678-
));
3679-
let _time = helpers::timeit(builder);
3644+
let mut cargo = builder::Cargo::new(
3645+
builder,
3646+
compilers.build_compiler(),
3647+
Mode::Codegen, // Must be codegen to ensure dlopen on compiled dylibs works
3648+
SourceType::InTree,
3649+
target,
3650+
Kind::Run,
3651+
);
36803652

3681-
// FIXME: Uncomment the `prepare` command below once vendoring is implemented.
3682-
/*
3683-
let mut prepare_cargo = build_cargo();
3684-
prepare_cargo.arg("--").arg("prepare");
3685-
#[expect(deprecated)]
3686-
builder.config.try_run(&mut prepare_cargo.into()).unwrap();
3687-
*/
3653+
cargo.current_dir(&builder.src.join("compiler/rustc_codegen_gcc"));
3654+
cargo
3655+
.arg("--manifest-path")
3656+
.arg(builder.src.join("compiler/rustc_codegen_gcc/build_system/Cargo.toml"));
3657+
compile::rustc_cargo_env(builder, &mut cargo, target);
3658+
add_cg_gcc_cargo_flags(&mut cargo, &gcc);
36883659

3689-
let mut cargo = build_cargo();
3660+
// Avoid incremental cache issues when changing rustc
3661+
cargo.env("CARGO_BUILD_INCREMENTAL", "false");
3662+
cargo.rustflag("-Cpanic=abort");
36903663

36913664
cargo
36923665
// cg_gcc's build system ignores RUSTFLAGS. pass some flags through CG_RUSTFLAGS instead.
@@ -3698,14 +3671,21 @@ impl Step for CodegenGCC {
36983671
.arg("--gcc-path")
36993672
.arg(gcc.libgccjit.parent().unwrap())
37003673
.arg("--out-dir")
3701-
.arg(builder.stage_out(compiler, Mode::ToolRustc).join("cg_gcc"))
3674+
.arg(builder.stage_out(compilers.build_compiler(), Mode::Codegen).join("cg_gcc"))
37023675
.arg("--release")
37033676
.arg("--mini-tests")
37043677
.arg("--std-tests");
37053678
cargo.args(builder.config.test_args());
37063679

37073680
cargo.into_cmd().run(builder);
37083681
}
3682+
3683+
fn metadata(&self) -> Option<StepMetadata> {
3684+
Some(
3685+
StepMetadata::test("rustc_codegen_gcc", self.target)
3686+
.built_by(self.compilers.build_compiler()),
3687+
)
3688+
}
37093689
}
37103690

37113691
/// Get a build compiler that can be used to test the standard library (i.e. its stage will

0 commit comments

Comments
 (0)