@@ -251,9 +251,9 @@ macro_rules! options {
251
251
pub const parse_list: & str = "a space-separated list of strings" ;
252
252
pub const parse_opt_list: & str = parse_list;
253
253
pub const parse_opt_comma_list: & str = "a comma-separated list of strings" ;
254
- pub const parse_uint : & str = "a number" ;
255
- pub const parse_opt_uint : & str = parse_uint ;
256
- pub const parse_threads: & str = parse_uint ;
254
+ pub const parse_number : & str = "a number" ;
255
+ pub const parse_opt_number : & str = parse_number ;
256
+ pub const parse_threads: & str = parse_number ;
257
257
pub const parse_passes: & str = "a space-separated list of passes, or `all`" ;
258
258
pub const parse_panic_strategy: & str = "either `unwind` or `abort`" ;
259
259
pub const parse_relro_level: & str = "one of: `full`, `partial`, or `off`" ;
@@ -417,16 +417,16 @@ macro_rules! options {
417
417
}
418
418
}
419
419
420
- /// Use this for any uint option that has a static default.
421
- fn parse_uint ( slot: & mut usize , v: Option <& str >) -> bool {
420
+ /// Use this for any numeric option that has a static default.
421
+ fn parse_number< T : Copy + FromStr > ( slot: & mut T , v: Option <& str >) -> bool {
422
422
match v. and_then( |s| s. parse( ) . ok( ) ) {
423
423
Some ( i) => { * slot = i; true } ,
424
424
None => false
425
425
}
426
426
}
427
427
428
- /// Use this for any uint option that lacks a static default.
429
- fn parse_opt_uint ( slot: & mut Option <usize >, v: Option <& str >) -> bool {
428
+ /// Use this for any numeric option that lacks a static default.
429
+ fn parse_opt_number< T : Copy + FromStr > ( slot: & mut Option <T >, v: Option <& str >) -> bool {
430
430
match v {
431
431
Some ( s) => { * slot = s. parse( ) . ok( ) ; slot. is_some( ) }
432
432
None => false
@@ -787,13 +787,13 @@ options! {CodegenOptions, CodegenSetter, basic_codegen_options,
787
787
"this option is deprecated and does nothing" ) ,
788
788
code_model: Option <CodeModel > = ( None , parse_code_model, [ TRACKED ] ,
789
789
"choose the code model to use (`rustc --print code-models` for details)" ) ,
790
- codegen_units: Option <usize > = ( None , parse_opt_uint , [ UNTRACKED ] ,
790
+ codegen_units: Option <usize > = ( None , parse_opt_number , [ UNTRACKED ] ,
791
791
"divide crate into N units to optimize in parallel" ) ,
792
792
control_flow_guard: CFGuard = ( CFGuard :: Disabled , parse_cfguard, [ TRACKED ] ,
793
793
"use Windows Control Flow Guard (default: no)" ) ,
794
794
debug_assertions: Option <bool > = ( None , parse_opt_bool, [ TRACKED ] ,
795
795
"explicitly enable the `cfg(debug_assertions)` directive" ) ,
796
- debuginfo: usize = ( 0 , parse_uint , [ TRACKED ] ,
796
+ debuginfo: usize = ( 0 , parse_number , [ TRACKED ] ,
797
797
"debug info emission level (0 = no debug info, 1 = line tables only, \
798
798
2 = full debug info with variable and type information; default: 0)") ,
799
799
default_linker_libraries: bool = ( false , parse_bool, [ UNTRACKED ] ,
@@ -808,7 +808,7 @@ options! {CodegenOptions, CodegenSetter, basic_codegen_options,
808
808
"force use of unwind tables" ) ,
809
809
incremental: Option <String > = ( None , parse_opt_string, [ UNTRACKED ] ,
810
810
"enable incremental compilation" ) ,
811
- inline_threshold: Option <usize > = ( None , parse_opt_uint , [ TRACKED ] ,
811
+ inline_threshold: Option <u32 > = ( None , parse_opt_number , [ TRACKED ] ,
812
812
"set the threshold for inlining a function" ) ,
813
813
link_arg: ( /* redirected to link_args */ ) = ( ( ) , parse_string_push, [ UNTRACKED ] ,
814
814
"a single extra argument to append to the linker invocation (can be used several times)" ) ,
@@ -996,9 +996,9 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options,
996
996
"verify incr. comp. hashes of green query instances (default: no)" ) ,
997
997
inline_mir: Option <bool > = ( None , parse_opt_bool, [ TRACKED ] ,
998
998
"enable MIR inlining (default: no)" ) ,
999
- inline_mir_threshold: Option <usize > = ( None , parse_opt_uint , [ TRACKED ] ,
999
+ inline_mir_threshold: Option <usize > = ( None , parse_opt_number , [ TRACKED ] ,
1000
1000
"a default MIR inlining threshold (default: 50)" ) ,
1001
- inline_mir_hint_threshold: Option <usize > = ( None , parse_opt_uint , [ TRACKED ] ,
1001
+ inline_mir_hint_threshold: Option <usize > = ( None , parse_opt_number , [ TRACKED ] ,
1002
1002
"inlining threshold for functions with inline hint (default: 100)" ) ,
1003
1003
inline_in_all_cgus: Option <bool > = ( None , parse_opt_bool, [ TRACKED ] ,
1004
1004
"control whether `#[inline]` functions are in all CGUs" ) ,
@@ -1034,7 +1034,7 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options,
1034
1034
mir_emit_retag: bool = ( false , parse_bool, [ TRACKED ] ,
1035
1035
"emit Retagging MIR statements, interpreted e.g., by miri; implies -Zmir-opt-level=0 \
1036
1036
(default: no)") ,
1037
- mir_opt_level: Option <usize > = ( None , parse_opt_uint , [ TRACKED ] ,
1037
+ mir_opt_level: Option <usize > = ( None , parse_opt_number , [ TRACKED ] ,
1038
1038
"MIR optimization level (0-4; default: 1 in non optimized builds and 2 in optimized builds)" ) ,
1039
1039
mutable_noalias: Option <bool > = ( None , parse_opt_bool, [ TRACKED ] ,
1040
1040
"emit noalias metadata for mutable references (default: yes for LLVM >= 12, otherwise no)" ) ,
@@ -1155,7 +1155,7 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options,
1155
1155
"which mangling version to use for symbol names ('legacy' (default) or 'v0')" ) ,
1156
1156
teach: bool = ( false , parse_bool, [ TRACKED ] ,
1157
1157
"show extended diagnostic help (default: no)" ) ,
1158
- terminal_width: Option <usize > = ( None , parse_opt_uint , [ UNTRACKED ] ,
1158
+ terminal_width: Option <usize > = ( None , parse_opt_number , [ UNTRACKED ] ,
1159
1159
"set the current terminal width" ) ,
1160
1160
tune_cpu: Option <String > = ( None , parse_opt_string, [ TRACKED ] ,
1161
1161
"select processor to schedule for (`rustc --print target-cpus` for details)" ) ,
0 commit comments