issue = "44489")]
use any::Any;
+use fmt;
/// A struct providing information about a panic.
///
#[derive(Debug)]
pub struct PanicInfo<'a> {
payload: &'a (Any + Send),
+ message: Option<&'a fmt::Arguments<'a>>,
location: Location<'a>,
}
and related macros",
issue = "0")]
#[doc(hidden)]
- pub fn internal_constructor(payload: &'a (Any + Send), location: Location<'a>,) -> Self {
- PanicInfo { payload, location }
+ pub fn internal_constructor(payload: &'a (Any + Send),
+ message: Option<&'a fmt::Arguments<'a>>,
+ location: Location<'a>)
+ -> Self {
+ PanicInfo { payload, location, message }
}
/// Returns the payload associated with the panic.
self.payload
}
+ /// If the `panic!` macro from the `core` crate (not from `std`)
+ /// was used with a formatting string and some additional arguments,
+ /// returns that message ready to be used for example with [`fmt::write`]
+ ///
+ /// [`fmt::write`]: ../fmt/fn.write.html
+ #[unstable(feature = "panic_info_message", issue = "44489")]
+ pub fn message(&self) -> Option<&fmt::Arguments> {
+ self.message
+ }
+
/// Returns information about the location from which the panic originated,
/// if available.
///