@@ -494,23 +494,21 @@ impl Command {
494494 flags : Vec < String > ,
495495 ) -> Result < ( ) > {
496496 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+
497503 // More flags that we will pass before `flags`
498504 // (because `flags` may contain `--`).
499505 let mut early_flags = Vec :: < OsString > :: new ( ) ;
500-
501- // Add target, edition to flags.
502506 if let Some ( target) = & target {
503507 early_flags. push ( "--target" . into ( ) ) ;
504508 early_flags. push ( target. into ( ) ) ;
505509 }
506- if verbose {
507- early_flags. push ( "--verbose" . into ( ) ) ;
508- }
509510 early_flags. push ( "--edition" . into ( ) ) ;
510511 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 ( ) ) ?;
514512 early_flags. push ( "--sysroot" . into ( ) ) ;
515513 early_flags. push ( miri_sysroot. into ( ) ) ;
516514
@@ -523,18 +521,19 @@ impl Command {
523521 let run_miri = |e : & MiriEnv , seed_flag : Option < String > | -> Result < ( ) > {
524522 // The basic command that executes the Miri driver.
525523 let mut cmd = if dep {
524+ // We invoke the test suite as that has all the logic for running with dependencies.
526525 e. cargo_cmd ( "." , "test" )
527526 . args ( & [ "--test" , "ui" ] )
528527 . args ( quiet_flag)
529528 . arg ( "--" )
530529 . args ( & [ "--miri-run-dep-mode" ] )
531530 } else {
532- e . cargo_cmd ( "." , "run" ) . args ( quiet_flag ) . arg ( "-- ")
531+ cmd ! ( e . sh , "{miri_bin} " )
533532 } ;
534533 cmd. set_quiet ( !verbose) ;
535534 // Add Miri flags
536535 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.
538537 if dep {
539538 if let Some ( target) = & target {
540539 cmd = cmd. env ( "MIRI_TEST_TARGET" , target) ;
0 commit comments