diff options
| author | Lukas Markeffsky <@> | 2023-04-09 14:29:16 +0200 |
|---|---|---|
| committer | Lukas Markeffsky <@> | 2023-04-09 14:29:16 +0200 |
| commit | d9f99c36fe5122618a44caf393f9743e84a38c19 (patch) | |
| tree | 4d5c3811039d956718fc1e87473cd46ca2160289 | |
| parent | 709a97fffec5e09cb5feca894c394ee80c2680ba (diff) | |
| download | rust-d9f99c36fe5122618a44caf393f9743e84a38c19.tar.gz rust-d9f99c36fe5122618a44caf393f9743e84a38c19.zip | |
Use `Display` in top-level example for `PanicInfo`
| -rw-r--r-- | library/core/src/panic/panic_info.rs | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/library/core/src/panic/panic_info.rs b/library/core/src/panic/panic_info.rs index 0d385c9d187..06fbe083ca1 100644 --- a/library/core/src/panic/panic_info.rs +++ b/library/core/src/panic/panic_info.rs @@ -15,14 +15,10 @@ use crate::panic::Location; /// use std::panic; /// /// panic::set_hook(Box::new(|panic_info| { -/// if let Some(s) = panic_info.payload().downcast_ref::<&str>() { -/// println!("panic occurred: {s:?}"); -/// } else { -/// println!("panic occurred"); -/// } +/// println!("panic occurred: {panic_info}"); /// })); /// -/// panic!("Normal panic"); +/// panic!("critical system failure"); /// ``` #[lang = "panic_info"] #[stable(feature = "panic_hooks", since = "1.10.0")] |
