about summary refs log tree commit diff
path: root/library/std/src/panic.rs
diff options
context:
space:
mode:
authorMara Bos <m-ou.se@m-ou.se>2023-10-02 14:14:15 +0200
committerMara Bos <m-ou.se@m-ou.se>2024-06-11 15:46:59 +0200
commit0642cb2994c192b9e910855b7c9a258376c8e0ff (patch)
tree9b1c68f5288d502bfa2bc0f1a4e2aa599368bfcd /library/std/src/panic.rs
parent0266bbf6e4be7b025f4798046121607c587e94cb (diff)
downloadrust-0642cb2994c192b9e910855b7c9a258376c8e0ff.tar.gz
rust-0642cb2994c192b9e910855b7c9a258376c8e0ff.zip
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.
Diffstat (limited to 'library/std/src/panic.rs')
-rw-r--r--library/std/src/panic.rs15
1 files changed, 3 insertions, 12 deletions
diff --git a/library/std/src/panic.rs b/library/std/src/panic.rs
index e2d182b4ba0..7adbce859f5 100644
--- a/library/std/src/panic.rs
+++ b/library/std/src/panic.rs
@@ -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.