File tree 3 files changed +15
-1
lines changed
3 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -86,6 +86,10 @@ pub struct Options {
86
86
/// contains "foo" as a substring
87
87
pub enable_per_target_ignores : bool ,
88
88
89
+ /// The path to a rustc-like binary to build tests with. If not set, we
90
+ /// default to loading from $sysroot/bin/rustc.
91
+ pub test_builder : Option < PathBuf > ,
92
+
89
93
// Options that affect the documentation process
90
94
91
95
/// The selected default set of passes to use.
@@ -476,6 +480,7 @@ impl Options {
476
480
let generate_search_filter = !matches. opt_present ( "disable-per-crate-search" ) ;
477
481
let persist_doctests = matches. opt_str ( "persist-doctests" ) . map ( PathBuf :: from) ;
478
482
let generate_redirect_pages = matches. opt_present ( "generate-redirect-pages" ) ;
483
+ let test_builder = matches. opt_str ( "test-builder" ) . map ( PathBuf :: from) ;
479
484
let codegen_options_strs = matches. opt_strs ( "C" ) ;
480
485
let lib_strs = matches. opt_strs ( "L" ) ;
481
486
let extern_strs = matches. opt_strs ( "extern" ) ;
@@ -515,6 +520,7 @@ impl Options {
515
520
runtool,
516
521
runtool_args,
517
522
enable_per_target_ignores,
523
+ test_builder,
518
524
render_options : RenderOptions {
519
525
output,
520
526
external_html,
Original file line number Diff line number Diff line change @@ -373,6 +373,11 @@ fn opts() -> Vec<RustcOptGroup> {
373
373
"" ,
374
374
"One (of possibly many) arguments to pass to the runtool" )
375
375
} ) ,
376
+ unstable( "test-builder" , |o| {
377
+ o. optflag( "" ,
378
+ "test-builder" ,
379
+ "specified the rustc-like binary to use as the test builder" )
380
+ } ) ,
376
381
]
377
382
}
378
383
Original file line number Diff line number Diff line change @@ -248,7 +248,10 @@ fn run_test(
248
248
} ;
249
249
let output_file = outdir. path ( ) . join ( "rust_out" ) ;
250
250
251
- let mut compiler = Command :: new ( rustc_interface:: util:: rustc_path ( ) . expect ( "found rustc" ) ) ;
251
+ let rustc_binary = options. test_builder . as_ref ( ) . map ( |v| & * * v) . unwrap_or_else ( || {
252
+ rustc_interface:: util:: rustc_path ( ) . expect ( "found rustc" )
253
+ } ) ;
254
+ let mut compiler = Command :: new ( & rustc_binary) ;
252
255
compiler. arg ( "--crate-type" ) . arg ( "bin" ) ;
253
256
for cfg in & options. cfgs {
254
257
compiler. arg ( "--cfg" ) . arg ( & cfg) ;
You can’t perform that action at this time.
0 commit comments