@@ -52,8 +52,8 @@ use rustc_metadata::locator;
5252use rustc_middle:: ty:: TyCtxt ;
5353use rustc_parse:: { new_parser_from_file, new_parser_from_source_str, unwrap_or_emit_fatal} ;
5454use rustc_session:: config:: {
55- CG_OPTIONS , ErrorOutputType , Input , OutFileName , OutputType , UnstableOptions , Z_OPTIONS ,
56- nightly_options,
55+ CG_OPTIONS , ErrorOutputType , Input , OptionDesc , OutFileName , OutputType , UnstableOptions ,
56+ Z_OPTIONS , nightly_options,
5757} ;
5858use rustc_session:: getopts:: { self , Matches } ;
5959use rustc_session:: lint:: { Lint , LintId } ;
@@ -1148,19 +1148,16 @@ fn describe_codegen_flags() {
11481148 print_flag_list( "-C" , config:: CG_OPTIONS ) ;
11491149}
11501150
1151- fn print_flag_list<T >(
1152- cmdline_opt: & str ,
1153- flag_list: & [ ( & ' static str , T , & ' static str , & ' static str , bool ) ] ,
1154- ) {
1151+ fn print_flag_list<T >( cmdline_opt: & str , flag_list: & [ OptionDesc <T >] ) {
11551152 let max_len =
1156- flag_list. iter( ) . map( |& ( name , _ , _ , _ , _ ) | name. chars( ) . count( ) ) . max( ) . unwrap_or( 0 ) ;
1153+ flag_list. iter( ) . map( |opt_desc| opt_desc . name( ) . chars( ) . count( ) ) . max( ) . unwrap_or( 0 ) ;
11571154
1158- for & ( name , _ , _ , desc , _ ) in flag_list {
1155+ for opt_desc in flag_list {
11591156 safe_println!(
11601157 " {} {:>width$}=val -- {}" ,
11611158 cmdline_opt,
1162- name. replace( '_' , "-" ) ,
1163- desc,
1159+ opt_desc . name( ) . replace( '_' , "-" ) ,
1160+ opt_desc . desc( ) ,
11641161 width = max_len
11651162 ) ;
11661163 }
@@ -1214,8 +1211,8 @@ pub fn handle_options(early_dcx: &EarlyDiagCtxt, args: &[String]) -> Option<geto
12141211 let msg: Option <String > = match e {
12151212 getopts:: Fail :: UnrecognizedOption ( ref opt) => CG_OPTIONS
12161213 . iter( )
1217- . map( |& ( name , .. ) | ( 'C' , name) )
1218- . chain( Z_OPTIONS . iter( ) . map( |& ( name , .. ) | ( 'Z' , name) ) )
1214+ . map( |opt_desc | ( 'C' , opt_desc . name( ) ) )
1215+ . chain( Z_OPTIONS . iter( ) . map( |opt_desc | ( 'Z' , opt_desc . name( ) ) ) )
12191216 . find( |& ( _, name) | * opt == name. replace( '_' , "-" ) )
12201217 . map( |( flag, _) | format!( "{e}. Did you mean `-{flag} {opt}`?" ) ) ,
12211218 getopts:: Fail :: ArgumentMissing ( ref opt) => {
0 commit comments