From 518722eccfc6954e73e617e0624ba6216b667c17 Mon Sep 17 00:00:00 2001 From: Mara Bos Date: Thu, 16 May 2024 11:49:55 +0200 Subject: [PATCH] Downcast panic payload to String too in example. --- std/src/panic.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/std/src/panic.rs b/std/src/panic.rs index 0f999f6a93e4a..51228cc990751 100644 --- a/std/src/panic.rs +++ b/std/src/panic.rs @@ -73,6 +73,8 @@ impl<'a> PanicHookInfo<'a> { /// panic::set_hook(Box::new(|panic_info| { /// if let Some(s) = panic_info.payload().downcast_ref::<&str>() { /// println!("panic occurred: {s:?}"); + /// } else if let Some(s) = panic_info.payload().downcast_ref::() { + /// println!("panic occurred: {s:?}"); /// } else { /// println!("panic occurred"); /// }