27
27
Subcommands:
28
28
run, r Run binaries
29
29
test, t Run tests
30
+ nextest Run tests with nextest (requires cargo-nextest installed)
30
31
setup Only perform automatic setup, but without asking questions (for getting a proper libstd)
31
32
32
33
The cargo options are exactly the same as for `cargo run` and `cargo test`, respectively.
@@ -40,8 +41,8 @@ Examples:
40
41
enum MiriCommand {
41
42
/// Our own special 'setup' command.
42
43
Setup ,
43
- /// A command to be forwarded to cargo.
44
- Forward ( String ) ,
44
+ /// A command (+ possible initial arguments) to be forwarded to cargo.
45
+ Forward ( Vec < String > ) ,
45
46
}
46
47
47
48
/// The information to run a crate with the given environment.
@@ -586,11 +587,19 @@ fn phase_cargo_miri(mut args: env::Args) {
586
587
} ;
587
588
let subcommand = match & * subcommand {
588
589
"setup" => MiriCommand :: Setup ,
589
- "test" | "t" | "run" | "r" => MiriCommand :: Forward ( subcommand) ,
590
+ "test" | "t" | "run" | "r" => MiriCommand :: Forward ( vec ! [ subcommand] ) ,
591
+ "nextest" => {
592
+ // nextest requires a subcommand (e.g. nextest run) to be specified before --target, so
593
+ // grab the next argument.
594
+ let Some ( subcommand2) = args. next ( ) else {
595
+ show_error ( format ! ( "`cargo miri {subcommand}` must have a subcommand as its next command" ) ) ;
596
+ } ;
597
+ MiriCommand :: Forward ( vec ! [ subcommand, subcommand2] )
598
+ }
590
599
// Invalid command.
591
600
_ =>
592
601
show_error ( format ! (
593
- "`cargo miri` supports the following subcommands: `run`, `test`, and `setup`."
602
+ "`cargo miri` supports the following subcommands: `run`, `test`, `nextest`, and `setup`."
594
603
) ) ,
595
604
} ;
596
605
let verbose = num_arg_flag ( "-v" ) ;
@@ -610,7 +619,7 @@ fn phase_cargo_miri(mut args: env::Args) {
610
619
MiriCommand :: Setup => return , // `cargo miri setup` stops here.
611
620
} ;
612
621
let mut cmd = cargo ( ) ;
613
- cmd. arg ( cargo_cmd) ;
622
+ cmd. args ( cargo_cmd) ;
614
623
615
624
// Make sure we know the build target, and cargo does, too.
616
625
// This is needed to make the `CARGO_TARGET_*_RUNNER` env var do something,
0 commit comments