@@ -358,7 +358,7 @@ fn build_options<O: Default>(
358358
359359#[ allow( non_upper_case_globals) ]  
360360mod  desc { 
361-     pub ( crate )  const  parse_no_flag :  & str  = "no value" ; 
361+     pub ( crate )  const  parse_no_value :  & str  = "no value" ; 
362362    pub ( crate )  const  parse_bool:  & str  =
363363        "one of: `y`, `yes`, `on`, `true`, `n`, `no`, `off` or `false`" ; 
364364    pub ( crate )  const  parse_opt_bool:  & str  = parse_bool; 
@@ -462,14 +462,18 @@ pub mod parse {
462462    pub ( crate )  use  super :: * ; 
463463    pub ( crate )  const  MAX_THREADS_CAP :  usize  = 256 ; 
464464
465-     /// This is for boolean options that don't take a value and start with 
466-      /// `no-`. This style of option is deprecated. 
467-      pub ( crate )  fn  parse_no_flag ( slot :  & mut  bool ,  v :  Option < & str > )  -> bool  { 
465+     /// This is for boolean options that don't take a value, and are true simply 
466+      /// by existing on the command-line. 
467+      /// 
468+      /// This style of option is deprecated, and is mainly used by old options 
469+      /// beginning with `no-`. 
470+      pub ( crate )  fn  parse_no_value ( slot :  & mut  bool ,  v :  Option < & str > )  -> bool  { 
468471        match  v { 
469472            None  => { 
470473                * slot = true ; 
471474                true 
472475            } 
476+             // Trying to specify a value is always forbidden. 
473477            Some ( _)  => false , 
474478        } 
475479    } 
@@ -1609,16 +1613,16 @@ options! {
16091613        "perform LLVM link-time optimizations" ) , 
16101614    metadata:  Vec <String > = ( Vec :: new( ) ,  parse_list,  [ TRACKED ] , 
16111615        "metadata to mangle symbol names with" ) , 
1612-     no_prepopulate_passes:  bool  = ( false ,  parse_no_flag ,  [ TRACKED ] , 
1616+     no_prepopulate_passes:  bool  = ( false ,  parse_no_value ,  [ TRACKED ] , 
16131617        "give an empty list of passes to the pass manager" ) , 
16141618    no_redzone:  Option <bool > = ( None ,  parse_opt_bool,  [ TRACKED ] , 
16151619        "disable the use of the redzone" ) , 
16161620    #[ rustc_lint_opt_deny_field_access( "documented to do nothing" ) ] 
1617-     no_stack_check:  bool  = ( false ,  parse_no_flag ,  [ UNTRACKED ] , 
1621+     no_stack_check:  bool  = ( false ,  parse_no_value ,  [ UNTRACKED ] , 
16181622        "this option is deprecated and does nothing" ) , 
1619-     no_vectorize_loops:  bool  = ( false ,  parse_no_flag ,  [ TRACKED ] , 
1623+     no_vectorize_loops:  bool  = ( false ,  parse_no_value ,  [ TRACKED ] , 
16201624        "disable loop vectorization optimization passes" ) , 
1621-     no_vectorize_slp:  bool  = ( false ,  parse_no_flag ,  [ TRACKED ] , 
1625+     no_vectorize_slp:  bool  = ( false ,  parse_no_value ,  [ TRACKED ] , 
16221626        "disable LLVM's SLP vectorization pass" ) , 
16231627    opt_level:  String  = ( "0" . to_string( ) ,  parse_string,  [ TRACKED ] , 
16241628        "optimization level (0-3, s, or z; default: 0)" ) , 
@@ -1915,25 +1919,25 @@ options! {
19151919        "dump facts from NLL analysis into side files (default: no)" ) , 
19161920    nll_facts_dir:  String  = ( "nll-facts" . to_string( ) ,  parse_string,  [ UNTRACKED ] , 
19171921        "the directory the NLL facts are dumped into (default: `nll-facts`)" ) , 
1918-     no_analysis:  bool  = ( false ,  parse_no_flag ,  [ UNTRACKED ] , 
1922+     no_analysis:  bool  = ( false ,  parse_no_value ,  [ UNTRACKED ] , 
19191923        "parse and expand the source, but run no analysis" ) , 
1920-     no_codegen:  bool  = ( false ,  parse_no_flag ,  [ TRACKED_NO_CRATE_HASH ] , 
1924+     no_codegen:  bool  = ( false ,  parse_no_value ,  [ TRACKED_NO_CRATE_HASH ] , 
19211925        "run all passes except codegen; no output" ) , 
1922-     no_generate_arange_section:  bool  = ( false ,  parse_no_flag ,  [ TRACKED ] , 
1926+     no_generate_arange_section:  bool  = ( false ,  parse_no_value ,  [ TRACKED ] , 
19231927        "omit DWARF address ranges that give faster lookups" ) , 
19241928    no_implied_bounds_compat:  bool  = ( false ,  parse_bool,  [ TRACKED ] , 
19251929        "disable the compatibility version of the `implied_bounds_ty` query" ) , 
1926-     no_jump_tables:  bool  = ( false ,  parse_no_flag ,  [ TRACKED ] , 
1930+     no_jump_tables:  bool  = ( false ,  parse_no_value ,  [ TRACKED ] , 
19271931        "disable the jump tables and lookup tables that can be generated from a switch case lowering" ) , 
1928-     no_leak_check:  bool  = ( false ,  parse_no_flag ,  [ UNTRACKED ] , 
1932+     no_leak_check:  bool  = ( false ,  parse_no_value ,  [ UNTRACKED ] , 
19291933        "disable the 'leak check' for subtyping; unsound, but useful for tests" ) , 
1930-     no_link:  bool  = ( false ,  parse_no_flag ,  [ TRACKED ] , 
1934+     no_link:  bool  = ( false ,  parse_no_value ,  [ TRACKED ] , 
19311935        "compile without linking" ) , 
1932-     no_parallel_backend:  bool  = ( false ,  parse_no_flag ,  [ UNTRACKED ] , 
1936+     no_parallel_backend:  bool  = ( false ,  parse_no_value ,  [ UNTRACKED ] , 
19331937        "run LLVM in non-parallel mode (while keeping codegen-units and ThinLTO)" ) , 
1934-     no_profiler_runtime:  bool  = ( false ,  parse_no_flag ,  [ TRACKED ] , 
1938+     no_profiler_runtime:  bool  = ( false ,  parse_no_value ,  [ TRACKED ] , 
19351939        "prevent automatic injection of the profiler_builtins crate" ) , 
1936-     no_trait_vptr:  bool  = ( false ,  parse_no_flag ,  [ TRACKED ] , 
1940+     no_trait_vptr:  bool  = ( false ,  parse_no_value ,  [ TRACKED ] , 
19371941        "disable generation of trait vptr in vtable for upcasting" ) , 
19381942    no_unique_section_names:  bool  = ( false ,  parse_bool,  [ TRACKED ] , 
19391943        "do not use unique names for text and data sections when -Z function-sections is used" ) , 
@@ -1991,7 +1995,7 @@ options! {
19911995    proc_macro_execution_strategy:  ProcMacroExecutionStrategy  = ( ProcMacroExecutionStrategy :: SameThread , 
19921996        parse_proc_macro_execution_strategy,  [ UNTRACKED ] , 
19931997        "how to run proc-macro code (default: same-thread)" ) , 
1994-     profile_closures:  bool  = ( false ,  parse_no_flag ,  [ UNTRACKED ] , 
1998+     profile_closures:  bool  = ( false ,  parse_no_value ,  [ UNTRACKED ] , 
19951999        "profile size of closures" ) , 
19962000    profile_sample_use:  Option <PathBuf > = ( None ,  parse_opt_pathbuf,  [ TRACKED ] , 
19972001        "use the given `.prof` file for sampled profile-guided optimization (also known as AutoFDO)" ) , 
@@ -2165,8 +2169,14 @@ written to standard error output)"),
21652169        "enable unsound and buggy MIR optimizations (default: no)" ) , 
21662170    /// This name is kind of confusing: Most unstable options enable something themselves, while 
21672171     /// this just allows "normal" options to be feature-gated. 
2172+      /// 
2173+      /// The main check for `-Zunstable-options` takes place separately from the 
2174+      /// usual parsing of `-Z` options (see [`crate::config::nightly_options`]), 
2175+      /// so this boolean value is mostly used for enabling unstable _values_ of 
2176+      /// stable options. That separate check doesn't handle boolean values, so 
2177+      /// to avoid an inconsistent state we also forbid them here. 
21682178     #[ rustc_lint_opt_deny_field_access( "use `Session::unstable_options` instead of this field" ) ] 
2169-     unstable_options:  bool  = ( false ,  parse_bool ,  [ UNTRACKED ] , 
2179+     unstable_options:  bool  = ( false ,  parse_no_value ,  [ UNTRACKED ] , 
21702180        "adds unstable command line options to rustc interface (default: no)" ) , 
21712181    use_ctors_section:  Option <bool > = ( None ,  parse_opt_bool,  [ TRACKED ] , 
21722182        "use legacy .ctors section for initializers rather than .init_array" ) , 
0 commit comments