Skip to content

Commit 518722e

Browse files
committed
Downcast panic payload to String too in example.
1 parent c4dea81 commit 518722e

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

std/src/panic.rs

+2
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,8 @@ impl<'a> PanicHookInfo<'a> {
7373
/// panic::set_hook(Box::new(|panic_info| {
7474
/// if let Some(s) = panic_info.payload().downcast_ref::<&str>() {
7575
/// println!("panic occurred: {s:?}");
76+
/// } else if let Some(s) = panic_info.payload().downcast_ref::<String>() {
77+
/// println!("panic occurred: {s:?}");
7678
/// } else {
7779
/// println!("panic occurred");
7880
/// }

0 commit comments

Comments
 (0)