@@ -494,23 +494,21 @@ impl Command {
494
494
flags : Vec < String > ,
495
495
) -> Result < ( ) > {
496
496
let mut e = MiriEnv :: new ( ) ?;
497
+
498
+ // Preparation: get a sysroot, and get the miri binary.
499
+ let miri_sysroot = e. build_miri_sysroot ( /* quiet */ !verbose, target. as_deref ( ) ) ?;
500
+ let miri_bin =
501
+ e. build_get_binary ( "." ) . context ( "failed to get filename of miri executable" ) ?;
502
+
497
503
// More flags that we will pass before `flags`
498
504
// (because `flags` may contain `--`).
499
505
let mut early_flags = Vec :: < OsString > :: new ( ) ;
500
-
501
- // Add target, edition to flags.
502
506
if let Some ( target) = & target {
503
507
early_flags. push ( "--target" . into ( ) ) ;
504
508
early_flags. push ( target. into ( ) ) ;
505
509
}
506
- if verbose {
507
- early_flags. push ( "--verbose" . into ( ) ) ;
508
- }
509
510
early_flags. push ( "--edition" . into ( ) ) ;
510
511
early_flags. push ( edition. as_deref ( ) . unwrap_or ( "2021" ) . into ( ) ) ;
511
-
512
- // Prepare a sysroot, add it to the flags. (Also builds cargo-miri, which we need.)
513
- let miri_sysroot = e. build_miri_sysroot ( /* quiet */ !verbose, target. as_deref ( ) ) ?;
514
512
early_flags. push ( "--sysroot" . into ( ) ) ;
515
513
early_flags. push ( miri_sysroot. into ( ) ) ;
516
514
@@ -523,18 +521,19 @@ impl Command {
523
521
let run_miri = |e : & MiriEnv , seed_flag : Option < String > | -> Result < ( ) > {
524
522
// The basic command that executes the Miri driver.
525
523
let mut cmd = if dep {
524
+ // We invoke the test suite as that has all the logic for running with dependencies.
526
525
e. cargo_cmd ( "." , "test" )
527
526
. args ( & [ "--test" , "ui" ] )
528
527
. args ( quiet_flag)
529
528
. arg ( "--" )
530
529
. args ( & [ "--miri-run-dep-mode" ] )
531
530
} else {
532
- e . cargo_cmd ( "." , "run" ) . args ( quiet_flag ) . arg ( "-- ")
531
+ cmd ! ( e . sh , "{miri_bin} " )
533
532
} ;
534
533
cmd. set_quiet ( !verbose) ;
535
534
// Add Miri flags
536
535
let mut cmd = cmd. args ( & miri_flags) . args ( & seed_flag) . args ( & early_flags) . args ( & flags) ;
537
- // For `--dep` we also need to set the env var.
536
+ // For `--dep` we also need to set the target in the env var.
538
537
if dep {
539
538
if let Some ( target) = & target {
540
539
cmd = cmd. env ( "MIRI_TEST_TARGET" , target) ;
0 commit comments