about summary refs log tree commit diff
path: root/library/std
diff options
context:
space:
mode:
authorbjorn3 <17426603+bjorn3@users.noreply.github.com>2022-10-06 16:45:16 +0000
committerbjorn3 <17426603+bjorn3@users.noreply.github.com>2023-03-26 16:40:18 +0000
commitb874502a2064fef93cb25aebf31b8ea1c5a41621 (patch)
tree61892d1b8b54d61c77b774c2750f3b3e943ee5ac /library/std
parent89c2e3d3d75486e52473de3ae38f0ca6efeffef2 (diff)
downloadrust-b874502a2064fef93cb25aebf31b8ea1c5a41621.tar.gz
rust-b874502a2064fef93cb25aebf31b8ea1c5a41621.zip
Remove unnecessary raw pointer in __rust_start_panic arg
It is no longer necessary as __rust_start_panic switched to the Rust abi.
Diffstat (limited to 'library/std')
-rw-r--r--library/std/src/panicking.rs15
1 files changed, 5 insertions, 10 deletions
diff --git a/library/std/src/panicking.rs b/library/std/src/panicking.rs
index e59f32af77d..e505466e535 100644
--- a/library/std/src/panicking.rs
+++ b/library/std/src/panicking.rs
@@ -46,12 +46,10 @@ extern "C" {
     fn __rust_panic_cleanup(payload: *mut u8) -> *mut (dyn Any + Send + 'static);
 }
 
-#[allow(improper_ctypes)]
 extern "Rust" {
-    /// `payload` is passed through another layer of raw pointers as `&mut dyn Trait` is not
-    /// FFI-safe. `BoxMeUp` lazily performs allocation only when needed (this avoids allocations
-    /// when using the "abort" panic runtime).
-    fn __rust_start_panic(payload: *mut &mut dyn BoxMeUp) -> u32;
+    /// `BoxMeUp` lazily performs allocation only when needed (this avoids
+    /// allocations when using the "abort" panic runtime).
+    fn __rust_start_panic(payload: &mut dyn BoxMeUp) -> u32;
 }
 
 /// This function is called by the panic runtime if FFI code catches a Rust
@@ -738,10 +736,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(mut msg: &mut dyn BoxMeUp) -> ! {
-    let code = unsafe {
-        let obj = &mut msg as *mut &mut dyn BoxMeUp;
-        __rust_start_panic(obj)
-    };
+fn rust_panic(msg: &mut dyn BoxMeUp) -> ! {
+    let code = unsafe { __rust_start_panic(msg) };
     rtabort!("failed to initiate panic, error {code}")
 }