Gate fmt args flattening behind -Zflatten-format-args.
This commit is contained in:
parent
1d59081bfd
commit
995e57b89e
@ -16,8 +16,11 @@ pub(crate) fn lower_format_args(&mut self, sp: Span, fmt: &FormatArgs) -> hir::E
|
||||
// Never call the const constructor of `fmt::Arguments` if the
|
||||
// format_args!() had any arguments _before_ flattening/inlining.
|
||||
let allow_const = fmt.arguments.all_args().is_empty();
|
||||
let fmt = flatten_format_args(Cow::Borrowed(fmt));
|
||||
let fmt = inline_literals(fmt);
|
||||
let mut fmt = Cow::Borrowed(fmt);
|
||||
if self.tcx.sess.opts.unstable_opts.flatten_format_args {
|
||||
fmt = flatten_format_args(fmt);
|
||||
fmt = inline_literals(fmt);
|
||||
}
|
||||
expand_format_args(self, sp, &fmt, allow_const)
|
||||
}
|
||||
}
|
||||
|
@ -744,6 +744,7 @@ macro_rules! tracked {
|
||||
tracked!(emit_thin_lto, false);
|
||||
tracked!(export_executable_symbols, true);
|
||||
tracked!(fewer_names, Some(true));
|
||||
tracked!(flatten_format_args, true);
|
||||
tracked!(force_unstable_if_unmarked, true);
|
||||
tracked!(fuel, Some(("abc".to_string(), 99)));
|
||||
tracked!(function_sections, Some(false));
|
||||
|
@ -1422,6 +1422,9 @@ pub(crate) fn parse_proc_macro_execution_strategy(
|
||||
fewer_names: Option<bool> = (None, parse_opt_bool, [TRACKED],
|
||||
"reduce memory use by retaining fewer names within compilation artifacts (LLVM-IR) \
|
||||
(default: no)"),
|
||||
flatten_format_args: bool = (false, parse_bool, [TRACKED],
|
||||
"flatten nested format_args!() and literals into a simplified format_args!() call \
|
||||
(default: no)"),
|
||||
force_unstable_if_unmarked: bool = (false, parse_bool, [TRACKED],
|
||||
"force all crates to be `rustc_private` unstable (default: no)"),
|
||||
fuel: Option<(String, u64)> = (None, parse_optimization_fuel, [TRACKED],
|
||||
|
Loading…
Reference in New Issue
Block a user