@@ -52,8 +52,8 @@ use rustc_metadata::locator;
52
52
use rustc_middle:: ty:: TyCtxt ;
53
53
use rustc_parse:: { new_parser_from_file, new_parser_from_source_str, unwrap_or_emit_fatal} ;
54
54
use 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,
57
57
} ;
58
58
use rustc_session:: getopts:: { self , Matches } ;
59
59
use rustc_session:: lint:: { Lint , LintId } ;
@@ -1148,19 +1148,16 @@ fn describe_codegen_flags() {
1148
1148
print_flag_list( "-C" , config:: CG_OPTIONS ) ;
1149
1149
}
1150
1150
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 >] ) {
1155
1152
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 ) ;
1157
1154
1158
- for & ( name , _ , _ , desc , _ ) in flag_list {
1155
+ for opt_desc in flag_list {
1159
1156
safe_println!(
1160
1157
" {} {:>width$}=val -- {}" ,
1161
1158
cmdline_opt,
1162
- name. replace( '_' , "-" ) ,
1163
- desc,
1159
+ opt_desc . name( ) . replace( '_' , "-" ) ,
1160
+ opt_desc . desc( ) ,
1164
1161
width = max_len
1165
1162
) ;
1166
1163
}
@@ -1214,8 +1211,8 @@ pub fn handle_options(early_dcx: &EarlyDiagCtxt, args: &[String]) -> Option<geto
1214
1211
let msg: Option <String > = match e {
1215
1212
getopts:: Fail :: UnrecognizedOption ( ref opt) => CG_OPTIONS
1216
1213
. 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( ) ) ) )
1219
1216
. find( |& ( _, name) | * opt == name. replace( '_' , "-" ) )
1220
1217
. map( |( flag, _) | format!( "{e}. Did you mean `-{flag} {opt}`?" ) ) ,
1221
1218
getopts:: Fail :: ArgumentMissing ( ref opt) => {
0 commit comments