@@ -231,6 +231,7 @@ macro_rules! options {
231
231
232
232
#[ allow( non_upper_case_globals, dead_code) ]
233
233
mod $mod_desc {
234
+ pub const parse_no_flag: & str = "no value" ;
234
235
pub const parse_bool: & str = "one of: `y`, `yes`, `on`, `n`, `no`, or `off`" ;
235
236
pub const parse_opt_bool: & str = parse_bool;
236
237
pub const parse_string: & str = "a string" ;
@@ -288,6 +289,15 @@ macro_rules! options {
288
289
}
289
290
) *
290
291
292
+ /// This is for boolean options that don't take a value and start with
293
+ /// `no-`. This style of option is deprecated.
294
+ fn parse_no_flag( slot: & mut bool , v: Option <& str >) -> bool {
295
+ match v {
296
+ None => { * slot = true ; true }
297
+ Some ( _) => false ,
298
+ }
299
+ }
300
+
291
301
/// Use this for any boolean option that has a static default.
292
302
fn parse_bool( slot: & mut bool , v: Option <& str >) -> bool {
293
303
match v {
@@ -640,12 +650,12 @@ options! {CodegenOptions, CodegenSetter, basic_codegen_options,
640
650
"set rpath values in libs/exes (default: no)" ) ,
641
651
overflow_checks: Option <bool > = ( None , parse_opt_bool, [ TRACKED ] ,
642
652
"use overflow checks for integer arithmetic" ) ,
643
- no_prepopulate_passes: bool = ( false , parse_bool , [ TRACKED ] ,
644
- "give an empty list of passes to the pass manager (default: no) " ) ,
645
- no_vectorize_loops: bool = ( false , parse_bool , [ TRACKED ] ,
646
- "disable loop vectorization optimization passes (default: no) " ) ,
647
- no_vectorize_slp: bool = ( false , parse_bool , [ TRACKED ] ,
648
- "disable LLVM's SLP vectorization pass (default: no) " ) ,
653
+ no_prepopulate_passes: bool = ( false , parse_no_flag , [ TRACKED ] ,
654
+ "give an empty list of passes to the pass manager" ) ,
655
+ no_vectorize_loops: bool = ( false , parse_no_flag , [ TRACKED ] ,
656
+ "disable loop vectorization optimization passes" ) ,
657
+ no_vectorize_slp: bool = ( false , parse_no_flag , [ TRACKED ] ,
658
+ "disable LLVM's SLP vectorization pass" ) ,
649
659
soft_float: bool = ( false , parse_bool, [ TRACKED ] ,
650
660
"use soft float ABI (*eabihf targets only) (default: no)" ) ,
651
661
prefer_dynamic: bool = ( false , parse_bool, [ TRACKED ] ,
@@ -664,7 +674,7 @@ options! {CodegenOptions, CodegenSetter, basic_codegen_options,
664
674
"divide crate into N units to optimize in parallel" ) ,
665
675
remark: Passes = ( Passes :: Some ( Vec :: new( ) ) , parse_passes, [ UNTRACKED ] ,
666
676
"print remarks for these optimization passes (space separated, or \" all\" )" ) ,
667
- no_stack_check: bool = ( false , parse_bool , [ UNTRACKED ] ,
677
+ no_stack_check: bool = ( false , parse_no_flag , [ UNTRACKED ] ,
668
678
"this option is deprecated and does nothing" ) ,
669
679
debuginfo: usize = ( 0 , parse_uint, [ TRACKED ] ,
670
680
"debug info emission level (0 = no debug info, 1 = line tables only, \
@@ -725,8 +735,8 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options,
725
735
"verify LLVM IR (default: no)" ) ,
726
736
borrowck_stats: bool = ( false , parse_bool, [ UNTRACKED ] ,
727
737
"gather borrowck statistics (default: no)" ) ,
728
- no_landing_pads: bool = ( false , parse_bool , [ TRACKED ] ,
729
- "omit landing pads for unwinding (default: no) " ) ,
738
+ no_landing_pads: bool = ( false , parse_no_flag , [ TRACKED ] ,
739
+ "omit landing pads for unwinding" ) ,
730
740
fewer_names: bool = ( false , parse_bool, [ TRACKED ] ,
731
741
"reduce memory use by retaining fewer names within compilation artifacts (LLVM-IR) \
732
742
(default: no)") ,
@@ -758,8 +768,8 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options,
758
768
"parse only; do not compile, assemble, or link (default: no)" ) ,
759
769
dual_proc_macros: bool = ( false , parse_bool, [ TRACKED ] ,
760
770
"load proc macros for both target and host, but only link to the target (default: no)" ) ,
761
- no_codegen: bool = ( false , parse_bool , [ TRACKED ] ,
762
- "run all passes except codegen; no output (default: no) " ) ,
771
+ no_codegen: bool = ( false , parse_no_flag , [ TRACKED ] ,
772
+ "run all passes except codegen; no output" ) ,
763
773
treat_err_as_bug: Option <usize > = ( None , parse_treat_err_as_bug, [ TRACKED ] ,
764
774
"treat error number `val` that occurs as bug" ) ,
765
775
report_delayed_bugs: bool = ( false , parse_bool, [ TRACKED ] ,
@@ -789,8 +799,8 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options,
789
799
(default: no)") ,
790
800
query_dep_graph: bool = ( false , parse_bool, [ UNTRACKED ] ,
791
801
"enable queries of the dependency graph for regression testing (default: no)" ) ,
792
- no_analysis: bool = ( false , parse_bool , [ UNTRACKED ] ,
793
- "parse and expand the source, but run no analysis (default: no) " ) ,
802
+ no_analysis: bool = ( false , parse_no_flag , [ UNTRACKED ] ,
803
+ "parse and expand the source, but run no analysis" ) ,
794
804
unstable_options: bool = ( false , parse_bool, [ UNTRACKED ] ,
795
805
"adds unstable command line options to rustc interface (default: no)" ) ,
796
806
force_overflow_checks: Option <bool > = ( None , parse_opt_bool, [ TRACKED ] ,
@@ -799,8 +809,8 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options,
799
809
"for every macro invocation, print its name and arguments (default: no)" ) ,
800
810
debug_macros: bool = ( false , parse_bool, [ TRACKED ] ,
801
811
"emit line numbers debug info inside macros (default: no)" ) ,
802
- no_generate_arange_section: bool = ( false , parse_bool , [ TRACKED ] ,
803
- "omit DWARF address ranges that give faster lookups (default: no) " ) ,
812
+ no_generate_arange_section: bool = ( false , parse_no_flag , [ TRACKED ] ,
813
+ "omit DWARF address ranges that give faster lookups" ) ,
804
814
keep_hygiene_data: bool = ( false , parse_bool, [ UNTRACKED ] ,
805
815
"keep hygiene data after analysis (default: no)" ) ,
806
816
show_span: Option <String > = ( None , parse_opt_string, [ TRACKED ] ,
@@ -862,7 +872,7 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options,
862
872
"extra arguments to prepend to the linker invocation (space separated)" ) ,
863
873
profile: bool = ( false , parse_bool, [ TRACKED ] ,
864
874
"insert profiling code (default: no)" ) ,
865
- no_profiler_runtime: bool = ( false , parse_bool , [ TRACKED ] ,
875
+ no_profiler_runtime: bool = ( false , parse_no_flag , [ TRACKED ] ,
866
876
"prevent automatic injection of the profiler_builtins crate" ) ,
867
877
relro_level: Option <RelroLevel > = ( None , parse_relro_level, [ TRACKED ] ,
868
878
"choose which RELRO level to use" ) ,
@@ -911,12 +921,12 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options,
911
921
(default: no)") ,
912
922
share_generics: Option <bool > = ( None , parse_opt_bool, [ TRACKED ] ,
913
923
"make the current crate share its generic instantiations" ) ,
914
- no_parallel_llvm: bool = ( false , parse_bool , [ UNTRACKED ] ,
915
- "run LLVM in non-parallel mode (while keeping codegen-units and ThinLTO) (default: no) " ) ,
916
- no_leak_check: bool = ( false , parse_bool , [ UNTRACKED ] ,
917
- "disable the 'leak check' for subtyping; unsound, but useful for tests (default: no) " ) ,
918
- no_interleave_lints: bool = ( false , parse_bool , [ UNTRACKED ] ,
919
- "execute lints separately; allows benchmarking individual lints (default: no) " ) ,
924
+ no_parallel_llvm: bool = ( false , parse_no_flag , [ UNTRACKED ] ,
925
+ "run LLVM in non-parallel mode (while keeping codegen-units and ThinLTO)" ) ,
926
+ no_leak_check: bool = ( false , parse_no_flag , [ UNTRACKED ] ,
927
+ "disable the 'leak check' for subtyping; unsound, but useful for tests" ) ,
928
+ no_interleave_lints: bool = ( false , parse_no_flag , [ UNTRACKED ] ,
929
+ "execute lints separately; allows benchmarking individual lints" ) ,
920
930
crate_attr: Vec <String > = ( Vec :: new( ) , parse_string_push, [ TRACKED ] ,
921
931
"inject the given attribute in the crate" ) ,
922
932
self_profile: SwitchWithOptPath = ( SwitchWithOptPath :: Disabled ,
@@ -953,8 +963,8 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options,
953
963
"deduplicate identical diagnostics (default: yes)" ) ,
954
964
control_flow_guard: CFGuard = ( CFGuard :: Disabled , parse_cfguard, [ UNTRACKED ] ,
955
965
"use Windows Control Flow Guard (`disabled`, `nochecks` or `checks`)" ) ,
956
- no_link: bool = ( false , parse_bool , [ TRACKED ] ,
957
- "compile without linking (default: no) " ) ,
966
+ no_link: bool = ( false , parse_no_flag , [ TRACKED ] ,
967
+ "compile without linking" ) ,
958
968
link_only: bool = ( false , parse_bool, [ TRACKED ] ,
959
969
"link the `.rlink` file generated by `-Z no-link` (default: no)" ) ,
960
970
new_llvm_pass_manager: bool = ( false , parse_bool, [ TRACKED ] ,
0 commit comments