We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent b9f1a07 commit d2fb2fbCopy full SHA for d2fb2fb
src/libcore/panic.rs
@@ -30,7 +30,11 @@ use fmt;
30
/// use std::panic;
31
///
32
/// panic::set_hook(Box::new(|panic_info| {
33
-/// println!("panic occurred: {:?}", panic_info.payload().downcast_ref::<&str>().unwrap());
+/// if let Some(s) = panic_info.payload().downcast_ref::<&str>() {
34
+/// println!("panic occurred: {:?}", s);
35
+/// } else {
36
+/// println!("panic occurred");
37
+/// }
38
/// }));
39
40
/// panic!("Normal panic");
0 commit comments