@@ -54,6 +54,7 @@ pub enum Subcommand {
54
54
Test {
55
55
paths : Vec < PathBuf > ,
56
56
test_args : Vec < String > ,
57
+ rustc_args : Vec < String > ,
57
58
fail_fast : bool ,
58
59
} ,
59
60
Bench {
@@ -150,6 +151,12 @@ To learn more about a subcommand, run `./x.py <subcommand> -h`");
150
151
"test" => {
151
152
opts. optflag ( "" , "no-fail-fast" , "Run all tests regardless of failure" ) ;
152
153
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
+ ) ;
153
160
} ,
154
161
"bench" => { opts. optmulti ( "" , "test-args" , "extra arguments" , "ARGS" ) ; } ,
155
162
"clean" => { opts. optflag ( "" , "all" , "clean all build artifacts" ) ; } ,
@@ -283,6 +290,7 @@ Arguments:
283
290
Subcommand :: Test {
284
291
paths,
285
292
test_args : matches. opt_strs ( "test-args" ) ,
293
+ rustc_args : matches. opt_strs ( "rustc-args" ) ,
286
294
fail_fast : !matches. opt_present ( "no-fail-fast" ) ,
287
295
}
288
296
}
@@ -362,6 +370,15 @@ impl Subcommand {
362
370
}
363
371
}
364
372
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
+
365
382
pub fn fail_fast ( & self ) -> bool {
366
383
match * self {
367
384
Subcommand :: Test { fail_fast, .. } => fail_fast,
0 commit comments