rust/library/core/src/panic
Matthias Krüger 5107c4c556
Rollup merge of #110110 - lukas-code:display-panic-info, r=JohnTitor
Use `Display` in top-level example for `PanicInfo`

Addresses https://github.com/rust-lang/rust/issues/110098.

This confused me as well, when I was writing a `no_std` panic handler for the first time, so here's a better top-level example.

`Display` is stable, prints the `.message()` if available, and falls back to `.payload().downcast_ref<&str>()` if the message is not available. So this example should provide strictly more information and also work for formatted panics.

The old example still exists on the `payload` method.
2023-04-14 21:11:12 +02:00
..
location.rs Change tracking issue from #76156 to #102911 2022-10-11 06:40:37 +00:00
panic_info.rs Use Display in top-level example for PanicInfo 2023-04-09 14:29:16 +02:00
unwind_safe.rs Update unwind_safe.rs 2023-04-12 18:21:56 -07:00