Skip to content

Commit

Permalink
simplify abort_unwind
Browse files Browse the repository at this point in the history
Co-authored-by: David Tolnay <dtolnay@gmail.com>
  • Loading branch information
CAD97 and dtolnay authored Sep 15, 2024
1 parent 9c71d4e commit f396849
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions core/src/panic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,14 +160,9 @@ pub macro unreachable_2021 {
/// to prevent unwinds. However, note that `extern "C" fn` will automatically
/// convert unwinds to aborts, so using this function isn't necessary for FFI.
#[unstable(feature = "abort_unwind", issue = "130338")]
#[rustc_nounwind]
pub fn abort_unwind<F: FnOnce() -> R, R>(f: F) -> R {
// This attribute adds the "unwinding out of nounwind function" guard.
#[rustc_nounwind]
fn abort_unwind_inner<F: FnOnce() -> R, R>(f: F) -> R {
f()
}

abort_unwind_inner(f)
f()
}

/// An internal trait used by std to pass data from std to `panic_unwind` and
Expand Down

0 comments on commit f396849

Please sign in to comment.