about summary refs log tree commit diff
path: root/library/core/src/panicking.rs
diff options
context:
space:
mode:
Diffstat (limited to 'library/core/src/panicking.rs')
-rw-r--r--library/core/src/panicking.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/library/core/src/panicking.rs b/library/core/src/panicking.rs
index 5078eea07a1..d857b4948b5 100644
--- a/library/core/src/panicking.rs
+++ b/library/core/src/panicking.rs
@@ -56,6 +56,14 @@ pub const fn panic_str(expr: &str) -> ! {
     panic_display(&expr);
 }
 
+#[cfg(not(bootstrap))]
+#[inline]
+#[track_caller]
+#[rustc_diagnostic_item = "unreachable_display"] // needed for `non-fmt-panics` lint
+pub fn unreachable_display<T: fmt::Display>(x: &T) -> ! {
+    panic_fmt(format_args!("internal error: entered unreachable code: {}", *x));
+}
+
 #[inline]
 #[track_caller]
 #[lang = "panic_display"] // needed for const-evaluated panics