]> git.lizzy.rs Git - rust.git/commitdiff
Fix some minor issues
authorAmanieu d'Antras <amanieu@gmail.com>
Thu, 26 Dec 2019 18:37:14 +0000 (19:37 +0100)
committerAmanieu d'Antras <amanieu@gmail.com>
Mon, 2 Mar 2020 11:43:07 +0000 (11:43 +0000)
src/libpanic_abort/lib.rs
src/libpanic_unwind/lib.rs
src/libstd/panicking.rs

index ebc57860b9d4a47f2231c9a69f7506ff49396633..fe9196ef2314b09d06f2a358a8e32a7770d277b7 100644 (file)
 #![feature(panic_runtime)]
 #![feature(staged_api)]
 #![feature(rustc_attrs)]
-#![feature(raw)]
+
+use core::any::Any;
 
 #[rustc_std_internal_symbol]
-pub unsafe extern "C" fn __rust_cleanup(_: *mut u8) -> core::raw::TraitObject {
+pub unsafe extern "C" fn __rust_panic_cleanup(_: *mut u8) -> *mut (dyn Any + Send + 'static) {
     unreachable!()
 }
 
index 60ddf70cea52f2ec57590096d1abf349bfdeb7fe..ad82f22510c41d80bae791587d0de1351bbd3d84 100644 (file)
@@ -32,6 +32,7 @@
 #![feature(panic_runtime)]
 
 use alloc::boxed::Box;
+use core::any::Any;
 use core::panic::BoxMeUp;
 
 // If adding to this list, you should also look at libstd::panicking's identical
 mod dwarf;
 
 #[no_mangle]
-pub unsafe extern "C" fn __rust_panic_cleanup(payload: *mut u8) -> core::raw::TraitObject {
+pub unsafe extern "C" fn __rust_panic_cleanup(payload: *mut u8) -> *mut (dyn Any + Send + 'static) {
     let payload = payload as *mut imp::Payload;
     let payload = *(payload);
-    core::mem::transmute(imp::cleanup(payload))
+    Box::into_raw(imp::cleanup(payload))
 }
 
 // Entry point for raising an exception, just delegates to the platform-specific
index 3dd1f09e07656f819cdc024a4c641a0f123578e3..b02cedd5da5bf321d088329658fcd53afc695a53 100644 (file)
@@ -67,7 +67,7 @@
 extern "C" {
     /// The payload ptr here is actually the same as the payload ptr for the try
     /// intrinsic (i.e., is really `*mut [u64; 2]` or `*mut *mut u8`).
-    fn __rust_panic_cleanup(payload: *mut u8) -> core::raw::TraitObject;
+    fn __rust_panic_cleanup(payload: *mut u8) -> *mut (dyn Any + Send + 'static);
 
     /// `payload` is actually a `*mut &mut dyn BoxMeUp` but that would cause FFI warnings.
     /// It cannot be `Box<dyn BoxMeUp>` because the other end of this call does not depend
@@ -313,7 +313,7 @@ union Data<F, R> {
     // non-cold function, though, as of the writing of this comment).
     #[cold]
     unsafe fn cleanup(mut payload: Payload) -> Box<dyn Any + Send + 'static> {
-        let obj = crate::mem::transmute(__rust_panic_cleanup(&mut payload as *mut _ as *mut u8));
+        let obj = Box::from_raw(__rust_panic_cleanup(&mut payload as *mut _ as *mut u8));
         update_panic_count(-1);
         obj
     }