Skip to content

Commit 42fb65b

Browse files
committed
Remove compiler_for from test::CodegenGCC
1 parent a347f8d commit 42fb65b

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
@@ -3578,7 +3578,7 @@ impl Step for CodegenCranelift {
35783578

35793579
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
35803580
pub struct CodegenGCC {
3581-
compiler: Compiler,
3581+
compilers: RustcPrivateCompilers,
35823582
target: TargetSelection,
35833583
}
35843584

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

35993599
if builder.doc_tests == DocTests::Only {
36003600
return;
@@ -3623,68 +3623,41 @@ impl Step for CodegenGCC {
36233623
return;
36243624
}
36253625

3626-
builder.ensure(CodegenGCC { compiler, target: run.target });
3626+
builder.ensure(CodegenGCC { compilers, target: run.target });
36273627
}
36283628

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

36333633
let gcc = builder.ensure(Gcc { target });
36343634

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

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

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

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

3687-
let mut cargo = build_cargo();
3658+
// Avoid incremental cache issues when changing rustc
3659+
cargo.env("CARGO_BUILD_INCREMENTAL", "false");
3660+
cargo.rustflag("-Cpanic=abort");
36883661

36893662
cargo
36903663
// cg_gcc's build system ignores RUSTFLAGS. pass some flags through CG_RUSTFLAGS instead.
@@ -3696,14 +3669,21 @@ impl Step for CodegenGCC {
36963669
.arg("--gcc-path")
36973670
.arg(gcc.libgccjit.parent().unwrap())
36983671
.arg("--out-dir")
3699-
.arg(builder.stage_out(compiler, Mode::ToolRustc).join("cg_gcc"))
3672+
.arg(builder.stage_out(compilers.build_compiler(), Mode::Codegen).join("cg_gcc"))
37003673
.arg("--release")
37013674
.arg("--mini-tests")
37023675
.arg("--std-tests");
37033676
cargo.args(builder.config.test_args());
37043677

37053678
cargo.into_cmd().run(builder);
37063679
}
3680+
3681+
fn metadata(&self) -> Option<StepMetadata> {
3682+
Some(
3683+
StepMetadata::test("rustc_codegen_gcc", self.target)
3684+
.built_by(self.compilers.build_compiler()),
3685+
)
3686+
}
37073687
}
37083688

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

0 commit comments

Comments
 (0)