@@ -29,7 +29,7 @@ use std::sync::atomic::{AtomicUsize, Ordering};
29
29
use std:: sync:: { Arc , Mutex } ;
30
30
31
31
use crate :: clean:: { types:: AttributesExt , Attributes } ;
32
- use crate :: config:: Options ;
32
+ use crate :: config:: Options as RustdocOptions ;
33
33
use crate :: html:: markdown:: { self , ErrorCodes , Ignore , LangString } ;
34
34
use crate :: lint:: init_lints;
35
35
use crate :: passes:: span_of_attrs;
@@ -43,7 +43,7 @@ crate struct GlobalTestOptions {
43
43
crate attrs : Vec < String > ,
44
44
}
45
45
46
- crate fn run ( options : Options ) -> Result < ( ) , ErrorReported > {
46
+ crate fn run ( options : RustdocOptions ) -> Result < ( ) , ErrorReported > {
47
47
let input = config:: Input :: File ( options. input . clone ( ) ) ;
48
48
49
49
let invalid_codeblock_attributes_name = crate :: lint:: INVALID_CODEBLOCK_ATTRIBUTES . name ;
@@ -293,7 +293,7 @@ fn run_test(
293
293
test : & str ,
294
294
crate_name : & str ,
295
295
line : usize ,
296
- options : Options ,
296
+ rustdoc_options : RustdocOptions ,
297
297
mut lang_string : LangString ,
298
298
no_run : bool ,
299
299
runtool : Option < String > ,
@@ -311,16 +311,16 @@ fn run_test(
311
311
312
312
let output_file = outdir. path ( ) . join ( "rust_out" ) ;
313
313
314
- let rustc_binary = options
314
+ let rustc_binary = rustdoc_options
315
315
. test_builder
316
316
. as_deref ( )
317
317
. unwrap_or_else ( || rustc_interface:: util:: rustc_path ( ) . expect ( "found rustc" ) ) ;
318
318
let mut compiler = Command :: new ( & rustc_binary) ;
319
319
compiler. arg ( "--crate-type" ) . arg ( "bin" ) ;
320
- for cfg in & options . cfgs {
320
+ for cfg in & rustdoc_options . cfgs {
321
321
compiler. arg ( "--cfg" ) . arg ( & cfg) ;
322
322
}
323
- if let Some ( sysroot) = options . maybe_sysroot {
323
+ if let Some ( sysroot) = rustdoc_options . maybe_sysroot {
324
324
compiler. arg ( "--sysroot" ) . arg ( sysroot) ;
325
325
}
326
326
compiler. arg ( "--edition" ) . arg ( & edition. to_string ( ) ) ;
@@ -330,26 +330,26 @@ fn run_test(
330
330
if lang_string. test_harness {
331
331
compiler. arg ( "--test" ) ;
332
332
}
333
- if options . json_unused_externs && !lang_string. compile_fail {
333
+ if rustdoc_options . json_unused_externs && !lang_string. compile_fail {
334
334
compiler. arg ( "--error-format=json" ) ;
335
335
compiler. arg ( "--json" ) . arg ( "unused-externs" ) ;
336
336
compiler. arg ( "-Z" ) . arg ( "unstable-options" ) ;
337
337
compiler. arg ( "-W" ) . arg ( "unused_crate_dependencies" ) ;
338
338
}
339
- for lib_str in & options . lib_strs {
339
+ for lib_str in & rustdoc_options . lib_strs {
340
340
compiler. arg ( "-L" ) . arg ( & lib_str) ;
341
341
}
342
- for extern_str in & options . extern_strs {
342
+ for extern_str in & rustdoc_options . extern_strs {
343
343
compiler. arg ( "--extern" ) . arg ( & extern_str) ;
344
344
}
345
345
compiler. arg ( "-Ccodegen-units=1" ) ;
346
- for codegen_options_str in & options . codegen_options_strs {
346
+ for codegen_options_str in & rustdoc_options . codegen_options_strs {
347
347
compiler. arg ( "-C" ) . arg ( & codegen_options_str) ;
348
348
}
349
- for debugging_option_str in & options . debugging_opts_strs {
349
+ for debugging_option_str in & rustdoc_options . debugging_opts_strs {
350
350
compiler. arg ( "-Z" ) . arg ( & debugging_option_str) ;
351
351
}
352
- if no_run && !lang_string. compile_fail && options . persist_doctests . is_none ( ) {
352
+ if no_run && !lang_string. compile_fail && rustdoc_options . persist_doctests . is_none ( ) {
353
353
compiler. arg ( "--emit=metadata" ) ;
354
354
}
355
355
compiler. arg ( "--target" ) . arg ( match target {
@@ -358,7 +358,7 @@ fn run_test(
358
358
path. to_str ( ) . expect ( "target path must be valid unicode" ) . to_string ( )
359
359
}
360
360
} ) ;
361
- if let ErrorOutputType :: HumanReadable ( kind) = options . error_format {
361
+ if let ErrorOutputType :: HumanReadable ( kind) = rustdoc_options . error_format {
362
362
let ( short, color_config) = kind. unzip ( ) ;
363
363
364
364
if short {
@@ -452,11 +452,11 @@ fn run_test(
452
452
} else {
453
453
cmd = Command :: new ( output_file) ;
454
454
}
455
- if let Some ( run_directory) = options . test_run_directory {
455
+ if let Some ( run_directory) = rustdoc_options . test_run_directory {
456
456
cmd. current_dir ( run_directory) ;
457
457
}
458
458
459
- let result = if options . nocapture {
459
+ let result = if rustdoc_options . nocapture {
460
460
cmd. status ( ) . map ( |status| process:: Output {
461
461
status,
462
462
stdout : Vec :: new ( ) ,
@@ -802,7 +802,7 @@ crate struct Collector {
802
802
// the `names` vector of that test will be `["Title", "Subtitle"]`.
803
803
names : Vec < String > ,
804
804
805
- options : Options ,
805
+ rustdoc_options : RustdocOptions ,
806
806
use_headers : bool ,
807
807
enable_per_target_ignores : bool ,
808
808
crate_name : Symbol ,
@@ -818,7 +818,7 @@ crate struct Collector {
818
818
impl Collector {
819
819
crate fn new (
820
820
crate_name : Symbol ,
821
- options : Options ,
821
+ rustdoc_options : RustdocOptions ,
822
822
use_headers : bool ,
823
823
opts : GlobalTestOptions ,
824
824
source_map : Option < Lrc < SourceMap > > ,
@@ -828,7 +828,7 @@ impl Collector {
828
828
Collector {
829
829
tests : Vec :: new ( ) ,
830
830
names : Vec :: new ( ) ,
831
- options ,
831
+ rustdoc_options ,
832
832
use_headers,
833
833
enable_per_target_ignores,
834
834
crate_name,
@@ -882,14 +882,14 @@ impl Tester for Collector {
882
882
let name = self . generate_name ( line, & filename) ;
883
883
let crate_name = self . crate_name . to_string ( ) ;
884
884
let opts = self . opts . clone ( ) ;
885
- let edition = config. edition . unwrap_or ( self . options . edition ) ;
886
- let options = self . options . clone ( ) ;
887
- let runtool = self . options . runtool . clone ( ) ;
888
- let runtool_args = self . options . runtool_args . clone ( ) ;
889
- let target = self . options . target . clone ( ) ;
885
+ let edition = config. edition . unwrap_or ( self . rustdoc_options . edition ) ;
886
+ let rustdoc_options = self . rustdoc_options . clone ( ) ;
887
+ let runtool = self . rustdoc_options . runtool . clone ( ) ;
888
+ let runtool_args = self . rustdoc_options . runtool_args . clone ( ) ;
889
+ let target = self . rustdoc_options . target . clone ( ) ;
890
890
let target_str = target. to_string ( ) ;
891
891
let unused_externs = self . unused_extern_reports . clone ( ) ;
892
- let no_run = config. no_run || options . no_run ;
892
+ let no_run = config. no_run || rustdoc_options . no_run ;
893
893
if !config. compile_fail {
894
894
self . compiling_test_count . fetch_add ( 1 , Ordering :: SeqCst ) ;
895
895
}
@@ -923,7 +923,7 @@ impl Tester for Collector {
923
923
self . visited_tests. entry( ( file. clone( ) , line) ) . and_modify( |v| * v += 1 ) . or_insert( 0 )
924
924
} ,
925
925
) ;
926
- let outdir = if let Some ( mut path) = options . persist_doctests . clone ( ) {
926
+ let outdir = if let Some ( mut path) = rustdoc_options . persist_doctests . clone ( ) {
927
927
path. push ( & test_id) ;
928
928
929
929
std:: fs:: create_dir_all ( & path)
@@ -963,7 +963,7 @@ impl Tester for Collector {
963
963
& test,
964
964
& crate_name,
965
965
line,
966
- options ,
966
+ rustdoc_options ,
967
967
config,
968
968
no_run,
969
969
runtool,
0 commit comments