Rollup merge of #116007 - m-ou-se:const-panic-fmt-panic-display, r=oli-obk
Call panic_display directly in const_panic_fmt. `panic_str` just directly calls `panic_display`. The only reason `panic_str` exists, is for a lint to detect an expansion of `panic_2015!(expr)` (which expands to `panic_str`). It is `panic_display` that is hooked by const-eval, which is the reason we call it here. Part of https://github.com/rust-lang/rust/issues/116005 r? ``@oli-obk``
This commit is contained in:
commit
0d2c603b12
1 changed files with 2 additions and 1 deletions
|
@ -234,7 +234,8 @@ fn panic_in_cleanup() -> ! {
|
|||
#[rustc_const_unstable(feature = "core_panic", issue = "none")]
|
||||
pub const fn const_panic_fmt(fmt: fmt::Arguments<'_>) -> ! {
|
||||
if let Some(msg) = fmt.as_str() {
|
||||
panic_str(msg);
|
||||
// The panic_display function is hooked by const eval.
|
||||
panic_display(&msg);
|
||||
} else {
|
||||
// SAFETY: This is only evaluated at compile time, which reliably
|
||||
// handles this UB (in case this branch turns out to be reachable
|
||||
|
|
Loading…
Add table
Reference in a new issue