diff options
| author | Mara Bos <m-ou.se@m-ou.se> | 2023-09-26 14:40:50 +0200 |
|---|---|---|
| committer | Mara Bos <m-ou.se@m-ou.se> | 2024-06-11 15:46:59 +0200 |
| commit | 16dfc6ddc114efa7174e2daa972916bbd2f67d87 (patch) | |
| tree | 12946d1df80c4e0f61c5b4c5073321d2704641d2 /library/core/src/panic | |
| parent | a519dc85f8aa1348ec9cdc46906bbcbb9d115981 (diff) | |
| download | rust-16dfc6ddc114efa7174e2daa972916bbd2f67d87.tar.gz rust-16dfc6ddc114efa7174e2daa972916bbd2f67d87.zip | |
Add core::panic::PanicInfo::payload() for compatibility.
Diffstat (limited to 'library/core/src/panic')
| -rw-r--r-- | library/core/src/panic/panic_info.rs | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/library/core/src/panic/panic_info.rs b/library/core/src/panic/panic_info.rs index 6a600e2d431..5b784ff4f80 100644 --- a/library/core/src/panic/panic_info.rs +++ b/library/core/src/panic/panic_info.rs @@ -81,6 +81,24 @@ impl<'a> PanicInfo<'a> { Some(&self.location) } + /// Returns the payload associated with the panic. + /// + /// On `core::panic::PanicInfo`, this method never returns anything useful. + /// It only exists because of compatibility with [`std::panic::PanicInfo`], + /// which used to be the same type. + /// + /// See [`std::panic::PanicInfo::payload`]. + /// + /// [`std::panic::PanicInfo`]: ../../std/panic/struct.PanicInfo.html + /// [`std::panic::PanicInfo::payload`]: ../../std/panic/struct.PanicInfo.html#method.payload + #[deprecated(since = "1.74.0", note = "this never returns anything useful")] + #[stable(feature = "panic_hooks", since = "1.10.0")] + #[allow(deprecated, deprecated_in_future)] + pub fn payload(&self) -> &(dyn crate::any::Any + Send) { + struct NoPayload; + &NoPayload + } + /// Returns whether the panic handler is allowed to unwind the stack from /// the point where the panic occurred. /// |
