Gate fmt args flattening behind -Zflatten-format-args.
This commit is contained in:
parent
1d59081bfd
commit
995e57b89e
3 changed files with 9 additions and 2 deletions
|
@ -16,8 +16,11 @@ impl<'hir> LoweringContext<'_, 'hir> {
|
||||||
// Never call the const constructor of `fmt::Arguments` if the
|
// Never call the const constructor of `fmt::Arguments` if the
|
||||||
// format_args!() had any arguments _before_ flattening/inlining.
|
// format_args!() had any arguments _before_ flattening/inlining.
|
||||||
let allow_const = fmt.arguments.all_args().is_empty();
|
let allow_const = fmt.arguments.all_args().is_empty();
|
||||||
let fmt = flatten_format_args(Cow::Borrowed(fmt));
|
let mut fmt = Cow::Borrowed(fmt);
|
||||||
let fmt = inline_literals(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)
|
expand_format_args(self, sp, &fmt, allow_const)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -744,6 +744,7 @@ fn test_unstable_options_tracking_hash() {
|
||||||
tracked!(emit_thin_lto, false);
|
tracked!(emit_thin_lto, false);
|
||||||
tracked!(export_executable_symbols, true);
|
tracked!(export_executable_symbols, true);
|
||||||
tracked!(fewer_names, Some(true));
|
tracked!(fewer_names, Some(true));
|
||||||
|
tracked!(flatten_format_args, true);
|
||||||
tracked!(force_unstable_if_unmarked, true);
|
tracked!(force_unstable_if_unmarked, true);
|
||||||
tracked!(fuel, Some(("abc".to_string(), 99)));
|
tracked!(fuel, Some(("abc".to_string(), 99)));
|
||||||
tracked!(function_sections, Some(false));
|
tracked!(function_sections, Some(false));
|
||||||
|
|
|
@ -1422,6 +1422,9 @@ options! {
|
||||||
fewer_names: Option<bool> = (None, parse_opt_bool, [TRACKED],
|
fewer_names: Option<bool> = (None, parse_opt_bool, [TRACKED],
|
||||||
"reduce memory use by retaining fewer names within compilation artifacts (LLVM-IR) \
|
"reduce memory use by retaining fewer names within compilation artifacts (LLVM-IR) \
|
||||||
(default: no)"),
|
(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_unstable_if_unmarked: bool = (false, parse_bool, [TRACKED],
|
||||||
"force all crates to be `rustc_private` unstable (default: no)"),
|
"force all crates to be `rustc_private` unstable (default: no)"),
|
||||||
fuel: Option<(String, u64)> = (None, parse_optimization_fuel, [TRACKED],
|
fuel: Option<(String, u64)> = (None, parse_optimization_fuel, [TRACKED],
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue