@@ -6,6 +6,7 @@ use std::path::PathBuf;
66use std:: str:: FromStr ;
77
88use rustc_data_structures:: fx:: FxHashMap ;
9+ use rustc_driver:: print_flag_list;
910use rustc_session:: config:: {
1011 self , parse_crate_types_from_list, parse_externs, parse_target_triple, CrateType ,
1112} ;
@@ -305,11 +306,12 @@ impl RenderOptions {
305306impl Options {
306307 /// Parses the given command-line for options. If an error message or other early-return has
307308 /// 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 ..] ;
309311 // Check for unstable options.
310312 nightly_options:: check_nightly_options ( matches, & opts ( ) ) ;
311313
312- if matches. opt_present ( "h" ) || matches. opt_present ( "help" ) {
314+ if args . is_empty ( ) || matches. opt_present ( "h" ) || matches. opt_present ( "help" ) {
313315 crate :: usage ( "rustdoc" ) ;
314316 return Err ( 0 ) ;
315317 } else if matches. opt_present ( "version" ) {
@@ -330,6 +332,21 @@ impl Options {
330332 // check for deprecated options
331333 check_deprecated_options ( matches, & diag) ;
332334
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+ }
333350 if matches. opt_strs ( "passes" ) == [ "list" ] {
334351 println ! ( "Available passes for running rustdoc:" ) ;
335352 for pass in passes:: PASSES {
@@ -410,6 +427,7 @@ impl Options {
410427 }
411428 return Err ( 0 ) ;
412429 }
430+ let ( _lint_opts, _describe_lints, _lint_cap) = get_cmd_lint_options ( matches, error_format) ;
413431
414432 if matches. free . is_empty ( ) {
415433 diag. struct_err ( "missing file operand" ) . emit ( ) ;
0 commit comments