Rename parse_no_flag
to parse_no_value
The old name and comment suggest that this parser is only used for options beginning with `no-`, which is mostly true but not entirely true.
This commit is contained in:
parent
5ec7d6eee7
commit
0a619dd8ff
1 changed files with 22 additions and 18 deletions
|
@ -358,7 +358,7 @@ fn build_options<O: Default>(
|
||||||
|
|
||||||
#[allow(non_upper_case_globals)]
|
#[allow(non_upper_case_globals)]
|
||||||
mod desc {
|
mod desc {
|
||||||
pub(crate) const parse_no_flag: &str = "no value";
|
pub(crate) const parse_no_value: &str = "no value";
|
||||||
pub(crate) const parse_bool: &str =
|
pub(crate) const parse_bool: &str =
|
||||||
"one of: `y`, `yes`, `on`, `true`, `n`, `no`, `off` or `false`";
|
"one of: `y`, `yes`, `on`, `true`, `n`, `no`, `off` or `false`";
|
||||||
pub(crate) const parse_opt_bool: &str = parse_bool;
|
pub(crate) const parse_opt_bool: &str = parse_bool;
|
||||||
|
@ -462,14 +462,18 @@ pub mod parse {
|
||||||
pub(crate) use super::*;
|
pub(crate) use super::*;
|
||||||
pub(crate) const MAX_THREADS_CAP: usize = 256;
|
pub(crate) const MAX_THREADS_CAP: usize = 256;
|
||||||
|
|
||||||
/// This is for boolean options that don't take a value and start with
|
/// This is for boolean options that don't take a value, and are true simply
|
||||||
/// `no-`. This style of option is deprecated.
|
/// by existing on the command-line.
|
||||||
pub(crate) fn parse_no_flag(slot: &mut bool, v: Option<&str>) -> bool {
|
///
|
||||||
|
/// This style of option is deprecated, and is mainly used by old options
|
||||||
|
/// beginning with `no-`.
|
||||||
|
pub(crate) fn parse_no_value(slot: &mut bool, v: Option<&str>) -> bool {
|
||||||
match v {
|
match v {
|
||||||
None => {
|
None => {
|
||||||
*slot = true;
|
*slot = true;
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
// Trying to specify a value is always forbidden.
|
||||||
Some(_) => false,
|
Some(_) => false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1609,16 +1613,16 @@ options! {
|
||||||
"perform LLVM link-time optimizations"),
|
"perform LLVM link-time optimizations"),
|
||||||
metadata: Vec<String> = (Vec::new(), parse_list, [TRACKED],
|
metadata: Vec<String> = (Vec::new(), parse_list, [TRACKED],
|
||||||
"metadata to mangle symbol names with"),
|
"metadata to mangle symbol names with"),
|
||||||
no_prepopulate_passes: bool = (false, parse_no_flag, [TRACKED],
|
no_prepopulate_passes: bool = (false, parse_no_value, [TRACKED],
|
||||||
"give an empty list of passes to the pass manager"),
|
"give an empty list of passes to the pass manager"),
|
||||||
no_redzone: Option<bool> = (None, parse_opt_bool, [TRACKED],
|
no_redzone: Option<bool> = (None, parse_opt_bool, [TRACKED],
|
||||||
"disable the use of the redzone"),
|
"disable the use of the redzone"),
|
||||||
#[rustc_lint_opt_deny_field_access("documented to do nothing")]
|
#[rustc_lint_opt_deny_field_access("documented to do nothing")]
|
||||||
no_stack_check: bool = (false, parse_no_flag, [UNTRACKED],
|
no_stack_check: bool = (false, parse_no_value, [UNTRACKED],
|
||||||
"this option is deprecated and does nothing"),
|
"this option is deprecated and does nothing"),
|
||||||
no_vectorize_loops: bool = (false, parse_no_flag, [TRACKED],
|
no_vectorize_loops: bool = (false, parse_no_value, [TRACKED],
|
||||||
"disable loop vectorization optimization passes"),
|
"disable loop vectorization optimization passes"),
|
||||||
no_vectorize_slp: bool = (false, parse_no_flag, [TRACKED],
|
no_vectorize_slp: bool = (false, parse_no_value, [TRACKED],
|
||||||
"disable LLVM's SLP vectorization pass"),
|
"disable LLVM's SLP vectorization pass"),
|
||||||
opt_level: String = ("0".to_string(), parse_string, [TRACKED],
|
opt_level: String = ("0".to_string(), parse_string, [TRACKED],
|
||||||
"optimization level (0-3, s, or z; default: 0)"),
|
"optimization level (0-3, s, or z; default: 0)"),
|
||||||
|
@ -1917,25 +1921,25 @@ options! {
|
||||||
"dump facts from NLL analysis into side files (default: no)"),
|
"dump facts from NLL analysis into side files (default: no)"),
|
||||||
nll_facts_dir: String = ("nll-facts".to_string(), parse_string, [UNTRACKED],
|
nll_facts_dir: String = ("nll-facts".to_string(), parse_string, [UNTRACKED],
|
||||||
"the directory the NLL facts are dumped into (default: `nll-facts`)"),
|
"the directory the NLL facts are dumped into (default: `nll-facts`)"),
|
||||||
no_analysis: bool = (false, parse_no_flag, [UNTRACKED],
|
no_analysis: bool = (false, parse_no_value, [UNTRACKED],
|
||||||
"parse and expand the source, but run no analysis"),
|
"parse and expand the source, but run no analysis"),
|
||||||
no_codegen: bool = (false, parse_no_flag, [TRACKED_NO_CRATE_HASH],
|
no_codegen: bool = (false, parse_no_value, [TRACKED_NO_CRATE_HASH],
|
||||||
"run all passes except codegen; no output"),
|
"run all passes except codegen; no output"),
|
||||||
no_generate_arange_section: bool = (false, parse_no_flag, [TRACKED],
|
no_generate_arange_section: bool = (false, parse_no_value, [TRACKED],
|
||||||
"omit DWARF address ranges that give faster lookups"),
|
"omit DWARF address ranges that give faster lookups"),
|
||||||
no_implied_bounds_compat: bool = (false, parse_bool, [TRACKED],
|
no_implied_bounds_compat: bool = (false, parse_bool, [TRACKED],
|
||||||
"disable the compatibility version of the `implied_bounds_ty` query"),
|
"disable the compatibility version of the `implied_bounds_ty` query"),
|
||||||
no_jump_tables: bool = (false, parse_no_flag, [TRACKED],
|
no_jump_tables: bool = (false, parse_no_value, [TRACKED],
|
||||||
"disable the jump tables and lookup tables that can be generated from a switch case lowering"),
|
"disable the jump tables and lookup tables that can be generated from a switch case lowering"),
|
||||||
no_leak_check: bool = (false, parse_no_flag, [UNTRACKED],
|
no_leak_check: bool = (false, parse_no_value, [UNTRACKED],
|
||||||
"disable the 'leak check' for subtyping; unsound, but useful for tests"),
|
"disable the 'leak check' for subtyping; unsound, but useful for tests"),
|
||||||
no_link: bool = (false, parse_no_flag, [TRACKED],
|
no_link: bool = (false, parse_no_value, [TRACKED],
|
||||||
"compile without linking"),
|
"compile without linking"),
|
||||||
no_parallel_backend: bool = (false, parse_no_flag, [UNTRACKED],
|
no_parallel_backend: bool = (false, parse_no_value, [UNTRACKED],
|
||||||
"run LLVM in non-parallel mode (while keeping codegen-units and ThinLTO)"),
|
"run LLVM in non-parallel mode (while keeping codegen-units and ThinLTO)"),
|
||||||
no_profiler_runtime: bool = (false, parse_no_flag, [TRACKED],
|
no_profiler_runtime: bool = (false, parse_no_value, [TRACKED],
|
||||||
"prevent automatic injection of the profiler_builtins crate"),
|
"prevent automatic injection of the profiler_builtins crate"),
|
||||||
no_trait_vptr: bool = (false, parse_no_flag, [TRACKED],
|
no_trait_vptr: bool = (false, parse_no_value, [TRACKED],
|
||||||
"disable generation of trait vptr in vtable for upcasting"),
|
"disable generation of trait vptr in vtable for upcasting"),
|
||||||
no_unique_section_names: bool = (false, parse_bool, [TRACKED],
|
no_unique_section_names: bool = (false, parse_bool, [TRACKED],
|
||||||
"do not use unique names for text and data sections when -Z function-sections is used"),
|
"do not use unique names for text and data sections when -Z function-sections is used"),
|
||||||
|
@ -1993,7 +1997,7 @@ options! {
|
||||||
proc_macro_execution_strategy: ProcMacroExecutionStrategy = (ProcMacroExecutionStrategy::SameThread,
|
proc_macro_execution_strategy: ProcMacroExecutionStrategy = (ProcMacroExecutionStrategy::SameThread,
|
||||||
parse_proc_macro_execution_strategy, [UNTRACKED],
|
parse_proc_macro_execution_strategy, [UNTRACKED],
|
||||||
"how to run proc-macro code (default: same-thread)"),
|
"how to run proc-macro code (default: same-thread)"),
|
||||||
profile_closures: bool = (false, parse_no_flag, [UNTRACKED],
|
profile_closures: bool = (false, parse_no_value, [UNTRACKED],
|
||||||
"profile size of closures"),
|
"profile size of closures"),
|
||||||
profile_sample_use: Option<PathBuf> = (None, parse_opt_pathbuf, [TRACKED],
|
profile_sample_use: Option<PathBuf> = (None, parse_opt_pathbuf, [TRACKED],
|
||||||
"use the given `.prof` file for sampled profile-guided optimization (also known as AutoFDO)"),
|
"use the given `.prof` file for sampled profile-guided optimization (also known as AutoFDO)"),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue