File tree Expand file tree Collapse file tree 2 files changed +5
-4
lines changed Expand file tree Collapse file tree 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
105105#[ rustc_std_internal_symbol]
106106#[ unwind( allowed) ]
107107pub 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 ( ) ) ;
109109
110- imp:: panic ( Box :: from_raw ( payload) )
110+ imp:: panic ( payload)
111111}
Original file line number Diff line number Diff line change @@ -44,8 +44,9 @@ use realstd::io::set_output_capture;
4444extern "C" {
4545 fn __rust_panic_cleanup ( payload : * mut u8 ) -> * mut ( dyn Any + Send + ' static ) ;
4646
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).
4950 #[ unwind( allowed) ]
5051 fn __rust_start_panic ( payload : * mut & mut dyn BoxMeUp ) -> u32 ;
5152}
You can’t perform that action at this time.
0 commit comments