fix another comment, and make __rust_start_panic code a bit more semantically clear

This commit is contained in:
Ralf Jung 2020-12-25 23:37:27 +01:00
parent 7524eb2704
commit 1600f7d693
2 changed files with 5 additions and 4 deletions

View File

@ -105,7 +105,7 @@ pub unsafe extern "C" fn __rust_panic_cleanup(payload: *mut u8) -> *mut (dyn Any
#[rustc_std_internal_symbol]
#[unwind(allowed)]
pub unsafe extern "C" fn __rust_start_panic(payload: *mut &mut dyn BoxMeUp) -> u32 {
let payload = (*payload).take_box();
let payload = Box::from_raw((*payload).take_box());
imp::panic(Box::from_raw(payload))
imp::panic(payload)
}

View File

@ -44,8 +44,9 @@ use realstd::io::set_output_capture;
extern "C" {
fn __rust_panic_cleanup(payload: *mut u8) -> *mut (dyn Any + Send + 'static);
/// `payload` is actually a `Box<dyn BoxMeUp>`, but we pass this by-reference because the other
/// end of this call does not depend on liballoc, and thus cannot use `Box`.
/// `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).
#[unwind(allowed)]
fn __rust_start_panic(payload: *mut &mut dyn BoxMeUp) -> u32;
}