@@ -6,6 +6,7 @@ use std::path::PathBuf;
6
6
use std:: str:: FromStr ;
7
7
8
8
use rustc_data_structures:: fx:: FxHashMap ;
9
+ use rustc_driver:: print_flag_list;
9
10
use rustc_session:: config:: {
10
11
self , parse_crate_types_from_list, parse_externs, parse_target_triple, CrateType ,
11
12
} ;
@@ -310,11 +311,12 @@ impl RenderOptions {
310
311
impl Options {
311
312
/// Parses the given command-line for options. If an error message or other early-return has
312
313
/// been printed, returns `Err` with the exit code.
313
- pub ( crate ) fn from_matches ( matches : & getopts:: Matches ) -> Result < Options , i32 > {
314
+ pub ( crate ) fn from_matches ( matches : & getopts:: Matches , args : Vec < String > ) -> Result < Options , i32 > {
315
+ let args = & args[ 1 ..] ;
314
316
// Check for unstable options.
315
317
nightly_options:: check_nightly_options ( matches, & opts ( ) ) ;
316
318
317
- if matches. opt_present ( "h" ) || matches. opt_present ( "help" ) {
319
+ if args . is_empty ( ) || matches. opt_present ( "h" ) || matches. opt_present ( "help" ) {
318
320
crate :: usage ( "rustdoc" ) ;
319
321
return Err ( 0 ) ;
320
322
} else if matches. opt_present ( "version" ) {
@@ -335,6 +337,21 @@ impl Options {
335
337
// check for deprecated options
336
338
check_deprecated_options ( matches, & diag) ;
337
339
340
+ let z_flags = matches. opt_strs ( "Z" ) ;
341
+ if z_flags. iter ( ) . any ( |x| * x == "help" ) {
342
+ print_flag_list ( "-Z" , config:: DB_OPTIONS ) ;
343
+ return Err ( 0 ) ;
344
+ }
345
+ let c_flags = matches. opt_strs ( "C" ) ;
346
+ if c_flags. iter ( ) . any ( |x| * x == "help" ) {
347
+ print_flag_list ( "-C" , config:: CG_OPTIONS ) ;
348
+ return Err ( 0 ) ;
349
+ }
350
+ let w_flags = matches. opt_strs ( "W" ) ;
351
+ if w_flags. iter ( ) . any ( |x| * x == "help" ) {
352
+ print_flag_list ( "-W" , config:: DB_OPTIONS ) ;
353
+ return Err ( 0 ) ;
354
+ }
338
355
if matches. opt_strs ( "passes" ) == [ "list" ] {
339
356
println ! ( "Available passes for running rustdoc:" ) ;
340
357
for pass in passes:: PASSES {
@@ -415,6 +432,7 @@ impl Options {
415
432
}
416
433
return Err ( 0 ) ;
417
434
}
435
+ let ( _lint_opts, _describe_lints, _lint_cap) = get_cmd_lint_options ( matches, error_format) ;
418
436
419
437
if matches. free . is_empty ( ) {
420
438
diag. struct_err ( "missing file operand" ) . emit ( ) ;
0 commit comments