@@ -32,15 +32,16 @@ impl MiriEnv {
3232 & mut self ,
3333 quiet : bool ,
3434 target : Option < impl AsRef < OsStr > > ,
35+ features : & [ String ] ,
3536 ) -> Result < PathBuf > {
3637 if let Some ( miri_sysroot) = self . sh . var_os ( "MIRI_SYSROOT" ) {
3738 // Sysroot already set, use that.
3839 return Ok ( miri_sysroot. into ( ) ) ;
3940 }
4041
4142 // Make sure everything is built. Also Miri itself.
42- self . build ( "." , & [ ] , quiet) ?;
43- self . build ( "cargo-miri" , & [ ] , quiet) ?;
43+ self . build ( "." , features , & [ ] , quiet) ?;
44+ self . build ( "cargo-miri" , & [ ] , & [ ] , quiet) ?;
4445
4546 let target_flag = if let Some ( target) = & target {
4647 vec ! [ OsStr :: new( "--target" ) , target. as_ref( ) ]
@@ -58,7 +59,7 @@ impl MiriEnv {
5859 }
5960
6061 let mut cmd = self
61- . cargo_cmd ( "cargo-miri" , "run" )
62+ . cargo_cmd ( "cargo-miri" , "run" , & [ ] )
6263 . arg ( "--quiet" )
6364 . arg ( "--" )
6465 . args ( & [ "miri" , "setup" , "--print-sysroot" ] )
@@ -90,7 +91,9 @@ impl Command {
9091 Self :: fmt ( vec ! [ ] ) ?;
9192 }
9293 if auto_clippy {
93- Self :: clippy ( vec ! [ ] ) ?;
94+ // no features for auto actions, see
95+ // https://github.com/rust-lang/miri/pull/4396#discussion_r2149654845
96+ Self :: clippy ( vec ! [ ] , vec ! [ ] ) ?;
9497 }
9598
9699 Ok ( ( ) )
@@ -175,16 +178,16 @@ impl Command {
175178 }
176179 // Then run the actual command.
177180 match self {
178- Command :: Install { flags } => Self :: install ( flags) ,
179- Command :: Build { flags } => Self :: build ( flags) ,
180- Command :: Check { flags } => Self :: check ( flags) ,
181- Command :: Test { bless, flags , target, coverage } =>
182- Self :: test ( bless, flags , target, coverage) ,
183- Command :: Run { dep, verbose, target, edition, flags } =>
184- Self :: run ( dep, verbose, target, edition, flags) ,
185- Command :: Doc { flags } => Self :: doc ( flags) ,
181+ Command :: Install { features , flags } => Self :: install ( features , flags) ,
182+ Command :: Build { features , flags } => Self :: build ( features , flags) ,
183+ Command :: Check { features , flags } => Self :: check ( features , flags) ,
184+ Command :: Test { bless, target, coverage, features , flags } =>
185+ Self :: test ( bless, target, coverage, features , flags ) ,
186+ Command :: Run { dep, verbose, target, edition, features , flags } =>
187+ Self :: run ( dep, verbose, target, edition, features , flags) ,
188+ Command :: Doc { features , flags } => Self :: doc ( features , flags) ,
186189 Command :: Fmt { flags } => Self :: fmt ( flags) ,
187- Command :: Clippy { flags } => Self :: clippy ( flags) ,
190+ Command :: Clippy { features , flags } => Self :: clippy ( features , flags) ,
188191 Command :: Bench { target, no_install, save_baseline, load_baseline, benches } =>
189192 Self :: bench ( target, no_install, save_baseline, load_baseline, benches) ,
190193 Command :: Toolchain { flags } => Self :: toolchain ( flags) ,
@@ -494,7 +497,7 @@ impl Command {
494497
495498 if !no_install {
496499 // Make sure we have an up-to-date Miri installed and selected the right toolchain.
497- Self :: install ( vec ! [ ] ) ?;
500+ Self :: install ( vec ! [ ] , vec ! [ ] ) ?;
498501 }
499502 let results_json_dir = if save_baseline. is_some ( ) || load_baseline. is_some ( ) {
500503 Some ( TempDir :: new ( ) ?)
@@ -601,47 +604,48 @@ impl Command {
601604 Ok ( ( ) )
602605 }
603606
604- fn install ( flags : Vec < String > ) -> Result < ( ) > {
607+ fn install ( features : Vec < String > , flags : Vec < String > ) -> Result < ( ) > {
605608 let e = MiriEnv :: new ( ) ?;
606- e. install_to_sysroot ( e . miri_dir . clone ( ) , & flags) ?;
607- e. install_to_sysroot ( path ! ( e . miri_dir / "cargo-miri" ) , & flags) ?;
609+ e. install_to_sysroot ( "." , & features , & flags) ?;
610+ e. install_to_sysroot ( "cargo-miri" , & [ ] , & flags) ?;
608611 Ok ( ( ) )
609612 }
610613
611- fn build ( flags : Vec < String > ) -> Result < ( ) > {
614+ fn build ( features : Vec < String > , flags : Vec < String > ) -> Result < ( ) > {
612615 let e = MiriEnv :: new ( ) ?;
613- e. build ( "." , & flags, /* quiet */ false ) ?;
614- e. build ( "cargo-miri" , & flags, /* quiet */ false ) ?;
616+ e. build ( "." , & features , & flags, /* quiet */ false ) ?;
617+ e. build ( "cargo-miri" , & [ ] , & flags, /* quiet */ false ) ?;
615618 Ok ( ( ) )
616619 }
617620
618- fn check ( flags : Vec < String > ) -> Result < ( ) > {
621+ fn check ( features : Vec < String > , flags : Vec < String > ) -> Result < ( ) > {
619622 let e = MiriEnv :: new ( ) ?;
620- e. check ( "." , & flags) ?;
621- e. check ( "cargo-miri" , & flags) ?;
623+ e. check ( "." , & features , & flags) ?;
624+ e. check ( "cargo-miri" , & [ ] , & flags) ?;
622625 Ok ( ( ) )
623626 }
624627
625- fn doc ( flags : Vec < String > ) -> Result < ( ) > {
628+ fn doc ( features : Vec < String > , flags : Vec < String > ) -> Result < ( ) > {
626629 let e = MiriEnv :: new ( ) ?;
627- e. doc ( "." , & flags) ?;
628- e. doc ( "cargo-miri" , & flags) ?;
630+ e. doc ( "." , & features , & flags) ?;
631+ e. doc ( "cargo-miri" , & [ ] , & flags) ?;
629632 Ok ( ( ) )
630633 }
631634
632- fn clippy ( flags : Vec < String > ) -> Result < ( ) > {
635+ fn clippy ( features : Vec < String > , flags : Vec < String > ) -> Result < ( ) > {
633636 let e = MiriEnv :: new ( ) ?;
634- e. clippy ( "." , & flags) ?;
635- e. clippy ( "cargo-miri" , & flags) ?;
636- e. clippy ( "miri-script" , & flags) ?;
637+ e. clippy ( "." , & features , & flags) ?;
638+ e. clippy ( "cargo-miri" , & [ ] , & flags) ?;
639+ e. clippy ( "miri-script" , & [ ] , & flags) ?;
637640 Ok ( ( ) )
638641 }
639642
640643 fn test (
641644 bless : bool ,
642- mut flags : Vec < String > ,
643645 target : Option < String > ,
644646 coverage : bool ,
647+ features : Vec < String > ,
648+ mut flags : Vec < String > ,
645649 ) -> Result < ( ) > {
646650 let mut e = MiriEnv :: new ( ) ?;
647651
@@ -652,7 +656,7 @@ impl Command {
652656 }
653657
654658 // Prepare a sysroot. (Also builds cargo-miri, which we need.)
655- e. build_miri_sysroot ( /* quiet */ false , target. as_deref ( ) ) ?;
659+ e. build_miri_sysroot ( /* quiet */ false , target. as_deref ( ) , & features ) ?;
656660
657661 // Forward information to test harness.
658662 if bless {
@@ -672,10 +676,10 @@ impl Command {
672676
673677 // Then test, and let caller control flags.
674678 // Only in root project as `cargo-miri` has no tests.
675- e. test ( "." , & flags) ?;
679+ e. test ( "." , & features , & flags) ?;
676680
677681 if let Some ( coverage) = & coverage {
678- coverage. show_coverage_report ( & e) ?;
682+ coverage. show_coverage_report ( & e, & features ) ?;
679683 }
680684
681685 Ok ( ( ) )
@@ -686,14 +690,17 @@ impl Command {
686690 verbose : bool ,
687691 target : Option < String > ,
688692 edition : Option < String > ,
693+ features : Vec < String > ,
689694 flags : Vec < String > ,
690695 ) -> Result < ( ) > {
691696 let mut e = MiriEnv :: new ( ) ?;
692697
693698 // Preparation: get a sysroot, and get the miri binary.
694- let miri_sysroot = e. build_miri_sysroot ( /* quiet */ !verbose, target. as_deref ( ) ) ?;
695- let miri_bin =
696- e. build_get_binary ( "." ) . context ( "failed to get filename of miri executable" ) ?;
699+ let miri_sysroot =
700+ e. build_miri_sysroot ( /* quiet */ !verbose, target. as_deref ( ) , & features) ?;
701+ let miri_bin = e
702+ . build_get_binary ( "." , & features)
703+ . context ( "failed to get filename of miri executable" ) ?;
697704
698705 // More flags that we will pass before `flags`
699706 // (because `flags` may contain `--`).
@@ -718,7 +725,7 @@ impl Command {
718725 // The basic command that executes the Miri driver.
719726 let mut cmd = if dep {
720727 // We invoke the test suite as that has all the logic for running with dependencies.
721- e. cargo_cmd ( "." , "test" )
728+ e. cargo_cmd ( "." , "test" , & features )
722729 . args ( & [ "--test" , "ui" ] )
723730 . args ( quiet_flag)
724731 . arg ( "--" )
0 commit comments