Skip to content

Commit

Permalink
fix another comment, and make __rust_start_panic code a bit more sema…
Browse files Browse the repository at this point in the history
…ntically clear
  • Loading branch information
RalfJung committed Dec 25, 2020
1 parent 7524eb2 commit 1600f7d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions library/panic_unwind/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
5 changes: 3 additions & 2 deletions library/std/src/panicking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 1600f7d

Please sign in to comment.