@@ -54,6 +54,7 @@ pub enum Subcommand {
5454 Test {
5555 paths : Vec < PathBuf > ,
5656 test_args : Vec < String > ,
57+ rustc_args : Vec < String > ,
5758 fail_fast : bool ,
5859 } ,
5960 Bench {
@@ -150,6 +151,12 @@ To learn more about a subcommand, run `./x.py <subcommand> -h`");
150151 "test" => {
151152 opts. optflag ( "" , "no-fail-fast" , "Run all tests regardless of failure" ) ;
152153 opts. optmulti ( "" , "test-args" , "extra arguments" , "ARGS" ) ;
154+ opts. optmulti (
155+ "" ,
156+ "rustc-args" ,
157+ "extra options to pass the compiler when running tests" ,
158+ "ARGS" ,
159+ ) ;
153160 } ,
154161 "bench" => { opts. optmulti ( "" , "test-args" , "extra arguments" , "ARGS" ) ; } ,
155162 "clean" => { opts. optflag ( "" , "all" , "clean all build artifacts" ) ; } ,
@@ -283,6 +290,7 @@ Arguments:
283290 Subcommand :: Test {
284291 paths,
285292 test_args : matches. opt_strs ( "test-args" ) ,
293+ rustc_args : matches. opt_strs ( "rustc-args" ) ,
286294 fail_fast : !matches. opt_present ( "no-fail-fast" ) ,
287295 }
288296 }
@@ -362,6 +370,15 @@ impl Subcommand {
362370 }
363371 }
364372
373+ pub fn rustc_args ( & self ) -> Vec < & str > {
374+ match * self {
375+ Subcommand :: Test { ref rustc_args, .. } => {
376+ rustc_args. iter ( ) . flat_map ( |s| s. split_whitespace ( ) ) . collect ( )
377+ }
378+ _ => Vec :: new ( ) ,
379+ }
380+ }
381+
365382 pub fn fail_fast ( & self ) -> bool {
366383 match * self {
367384 Subcommand :: Test { fail_fast, .. } => fail_fast,
0 commit comments