@@ -32,15 +32,16 @@ impl MiriEnv {
32
32
& mut self ,
33
33
quiet : bool ,
34
34
target : Option < impl AsRef < OsStr > > ,
35
+ features : & [ String ] ,
35
36
) -> Result < PathBuf > {
36
37
if let Some ( miri_sysroot) = self . sh . var_os ( "MIRI_SYSROOT" ) {
37
38
// Sysroot already set, use that.
38
39
return Ok ( miri_sysroot. into ( ) ) ;
39
40
}
40
41
41
42
// 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) ?;
44
45
45
46
let target_flag = if let Some ( target) = & target {
46
47
vec ! [ OsStr :: new( "--target" ) , target. as_ref( ) ]
@@ -58,7 +59,7 @@ impl MiriEnv {
58
59
}
59
60
60
61
let mut cmd = self
61
- . cargo_cmd ( "cargo-miri" , "run" )
62
+ . cargo_cmd ( "cargo-miri" , "run" , & [ ] )
62
63
. arg ( "--quiet" )
63
64
. arg ( "--" )
64
65
. args ( & [ "miri" , "setup" , "--print-sysroot" ] )
@@ -175,14 +176,14 @@ impl Command {
175
176
}
176
177
// Then run the actual command.
177
178
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) ,
179
+ Command :: Install { features , flags } => Self :: install ( features , flags) ,
180
+ Command :: Build { features , flags } => Self :: build ( features , flags) ,
181
+ Command :: Check { features , flags } => Self :: check ( features , flags) ,
182
+ Command :: Test { bless, flags, target, coverage, features } =>
183
+ Self :: test ( bless, flags, target, coverage, features ) ,
184
+ Command :: Run { dep, verbose, target, edition, features , flags } =>
185
+ Self :: run ( dep, verbose, target, edition, features , flags) ,
186
+ Command :: Doc { features , flags } => Self :: doc ( features , flags) ,
186
187
Command :: Fmt { flags } => Self :: fmt ( flags) ,
187
188
Command :: Clippy { flags } => Self :: clippy ( flags) ,
188
189
Command :: Bench { target, no_install, save_baseline, load_baseline, benches } =>
@@ -494,7 +495,7 @@ impl Command {
494
495
495
496
if !no_install {
496
497
// Make sure we have an up-to-date Miri installed and selected the right toolchain.
497
- Self :: install ( vec ! [ ] ) ?;
498
+ Self :: install ( vec ! [ ] , vec ! [ ] ) ?;
498
499
}
499
500
let results_json_dir = if save_baseline. is_some ( ) || load_baseline. is_some ( ) {
500
501
Some ( TempDir :: new ( ) ?)
@@ -601,31 +602,31 @@ impl Command {
601
602
Ok ( ( ) )
602
603
}
603
604
604
- fn install ( flags : Vec < String > ) -> Result < ( ) > {
605
+ fn install ( features : Vec < String > , flags : Vec < String > ) -> Result < ( ) > {
605
606
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) ?;
607
+ e. install_to_sysroot ( e. miri_dir . clone ( ) , & features , & flags) ?;
608
+ e. install_to_sysroot ( path ! ( e. miri_dir / "cargo-miri" ) , & [ ] , & flags) ?;
608
609
Ok ( ( ) )
609
610
}
610
611
611
- fn build ( flags : Vec < String > ) -> Result < ( ) > {
612
+ fn build ( features : Vec < String > , flags : Vec < String > ) -> Result < ( ) > {
612
613
let e = MiriEnv :: new ( ) ?;
613
- e. build ( "." , & flags, /* quiet */ false ) ?;
614
- e. build ( "cargo-miri" , & flags, /* quiet */ false ) ?;
614
+ e. build ( "." , & features , & flags, /* quiet */ false ) ?;
615
+ e. build ( "cargo-miri" , & [ ] , & flags, /* quiet */ false ) ?;
615
616
Ok ( ( ) )
616
617
}
617
618
618
- fn check ( flags : Vec < String > ) -> Result < ( ) > {
619
+ fn check ( features : Vec < String > , flags : Vec < String > ) -> Result < ( ) > {
619
620
let e = MiriEnv :: new ( ) ?;
620
- e. check ( "." , & flags) ?;
621
- e. check ( "cargo-miri" , & flags) ?;
621
+ e. check ( "." , & features , & flags) ?;
622
+ e. check ( "cargo-miri" , & [ ] , & flags) ?;
622
623
Ok ( ( ) )
623
624
}
624
625
625
- fn doc ( flags : Vec < String > ) -> Result < ( ) > {
626
+ fn doc ( features : Vec < String > , flags : Vec < String > ) -> Result < ( ) > {
626
627
let e = MiriEnv :: new ( ) ?;
627
- e. doc ( "." , & flags) ?;
628
- e. doc ( "cargo-miri" , & flags) ?;
628
+ e. doc ( "." , & features , & flags) ?;
629
+ e. doc ( "cargo-miri" , & [ ] , & flags) ?;
629
630
Ok ( ( ) )
630
631
}
631
632
@@ -642,6 +643,7 @@ impl Command {
642
643
mut flags : Vec < String > ,
643
644
target : Option < String > ,
644
645
coverage : bool ,
646
+ features : Vec < String > ,
645
647
) -> Result < ( ) > {
646
648
let mut e = MiriEnv :: new ( ) ?;
647
649
@@ -652,7 +654,7 @@ impl Command {
652
654
}
653
655
654
656
// Prepare a sysroot. (Also builds cargo-miri, which we need.)
655
- e. build_miri_sysroot ( /* quiet */ false , target. as_deref ( ) ) ?;
657
+ e. build_miri_sysroot ( /* quiet */ false , target. as_deref ( ) , & features ) ?;
656
658
657
659
// Forward information to test harness.
658
660
if bless {
@@ -675,7 +677,7 @@ impl Command {
675
677
e. test ( "." , & flags) ?;
676
678
677
679
if let Some ( coverage) = & coverage {
678
- coverage. show_coverage_report ( & e) ?;
680
+ coverage. show_coverage_report ( & e, & features ) ?;
679
681
}
680
682
681
683
Ok ( ( ) )
@@ -686,14 +688,17 @@ impl Command {
686
688
verbose : bool ,
687
689
target : Option < String > ,
688
690
edition : Option < String > ,
691
+ features : Vec < String > ,
689
692
flags : Vec < String > ,
690
693
) -> Result < ( ) > {
691
694
let mut e = MiriEnv :: new ( ) ?;
692
695
693
696
// 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" ) ?;
697
+ let miri_sysroot =
698
+ e. build_miri_sysroot ( /* quiet */ !verbose, target. as_deref ( ) , & features) ?;
699
+ let miri_bin = e
700
+ . build_get_binary ( "." , & features)
701
+ . context ( "failed to get filename of miri executable" ) ?;
697
702
698
703
// More flags that we will pass before `flags`
699
704
// (because `flags` may contain `--`).
@@ -718,7 +723,7 @@ impl Command {
718
723
// The basic command that executes the Miri driver.
719
724
let mut cmd = if dep {
720
725
// We invoke the test suite as that has all the logic for running with dependencies.
721
- e. cargo_cmd ( "." , "test" )
726
+ e. cargo_cmd ( "." , "test" , & features )
722
727
. args ( & [ "--test" , "ui" ] )
723
728
. args ( quiet_flag)
724
729
. arg ( "--" )
0 commit comments