Rollup merge of #122963 - RalfJung:core-panicking, r=m-ou-se

core/panicking: fix outdated comment

Looks like this function got renamed/changed at some point and the comment did not get updated.

r? `@m-ou-se`
This commit is contained in:
Matthias Krüger 2024-03-24 01:05:54 +01:00 committed by GitHub
commit 6f16b41a4b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -132,11 +132,11 @@ const fn comptime(fmt: fmt::Arguments<'_>, _force_no_backtrace: bool) -> ! {
#[rustc_const_unstable(feature = "panic_internals", issue = "none")]
#[lang = "panic"] // needed by codegen for panic on overflow and other `Assert` MIR terminators
pub const fn panic(expr: &'static str) -> ! {
// Use Arguments::new_v1 instead of format_args!("{expr}") to potentially
// Use Arguments::new_const instead of format_args!("{expr}") to potentially
// reduce size overhead. The format_args! macro uses str's Display trait to
// write expr, which calls Formatter::pad, which must accommodate string
// truncation and padding (even though none is used here). Using
// Arguments::new_v1 may allow the compiler to omit Formatter::pad from the
// Arguments::new_const may allow the compiler to omit Formatter::pad from the
// output binary, saving up to a few kilobytes.
panic_fmt(fmt::Arguments::new_const(&[expr]));
}