Skip to content

Commit f5c80dc

Browse files
committed
intrinsics.rs: add some notes on unwinding
1 parent bd3ea3e commit f5c80dc

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

library/core/src/intrinsics.rs

+10
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,15 @@
4444
//! * Sequentially consistent - sequentially consistent operations are
4545
//! guaranteed to happen in order. This is the standard mode for working
4646
//! with atomic types and is equivalent to Java's `volatile`.
47+
//!
48+
//! # Unwinding
49+
//!
50+
//! Rust intrinsics may, in general, unwind. If an intrinsic can never unwind, add the
51+
//! `#[rustc_nounwind]` attribute so that the compiler can make use of this fact.
52+
//!
53+
//! However, even for intrinsics that may unwind, rustc assumes that a Rust intrinsics will never
54+
//! initiate a foreign (non-Rust) unwind, and thus for panic=abort we can always assume that these
55+
//! intrinsics cannot unwind.
4756
4857
#![unstable(
4958
feature = "core_intrinsics",
@@ -692,6 +701,7 @@ extern "rust-intrinsic" {
692701
/// The stabilized version of this intrinsic is available on the
693702
/// [`atomic`] signed integer types via the `fetch_min` method by passing
694703
/// [`Ordering::AcqRel`] as the `order`. For example, [`AtomicI32::fetch_min`].
704+
#[rustc_nounwind]
695705
pub fn atomic_min_acqrel<T: Copy>(dst: *mut T, src: T) -> T;
696706
/// Minimum with the current value using a signed comparison.
697707
///

0 commit comments

Comments
 (0)