File tree 2 files changed +5
-4
lines changed
2 files changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -105,7 +105,7 @@ pub unsafe extern "C" fn __rust_panic_cleanup(payload: *mut u8) -> *mut (dyn Any
105
105
#[ rustc_std_internal_symbol]
106
106
#[ unwind( allowed) ]
107
107
pub unsafe extern "C" fn __rust_start_panic ( payload : * mut & mut dyn BoxMeUp ) -> u32 {
108
- let payload = ( * payload) . take_box ( ) ;
108
+ let payload = Box :: from_raw ( ( * payload) . take_box ( ) ) ;
109
109
110
- imp:: panic ( Box :: from_raw ( payload) )
110
+ imp:: panic ( payload)
111
111
}
Original file line number Diff line number Diff line change @@ -44,8 +44,9 @@ use realstd::io::set_output_capture;
44
44
extern "C" {
45
45
fn __rust_panic_cleanup ( payload : * mut u8 ) -> * mut ( dyn Any + Send + ' static ) ;
46
46
47
- /// `payload` is actually a `Box<dyn BoxMeUp>`, but we pass this by-reference because the other
48
- /// end of this call does not depend on liballoc, and thus cannot use `Box`.
47
+ /// `payload` is passed through another layer of raw pointers as `&mut dyn Trait` is not
48
+ /// FFI-safe. `BoxMeUp` lazily performs allocation only when needed (this avoids allocations
49
+ /// when using the "abort" panic runtime).
49
50
#[ unwind( allowed) ]
50
51
fn __rust_start_panic ( payload : * mut & mut dyn BoxMeUp ) -> u32 ;
51
52
}
You can’t perform that action at this time.
0 commit comments