@@ -3419,7 +3419,7 @@ impl Step for TestHelpers {
3419
3419
3420
3420
#[ derive( Debug , Clone , PartialEq , Eq , Hash ) ]
3421
3421
pub struct CodegenCranelift {
3422
- compiler : Compiler ,
3422
+ compilers : RustcPrivateCompilers ,
3423
3423
target : TargetSelection ,
3424
3424
}
3425
3425
@@ -3435,7 +3435,7 @@ impl Step for CodegenCranelift {
3435
3435
fn make_run ( run : RunConfig < ' _ > ) {
3436
3436
let builder = run. builder ;
3437
3437
let host = run. build_triple ( ) ;
3438
- let compiler = run. builder . compiler_for ( run. builder . top_stage , host , host) ;
3438
+ let compilers = RustcPrivateCompilers :: new ( run. builder , run. builder . top_stage , host) ;
3439
3439
3440
3440
if builder. doc_tests == DocTests :: Only {
3441
3441
return ;
@@ -3465,71 +3465,50 @@ impl Step for CodegenCranelift {
3465
3465
return ;
3466
3466
}
3467
3467
3468
- builder. ensure ( CodegenCranelift { compiler , target : run. target } ) ;
3468
+ builder. ensure ( CodegenCranelift { compilers , target : run. target } ) ;
3469
3469
}
3470
3470
3471
3471
fn run ( self , builder : & Builder < ' _ > ) {
3472
- let compiler = self . compiler ;
3473
- let target = self . target ;
3474
-
3475
- builder. std ( compiler, target) ;
3472
+ let compilers = self . compilers ;
3473
+ let build_compiler = compilers. build_compiler ( ) ;
3476
3474
3477
- // If we're not doing a full bootstrap but we're testing a stage2
3478
- // version of libstd, then what we're actually testing is the libstd
3479
- // produced in stage1. Reflect that here by updating the compiler that
3480
- // we're working with automatically.
3481
- let compiler = builder. compiler_for ( compiler. stage , compiler. host , target) ;
3475
+ // We need to run the cranelift tests with the compiler against cranelift links to, not with
3476
+ // the build compiler.
3477
+ let target_compiler = compilers. target_compiler ( ) ;
3478
+ let target = self . target ;
3482
3479
3483
- let build_cargo = || {
3484
- let mut cargo = builder:: Cargo :: new (
3485
- builder,
3486
- compiler,
3487
- Mode :: Codegen , // Must be codegen to ensure dlopen on compiled dylibs works
3488
- SourceType :: InTree ,
3489
- target,
3490
- Kind :: Run ,
3491
- ) ;
3480
+ builder. std ( target_compiler, target) ;
3492
3481
3493
- cargo. current_dir ( & builder. src . join ( "compiler/rustc_codegen_cranelift" ) ) ;
3494
- cargo
3495
- . arg ( "--manifest-path" )
3496
- . arg ( builder. src . join ( "compiler/rustc_codegen_cranelift/build_system/Cargo.toml" ) ) ;
3497
- compile:: rustc_cargo_env ( builder, & mut cargo, target) ;
3482
+ let mut cargo = builder:: Cargo :: new (
3483
+ builder,
3484
+ target_compiler,
3485
+ Mode :: Codegen , // Must be codegen to ensure dlopen on compiled dylibs works
3486
+ SourceType :: InTree ,
3487
+ target,
3488
+ Kind :: Run ,
3489
+ ) ;
3498
3490
3499
- // Avoid incremental cache issues when changing rustc
3500
- cargo. env ( "CARGO_BUILD_INCREMENTAL" , "false" ) ;
3491
+ cargo. current_dir ( & builder. src . join ( "compiler/rustc_codegen_cranelift" ) ) ;
3492
+ cargo
3493
+ . arg ( "--manifest-path" )
3494
+ . arg ( builder. src . join ( "compiler/rustc_codegen_cranelift/build_system/Cargo.toml" ) ) ;
3495
+ compile:: rustc_cargo_env ( builder, & mut cargo, target) ;
3501
3496
3502
- cargo
3503
- } ;
3497
+ // Avoid incremental cache issues when changing rustc
3498
+ cargo . env ( "CARGO_BUILD_INCREMENTAL" , "false" ) ;
3504
3499
3505
- builder. info ( & format ! (
3506
- "{} cranelift stage{} ({} -> {})" ,
3507
- Kind :: Test . description( ) ,
3508
- compiler. stage,
3509
- & compiler. host,
3510
- target
3511
- ) ) ;
3512
- let _time = helpers:: timeit ( builder) ;
3500
+ let _guard = builder. msg_test ( "rustc_codegen_cranelift" , target_compiler) ;
3513
3501
3514
3502
// FIXME handle vendoring for source tarballs before removing the --skip-test below
3515
3503
let download_dir = builder. out . join ( "cg_clif_download" ) ;
3516
3504
3517
- // FIXME: Uncomment the `prepare` command below once vendoring is implemented.
3518
- /*
3519
- let mut prepare_cargo = build_cargo();
3520
- prepare_cargo.arg("--").arg("prepare").arg("--download-dir").arg(&download_dir);
3521
- #[expect(deprecated)]
3522
- builder.config.try_run(&mut prepare_cargo.into()).unwrap();
3523
- */
3524
-
3525
- let mut cargo = build_cargo ( ) ;
3526
3505
cargo
3527
3506
. arg ( "--" )
3528
3507
. arg ( "test" )
3529
3508
. arg ( "--download-dir" )
3530
3509
. arg ( & download_dir)
3531
3510
. arg ( "--out-dir" )
3532
- . arg ( builder. stage_out ( compiler , Mode :: ToolRustc ) . join ( "cg_clif" ) )
3511
+ . arg ( builder. stage_out ( build_compiler , Mode :: Codegen ) . join ( "cg_clif" ) )
3533
3512
. arg ( "--no-unstable-features" )
3534
3513
. arg ( "--use-backend" )
3535
3514
. arg ( "cranelift" )
@@ -3543,6 +3522,13 @@ impl Step for CodegenCranelift {
3543
3522
3544
3523
cargo. into_cmd ( ) . run ( builder) ;
3545
3524
}
3525
+
3526
+ fn metadata ( & self ) -> Option < StepMetadata > {
3527
+ Some (
3528
+ StepMetadata :: test ( "rustc_codegen_cranelift" , self . target )
3529
+ . built_by ( self . compilers . build_compiler ( ) ) ,
3530
+ )
3531
+ }
3546
3532
}
3547
3533
3548
3534
#[ derive( Debug , Clone , PartialEq , Eq , Hash ) ]
@@ -3606,7 +3592,7 @@ impl Step for CodegenGCC {
3606
3592
. extra_rust_args ( & [ "-Csymbol-mangling-version=v0" , "-Cpanic=abort" ] ) ,
3607
3593
) ;
3608
3594
3609
- let _msg = builder. msg_test ( "rustc_codegen_gcc" , compilers. build_compiler ( ) ) ;
3595
+ let _guard = builder. msg_test ( "rustc_codegen_gcc" , compilers. build_compiler ( ) ) ;
3610
3596
3611
3597
let mut cargo = builder:: Cargo :: new (
3612
3598
builder,
0 commit comments