@@ -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
} ;
@@ -305,11 +306,12 @@ impl RenderOptions {
305
306
impl Options {
306
307
/// Parses the given command-line for options. If an error message or other early-return has
307
308
/// been printed, returns `Err` with the exit code.
308
- crate fn from_matches ( matches : & getopts:: Matches ) -> Result < Options , i32 > {
309
+ crate fn from_matches ( matches : & getopts:: Matches , args : Vec < String > ) -> Result < Options , i32 > {
310
+ let args = & args[ 1 ..] ;
309
311
// Check for unstable options.
310
312
nightly_options:: check_nightly_options ( matches, & opts ( ) ) ;
311
313
312
- if matches. opt_present ( "h" ) || matches. opt_present ( "help" ) {
314
+ if args . is_empty ( ) || matches. opt_present ( "h" ) || matches. opt_present ( "help" ) {
313
315
crate :: usage ( "rustdoc" ) ;
314
316
return Err ( 0 ) ;
315
317
} else if matches. opt_present ( "version" ) {
@@ -330,6 +332,21 @@ impl Options {
330
332
// check for deprecated options
331
333
check_deprecated_options ( matches, & diag) ;
332
334
335
+ let z_flags = matches. opt_strs ( "Z" ) ;
336
+ if z_flags. iter ( ) . any ( |x| * x == "help" ) {
337
+ print_flag_list ( "-Z" , config:: DB_OPTIONS ) ;
338
+ return Err ( 0 ) ;
339
+ }
340
+ let c_flags = matches. opt_strs ( "C" ) ;
341
+ if c_flags. iter ( ) . any ( |x| * x == "help" ) {
342
+ print_flag_list ( "-C" , config:: CG_OPTIONS ) ;
343
+ return Err ( 0 ) ;
344
+ }
345
+ let w_flags = matches. opt_strs ( "W" ) ;
346
+ if w_flags. iter ( ) . any ( |x| * x == "help" ) {
347
+ print_flag_list ( "-W" , config:: DB_OPTIONS ) ;
348
+ return Err ( 0 ) ;
349
+ }
333
350
if matches. opt_strs ( "passes" ) == [ "list" ] {
334
351
println ! ( "Available passes for running rustdoc:" ) ;
335
352
for pass in passes:: PASSES {
@@ -410,6 +427,7 @@ impl Options {
410
427
}
411
428
return Err ( 0 ) ;
412
429
}
430
+ let ( _lint_opts, _describe_lints, _lint_cap) = get_cmd_lint_options ( matches, error_format) ;
413
431
414
432
if matches. free . is_empty ( ) {
415
433
diag. struct_err ( "missing file operand" ) . emit ( ) ;
0 commit comments