about summary refs log tree commit diff
path: root/library/std/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-09-21 01:02:00 +0000
committerbors <bors@rust-lang.org>2023-09-21 01:02:00 +0000
commitcbce15c6173cd0fcd4abe25c108067d32f1135b4 (patch)
tree2f3b907d724e65d9a293265c17ee725302382361 /library/std/src
parent3223b0b5e8dadda3f76c3fd1a8d6c5addc09599e (diff)
parent156d2e274649491ec385b51264582d9384ca9271 (diff)
downloadrust-cbce15c6173cd0fcd4abe25c108067d32f1135b4.tar.gz
rust-cbce15c6173cd0fcd4abe25c108067d32f1135b4.zip
Auto merge of #116013 - matthiaskrgr:rollup-mv5i4fd, r=matthiaskrgr
Rollup of 4 pull requests

Successful merges:

 - #114394 (style-guide: Document formatting of `as` casts (mostly like a binary operator))
 - #115990 (Allow anyone to set llvm-fixed-upstream)
 - #116008 (Rename BoxMeUp to PanicPayload.)
 - #116011 (Update browser-ui-test version to 0.16.10)

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'library/std/src')
-rw-r--r--library/std/src/panicking.rs42
1 files changed, 21 insertions, 21 deletions
diff --git a/library/std/src/panicking.rs b/library/std/src/panicking.rs
index 9d066c82a89..d7a2baa1ff5 100644
--- a/library/std/src/panicking.rs
+++ b/library/std/src/panicking.rs
@@ -10,7 +10,7 @@
 #![deny(unsafe_op_in_unsafe_fn)]
 
 use crate::panic::BacktraceStyle;
-use core::panic::{BoxMeUp, Location, PanicInfo};
+use core::panic::{Location, PanicInfo, PanicPayload};
 
 use crate::any::Any;
 use crate::fmt;
@@ -47,9 +47,9 @@ extern "C" {
 }
 
 extern "Rust" {
-    /// `BoxMeUp` lazily performs allocation only when needed (this avoids
+    /// `PanicPayload` lazily performs allocation only when needed (this avoids
     /// allocations when using the "abort" panic runtime).
-    fn __rust_start_panic(payload: &mut dyn BoxMeUp) -> u32;
+    fn __rust_start_panic(payload: &mut dyn PanicPayload) -> u32;
 }
 
 /// This function is called by the panic runtime if FFI code catches a Rust
@@ -543,14 +543,14 @@ pub fn panicking() -> bool {
 #[cfg(not(test))]
 #[panic_handler]
 pub fn begin_panic_handler(info: &PanicInfo<'_>) -> ! {
-    struct PanicPayload<'a> {
+    struct FormatStringPayload<'a> {
         inner: &'a fmt::Arguments<'a>,
         string: Option<String>,
     }
 
-    impl<'a> PanicPayload<'a> {
-        fn new(inner: &'a fmt::Arguments<'a>) -> PanicPayload<'a> {
-            PanicPayload { inner, string: None }
+    impl<'a> FormatStringPayload<'a> {
+        fn new(inner: &'a fmt::Arguments<'a>) -> Self {
+            Self { inner, string: None }
         }
 
         fn fill(&mut self) -> &mut String {
@@ -566,7 +566,7 @@ pub fn begin_panic_handler(info: &PanicInfo<'_>) -> ! {
         }
     }
 
-    unsafe impl<'a> BoxMeUp for PanicPayload<'a> {
+    unsafe impl<'a> PanicPayload for FormatStringPayload<'a> {
         fn take_box(&mut self) -> *mut (dyn Any + Send) {
             // We do two allocations here, unfortunately. But (a) they're required with the current
             // scheme, and (b) we don't handle panic + OOM properly anyway (see comment in
@@ -580,9 +580,9 @@ pub fn begin_panic_handler(info: &PanicInfo<'_>) -> ! {
         }
     }
 
-    struct StrPanicPayload(&'static str);
+    struct StaticStrPayload(&'static str);
 
-    unsafe impl BoxMeUp for StrPanicPayload {
+    unsafe impl PanicPayload for StaticStrPayload {
         fn take_box(&mut self) -> *mut (dyn Any + Send) {
             Box::into_raw(Box::new(self.0))
         }
@@ -599,7 +599,7 @@ pub fn begin_panic_handler(info: &PanicInfo<'_>) -> ! {
         // `rust_panic_with_hook` construct a new `PanicInfo`?
         if let Some(msg) = msg.as_str() {
             rust_panic_with_hook(
-                &mut StrPanicPayload(msg),
+                &mut StaticStrPayload(msg),
                 info.message(),
                 loc,
                 info.can_unwind(),
@@ -607,7 +607,7 @@ pub fn begin_panic_handler(info: &PanicInfo<'_>) -> ! {
             );
         } else {
             rust_panic_with_hook(
-                &mut PanicPayload::new(msg),
+                &mut FormatStringPayload::new(msg),
                 info.message(),
                 loc,
                 info.can_unwind(),
@@ -637,7 +637,7 @@ pub const fn begin_panic<M: Any + Send>(msg: M) -> ! {
     let loc = Location::caller();
     return crate::sys_common::backtrace::__rust_end_short_backtrace(move || {
         rust_panic_with_hook(
-            &mut PanicPayload::new(msg),
+            &mut Payload::new(msg),
             None,
             loc,
             /* can_unwind */ true,
@@ -645,17 +645,17 @@ pub const fn begin_panic<M: Any + Send>(msg: M) -> ! {
         )
     });
 
-    struct PanicPayload<A> {
+    struct Payload<A> {
         inner: Option<A>,
     }
 
-    impl<A: Send + 'static> PanicPayload<A> {
-        fn new(inner: A) -> PanicPayload<A> {
-            PanicPayload { inner: Some(inner) }
+    impl<A: Send + 'static> Payload<A> {
+        fn new(inner: A) -> Payload<A> {
+            Payload { inner: Some(inner) }
         }
     }
 
-    unsafe impl<A: Send + 'static> BoxMeUp for PanicPayload<A> {
+    unsafe impl<A: Send + 'static> PanicPayload for Payload<A> {
         fn take_box(&mut self) -> *mut (dyn Any + Send) {
             // Note that this should be the only allocation performed in this code path. Currently
             // this means that panic!() on OOM will invoke this code path, but then again we're not
@@ -684,7 +684,7 @@ pub const fn begin_panic<M: Any + Send>(msg: M) -> ! {
 /// panics, panic hooks, and finally dispatching to the panic runtime to either
 /// abort or unwind.
 fn rust_panic_with_hook(
-    payload: &mut dyn BoxMeUp,
+    payload: &mut dyn PanicPayload,
     message: Option<&fmt::Arguments<'_>>,
     location: &Location<'_>,
     can_unwind: bool,
@@ -760,7 +760,7 @@ pub fn rust_panic_without_hook(payload: Box<dyn Any + Send>) -> ! {
 
     struct RewrapBox(Box<dyn Any + Send>);
 
-    unsafe impl BoxMeUp for RewrapBox {
+    unsafe impl PanicPayload for RewrapBox {
         fn take_box(&mut self) -> *mut (dyn Any + Send) {
             Box::into_raw(mem::replace(&mut self.0, Box::new(())))
         }
@@ -777,7 +777,7 @@ pub fn rust_panic_without_hook(payload: Box<dyn Any + Send>) -> ! {
 /// yer breakpoints.
 #[inline(never)]
 #[cfg_attr(not(test), rustc_std_internal_symbol)]
-fn rust_panic(msg: &mut dyn BoxMeUp) -> ! {
+fn rust_panic(msg: &mut dyn PanicPayload) -> ! {
     let code = unsafe { __rust_start_panic(msg) };
     rtabort!("failed to initiate panic, error {code}")
 }