Skip to content

Commit f54b64f

Browse files
Rollup merge of rust-lang#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 rust-lang#116005 r? `@oli-obk`
2 parents f7c7254 + 667bba4 commit f54b64f

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

library/core/src/panicking.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,8 @@ fn panic_in_cleanup() -> ! {
234234
#[rustc_const_unstable(feature = "core_panic", issue = "none")]
235235
pub const fn const_panic_fmt(fmt: fmt::Arguments<'_>) -> ! {
236236
if let Some(msg) = fmt.as_str() {
237-
panic_str(msg);
237+
// The panic_display function is hooked by const eval.
238+
panic_display(&msg);
238239
} else {
239240
// SAFETY: This is only evaluated at compile time, which reliably
240241
// handles this UB (in case this branch turns out to be reachable

0 commit comments

Comments
 (0)