/// `true` if we're emitting a JSON blob containing the unused externs
json_unused_externs: bool [UNTRACKED],
- /// `true` if we're emitting a JSON job containg a future-incompat report for lints
+ /// `true` if we're emitting a JSON job containing a future-incompat report for lints
json_future_incompat: bool [TRACKED],
pretty: Option<PpMode> [UNTRACKED],
Some(value) => early_error(
error_format,
&format!(
- "incorrect value `{}` for {} option `{}` - {} was expected",
- value, outputname, key, type_desc
+ "incorrect value `{value}` for {outputname} option `{key}` - {type_desc} was expected"
),
),
}
}
}
- None => early_error(error_format, &format!("unknown {} option: `{}`", outputname, key)),
+ None => early_error(error_format, &format!("unknown {outputname} option: `{key}`")),
}
}
return op;
pub const parse_passes: &str = "a space-separated list of passes, or `all`";
pub const parse_panic_strategy: &str = "either `unwind` or `abort`";
pub const parse_opt_panic_strategy: &str = parse_panic_strategy;
+ pub const parse_oom_strategy: &str = "either `panic` or `abort`";
pub const parse_relro_level: &str = "one of: `full`, `partial`, or `off`";
pub const parse_sanitizers: &str = "comma separated list of sanitizers: `address`, `cfi`, `hwaddress`, `leak`, `memory`, `memtag`, or `thread`";
pub const parse_sanitizer_memory_track_origins: &str = "0, 1, or 2";
pub const parse_linker_plugin_lto: &str =
"either a boolean (`yes`, `no`, `on`, `off`, etc), or the path to the linker plugin";
pub const parse_location_detail: &str =
- "comma seperated list of location details to track: `file`, `line`, or `column`";
+ "comma separated list of location details to track: `file`, `line`, or `column`";
pub const parse_switch_with_opt_path: &str =
"an optional path to the profiling data output directory";
pub const parse_merge_functions: &str = "one of: `disabled`, `trampolines`, or `aliases`";
crate fn parse_threads(slot: &mut usize, v: Option<&str>) -> bool {
match v.and_then(|s| s.parse().ok()) {
Some(0) => {
- *slot = ::num_cpus::get();
+ *slot = std::thread::available_parallelism().map_or(1, std::num::NonZeroUsize::get);
true
}
Some(i) => {
true
}
+ crate fn parse_oom_strategy(slot: &mut OomStrategy, v: Option<&str>) -> bool {
+ match v {
+ Some("panic") => *slot = OomStrategy::Panic,
+ Some("abort") => *slot = OomStrategy::Abort,
+ _ => return false,
+ }
+ true
+ }
+
crate fn parse_relro_level(slot: &mut Option<RelroLevel>, v: Option<&str>) -> bool {
match v {
Some(s) => match s.parse::<RelroLevel>() {
}
}
- let v = match v {
- None => {
- *slot = Some(MirSpanview::Statement);
- return true;
- }
- Some(v) => v,
+ let Some(v) = v else {
+ *slot = Some(MirSpanview::Statement);
+ return true;
};
*slot = Some(match v.trim_end_matches('s') {
}
}
- let v = match v {
- None => {
- *slot = Some(InstrumentCoverage::All);
- return true;
- }
- Some(v) => v,
+ let Some(v) = v else {
+ *slot = Some(InstrumentCoverage::All);
+ return true;
};
*slot = Some(match v {
llvm_time_trace: bool = (false, parse_bool, [UNTRACKED],
"generate JSON tracing data file from LLVM data (default: no)"),
location_detail: LocationDetail = (LocationDetail::all(), parse_location_detail, [TRACKED],
- "comma seperated list of location details to be tracked when using caller_location \
+ "comma separated list of location details to be tracked when using caller_location \
valid options are `file`, `line`, and `column` (default: all)"),
ls: bool = (false, parse_bool, [UNTRACKED],
"list the symbols defined by a library crate (default: no)"),
"prevent automatic injection of the profiler_builtins crate"),
normalize_docs: bool = (false, parse_bool, [TRACKED],
"normalize associated items in rustdoc when generating documentation"),
+ oom: OomStrategy = (OomStrategy::Abort, parse_oom_strategy, [TRACKED],
+ "panic strategy for out-of-memory handling"),
osx_rpath_install_name: bool = (false, parse_bool, [TRACKED],
"pass `-install_name @rpath/...` to the macOS linker (default: no)"),
panic_abort_tests: bool = (false, parse_bool, [TRACKED],
"panic strategy for panics in drops"),
parse_only: bool = (false, parse_bool, [UNTRACKED],
"parse only; do not compile, assemble, or link (default: no)"),
- partially_uninit_const_threshold: Option<usize> = (None, parse_opt_number, [TRACKED],
- "allow generating const initializers with mixed init/uninit bytes, \
- and set the maximum total size of a const allocation for which this is allowed (default: never)"),
perf_stats: bool = (false, parse_bool, [UNTRACKED],
"print some performance-related statistics (default: no)"),
pick_stable_methods_before_any_unstable: bool = (true, parse_bool, [TRACKED],
"in diagnostics, use heuristics to shorten paths referring to items"),
ui_testing: bool = (false, parse_bool, [UNTRACKED],
"emit compiler diagnostics in a form suitable for UI testing (default: no)"),
+ uninit_const_chunk_threshold: usize = (16, parse_number, [TRACKED],
+ "allow generating const initializers with mixed init/uninit chunks, \
+ and set the maximum number of chunks for which this is allowed (default: 16)"),
unleash_the_miri_inside_of_you: bool = (false, parse_bool, [TRACKED],
"take the brakes off const evaluation. NOTE: this is unsound (default: no)"),
unpretty: Option<String> = (None, parse_unpretty, [UNTRACKED],
`normal`, `identified`,
`expanded`, `expanded,identified`,
`expanded,hygiene` (with internal representations),
- `everybody_loops` (all function bodies replaced with `loop {}`),
`ast-tree` (raw AST before expansion),
`ast-tree,expanded` (raw AST after expansion),
`hir` (the HIR), `hir,identified`,