about summary refs log tree commit diff
diff options
context:
space:
mode:
authorChristopher Durham <cad97@cad97.com>2024-09-15 14:27:24 -0400
committerGitHub <noreply@github.com>2024-09-15 14:27:24 -0400
commit42a44a04ee1b2a99ea78e942937b4ce3d8a3067e (patch)
tree7853c2afe3787d2e5782aedc206cf1a32b2f572f
parent7e7ccb25b48dac9c341c972fc8dfce3cb300989f (diff)
downloadrust-42a44a04ee1b2a99ea78e942937b4ce3d8a3067e.tar.gz
rust-42a44a04ee1b2a99ea78e942937b4ce3d8a3067e.zip
simplify abort_unwind
Co-authored-by: David Tolnay <dtolnay@gmail.com>
-rw-r--r--library/core/src/panic.rs9
1 files changed, 2 insertions, 7 deletions
diff --git a/library/core/src/panic.rs b/library/core/src/panic.rs
index 3919bbd7958..c95a000561c 100644
--- a/library/core/src/panic.rs
+++ b/library/core/src/panic.rs
@@ -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