@@ -461,24 +461,30 @@ impl Step for RustDemangler {
461
461
pub struct Miri {
462
462
stage : u32 ,
463
463
host : TargetSelection ,
464
+ target : TargetSelection ,
464
465
}
465
466
466
467
impl Step for Miri {
467
468
type Output = ( ) ;
468
- const ONLY_HOSTS : bool = true ;
469
+ const ONLY_HOSTS : bool = false ;
469
470
470
471
fn should_run ( run : ShouldRun < ' _ > ) -> ShouldRun < ' _ > {
471
472
run. path ( "src/tools/miri" )
472
473
}
473
474
474
475
fn make_run ( run : RunConfig < ' _ > ) {
475
- run. builder . ensure ( Miri { stage : run. builder . top_stage , host : run. target } ) ;
476
+ run. builder . ensure ( Miri {
477
+ stage : run. builder . top_stage ,
478
+ host : run. build_triple ( ) ,
479
+ target : run. target ,
480
+ } ) ;
476
481
}
477
482
478
483
/// Runs `cargo test` for miri.
479
484
fn run ( self , builder : & Builder < ' _ > ) {
480
485
let stage = self . stage ;
481
486
let host = self . host ;
487
+ let target = self . target ;
482
488
let compiler = builder. compiler ( stage, host) ;
483
489
// We need the stdlib for the *next* stage, as it was built with this compiler that also built Miri.
484
490
// Except if we are at stage 2, the bootstrap loop is complete and we can stick with our current stage.
@@ -495,7 +501,7 @@ impl Step for Miri {
495
501
builder. ensure ( compile:: Std :: new ( compiler_std, host) ) ;
496
502
let sysroot = builder. sysroot ( compiler_std) ;
497
503
498
- // # Run `cargo miri setup`.
504
+ // # Run `cargo miri setup` for the given target .
499
505
let mut cargo = tool:: prepare_tool_cargo (
500
506
builder,
501
507
compiler,
@@ -508,6 +514,7 @@ impl Step for Miri {
508
514
) ;
509
515
cargo. add_rustc_lib_path ( builder, compiler) ;
510
516
cargo. arg ( "--" ) . arg ( "miri" ) . arg ( "setup" ) ;
517
+ cargo. arg ( "--target" ) . arg ( target. rustc_target_arg ( ) ) ;
511
518
512
519
// Tell `cargo miri setup` where to find the sources.
513
520
cargo. env ( "MIRI_LIB_SRC" , builder. src . join ( "library" ) ) ;
@@ -565,6 +572,9 @@ impl Step for Miri {
565
572
cargo. env ( "MIRI_BLESS" , "Gesundheit" ) ;
566
573
}
567
574
575
+ // Set the target.
576
+ cargo. env ( "MIRI_TEST_TARGET" , target. rustc_target_arg ( ) ) ;
577
+ // Forward test filters.
568
578
cargo. arg ( "--" ) . args ( builder. config . cmd . test_args ( ) ) ;
569
579
570
580
let mut cargo = Command :: from ( cargo) ;
0 commit comments