Remove std::panic::PanicInfo::internal_constructor+set_payload.
We can just set the payload immediately in the constructor, and the constructor does not need to be public.
This commit is contained in:
parent
0266bbf6e4
commit
0642cb2994
2 changed files with 7 additions and 21 deletions
|
@ -44,23 +44,14 @@ pub struct PanicInfo<'a> {
|
|||
}
|
||||
|
||||
impl<'a> PanicInfo<'a> {
|
||||
#[unstable(feature = "panic_internals", issue = "none")]
|
||||
#[doc(hidden)]
|
||||
#[inline]
|
||||
pub fn internal_constructor(
|
||||
pub(crate) fn new(
|
||||
location: &'a Location<'a>,
|
||||
payload: &'a (dyn Any + Send),
|
||||
can_unwind: bool,
|
||||
force_no_backtrace: bool,
|
||||
) -> Self {
|
||||
struct NoPayload;
|
||||
PanicInfo { payload: &NoPayload, location, can_unwind, force_no_backtrace }
|
||||
}
|
||||
|
||||
#[unstable(feature = "panic_internals", issue = "none")]
|
||||
#[doc(hidden)]
|
||||
#[inline]
|
||||
pub fn set_payload(&mut self, info: &'a (dyn Any + Send)) {
|
||||
self.payload = info;
|
||||
PanicInfo { payload, location, can_unwind, force_no_backtrace }
|
||||
}
|
||||
|
||||
/// Returns the payload associated with the panic.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue