@@ -3452,7 +3452,7 @@ impl Step for TestHelpers {
34523452
34533453#[ derive( Debug , Clone , PartialEq , Eq , Hash ) ]
34543454pub struct CodegenCranelift {
3455- compiler : Compiler ,
3455+ compilers : RustcPrivateCompilers ,
34563456 target : TargetSelection ,
34573457}
34583458
@@ -3468,7 +3468,7 @@ impl Step for CodegenCranelift {
34683468 fn make_run ( run : RunConfig < ' _ > ) {
34693469 let builder = run. builder ;
34703470 let host = run. build_triple ( ) ;
3471- let compiler = run. builder . compiler_for ( run. builder . top_stage , host , host) ;
3471+ let compilers = RustcPrivateCompilers :: new ( run. builder , run. builder . top_stage , host) ;
34723472
34733473 if builder. doc_tests == DocTests :: Only {
34743474 return ;
@@ -3498,71 +3498,50 @@ impl Step for CodegenCranelift {
34983498 return ;
34993499 }
35003500
3501- builder. ensure ( CodegenCranelift { compiler , target : run. target } ) ;
3501+ builder. ensure ( CodegenCranelift { compilers , target : run. target } ) ;
35023502 }
35033503
35043504 fn run ( self , builder : & Builder < ' _ > ) {
3505- let compiler = self . compiler ;
3506- let target = self . target ;
3507-
3508- builder. std ( compiler, target) ;
3505+ let compilers = self . compilers ;
3506+ let build_compiler = compilers. build_compiler ( ) ;
35093507
3510- // If we're not doing a full bootstrap but we're testing a stage2
3511- // version of libstd, then what we're actually testing is the libstd
3512- // produced in stage1. Reflect that here by updating the compiler that
3513- // we're working with automatically.
3514- let compiler = builder. compiler_for ( compiler. stage , compiler. host , target) ;
3508+ // We need to run the cranelift tests with the compiler against cranelift links to, not with
3509+ // the build compiler.
3510+ let target_compiler = compilers. target_compiler ( ) ;
3511+ let target = self . target ;
35153512
3516- let build_cargo = || {
3517- let mut cargo = builder:: Cargo :: new (
3518- builder,
3519- compiler,
3520- Mode :: Codegen , // Must be codegen to ensure dlopen on compiled dylibs works
3521- SourceType :: InTree ,
3522- target,
3523- Kind :: Run ,
3524- ) ;
3513+ builder. std ( target_compiler, target) ;
35253514
3526- cargo. current_dir ( & builder. src . join ( "compiler/rustc_codegen_cranelift" ) ) ;
3527- cargo
3528- . arg ( "--manifest-path" )
3529- . arg ( builder. src . join ( "compiler/rustc_codegen_cranelift/build_system/Cargo.toml" ) ) ;
3530- compile:: rustc_cargo_env ( builder, & mut cargo, target) ;
3515+ let mut cargo = builder:: Cargo :: new (
3516+ builder,
3517+ target_compiler,
3518+ Mode :: Codegen , // Must be codegen to ensure dlopen on compiled dylibs works
3519+ SourceType :: InTree ,
3520+ target,
3521+ Kind :: Run ,
3522+ ) ;
35313523
3532- // Avoid incremental cache issues when changing rustc
3533- cargo. env ( "CARGO_BUILD_INCREMENTAL" , "false" ) ;
3524+ cargo. current_dir ( & builder. src . join ( "compiler/rustc_codegen_cranelift" ) ) ;
3525+ cargo
3526+ . arg ( "--manifest-path" )
3527+ . arg ( builder. src . join ( "compiler/rustc_codegen_cranelift/build_system/Cargo.toml" ) ) ;
3528+ compile:: rustc_cargo_env ( builder, & mut cargo, target) ;
35343529
3535- cargo
3536- } ;
3530+ // Avoid incremental cache issues when changing rustc
3531+ cargo . env ( "CARGO_BUILD_INCREMENTAL" , "false" ) ;
35373532
3538- builder. info ( & format ! (
3539- "{} cranelift stage{} ({} -> {})" ,
3540- Kind :: Test . description( ) ,
3541- compiler. stage,
3542- & compiler. host,
3543- target
3544- ) ) ;
3545- let _time = helpers:: timeit ( builder) ;
3533+ let _guard = builder. msg_test ( "rustc_codegen_cranelift" , target_compiler) ;
35463534
35473535 // FIXME handle vendoring for source tarballs before removing the --skip-test below
35483536 let download_dir = builder. out . join ( "cg_clif_download" ) ;
35493537
3550- // FIXME: Uncomment the `prepare` command below once vendoring is implemented.
3551- /*
3552- let mut prepare_cargo = build_cargo();
3553- prepare_cargo.arg("--").arg("prepare").arg("--download-dir").arg(&download_dir);
3554- #[expect(deprecated)]
3555- builder.config.try_run(&mut prepare_cargo.into()).unwrap();
3556- */
3557-
3558- let mut cargo = build_cargo ( ) ;
35593538 cargo
35603539 . arg ( "--" )
35613540 . arg ( "test" )
35623541 . arg ( "--download-dir" )
35633542 . arg ( & download_dir)
35643543 . arg ( "--out-dir" )
3565- . arg ( builder. stage_out ( compiler , Mode :: ToolRustc ) . join ( "cg_clif" ) )
3544+ . arg ( builder. stage_out ( build_compiler , Mode :: Codegen ) . join ( "cg_clif" ) )
35663545 . arg ( "--no-unstable-features" )
35673546 . arg ( "--use-backend" )
35683547 . arg ( "cranelift" )
@@ -3576,6 +3555,13 @@ impl Step for CodegenCranelift {
35763555
35773556 cargo. into_cmd ( ) . run ( builder) ;
35783557 }
3558+
3559+ fn metadata ( & self ) -> Option < StepMetadata > {
3560+ Some (
3561+ StepMetadata :: test ( "rustc_codegen_cranelift" , self . target )
3562+ . built_by ( self . compilers . build_compiler ( ) ) ,
3563+ )
3564+ }
35793565}
35803566
35813567#[ derive( Debug , Clone , PartialEq , Eq , Hash ) ]
@@ -3639,7 +3625,7 @@ impl Step for CodegenGCC {
36393625 . extra_rust_args ( & [ "-Csymbol-mangling-version=v0" , "-Cpanic=abort" ] ) ,
36403626 ) ;
36413627
3642- let _msg = builder. msg_test ( "rustc_codegen_gcc" , compilers. build_compiler ( ) ) ;
3628+ let _guard = builder. msg_test ( "rustc_codegen_gcc" , compilers. build_compiler ( ) ) ;
36433629
36443630 let mut cargo = builder:: Cargo :: new (
36453631 builder,
0 commit comments