diff options
| author | Mara Bos <m-ou.se@m-ou.se> | 2024-05-16 11:54:11 +0200 |
|---|---|---|
| committer | Mara Bos <m-ou.se@m-ou.se> | 2024-06-11 15:47:00 +0200 |
| commit | 32bfe703e2f8b5062a769aa1b3467c80d5bb0b95 (patch) | |
| tree | 54a9abfcc2c1615d1474eb03456fbfd61178fae1 /library/std/src/panic.rs | |
| parent | ce0bc8bd588f9a2a4ba149ae6a9d3490f401c376 (diff) | |
| download | rust-32bfe703e2f8b5062a769aa1b3467c80d5bb0b95.tar.gz rust-32bfe703e2f8b5062a769aa1b3467c80d5bb0b95.zip | |
Add note on panic payload type.
Diffstat (limited to 'library/std/src/panic.rs')
| -rw-r--r-- | library/std/src/panic.rs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/library/std/src/panic.rs b/library/std/src/panic.rs index 51228cc9907..d5566caa369 100644 --- a/library/std/src/panic.rs +++ b/library/std/src/panic.rs @@ -63,6 +63,13 @@ impl<'a> PanicHookInfo<'a> { /// /// This will commonly, but not always, be a `&'static str` or [`String`]. /// + /// A invocation of the `panic!()` macro in Rust 2021 or later will always result in a + /// panic payload of type `&'static str` or `String`. + /// + /// Only an invocation of [`panic_any`] + /// (or, in Rust 2018 and earlier, `panic!(x)` where `x` is something other than a string) + /// can result in a panic payload other than a `&'static str` or `String`. + /// /// [`String`]: ../../std/string/struct.String.html /// /// # Examples |
