about summary refs log tree commit diff
diff options
context:
space:
mode:
authorRalf Jung <post@ralfj.de>2024-02-24 15:07:16 +0100
committerRalf Jung <post@ralfj.de>2024-02-27 12:28:25 +0100
commitf5c80dcd5a7f7b7b9ef4d00ac9bfb68d9c789f6f (patch)
tree998130cc67dcb33273ea8d5fc49f61ea51568479
parentbd3ea3e09624140893c7679e45c65cb2fde1b4bf (diff)
downloadrust-f5c80dcd5a7f7b7b9ef4d00ac9bfb68d9c789f6f.tar.gz
rust-f5c80dcd5a7f7b7b9ef4d00ac9bfb68d9c789f6f.zip
intrinsics.rs: add some notes on unwinding
-rw-r--r--library/core/src/intrinsics.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/library/core/src/intrinsics.rs b/library/core/src/intrinsics.rs
index 6fd3895bb9c..96e667d63c5 100644
--- a/library/core/src/intrinsics.rs
+++ b/library/core/src/intrinsics.rs
@@ -44,6 +44,15 @@
 //! * Sequentially consistent - sequentially consistent operations are
 //!   guaranteed to happen in order. This is the standard mode for working
 //!   with atomic types and is equivalent to Java's `volatile`.
+//!
+//! # Unwinding
+//!
+//! Rust intrinsics may, in general, unwind. If an intrinsic can never unwind, add the
+//! `#[rustc_nounwind]` attribute so that the compiler can make use of this fact.
+//!
+//! However, even for intrinsics that may unwind, rustc assumes that a Rust intrinsics will never
+//! initiate a foreign (non-Rust) unwind, and thus for panic=abort we can always assume that these
+//! intrinsics cannot unwind.
 
 #![unstable(
     feature = "core_intrinsics",
@@ -692,6 +701,7 @@ extern "rust-intrinsic" {
     /// The stabilized version of this intrinsic is available on the
     /// [`atomic`] signed integer types via the `fetch_min` method by passing
     /// [`Ordering::AcqRel`] as the `order`. For example, [`AtomicI32::fetch_min`].
+    #[rustc_nounwind]
     pub fn atomic_min_acqrel<T: Copy>(dst: *mut T, src: T) -> T;
     /// Minimum with the current value using a signed comparison.
     ///