intrinsics.rs: add some notes on unwinding

This commit is contained in:
Ralf Jung 2024-02-24 15:07:16 +01:00
parent bd3ea3e096
commit f5c80dcd5a

View File

@ -44,6 +44,15 @@
//! * Sequentially consistent - sequentially consistent operations are //! * Sequentially consistent - sequentially consistent operations are
//! guaranteed to happen in order. This is the standard mode for working //! guaranteed to happen in order. This is the standard mode for working
//! with atomic types and is equivalent to Java's `volatile`. //! 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( #![unstable(
feature = "core_intrinsics", feature = "core_intrinsics",
@ -692,6 +701,7 @@ pub unsafe fn drop_in_place<T: ?Sized>(to_drop: *mut T) {
/// The stabilized version of this intrinsic is available on the /// The stabilized version of this intrinsic is available on the
/// [`atomic`] signed integer types via the `fetch_min` method by passing /// [`atomic`] signed integer types via the `fetch_min` method by passing
/// [`Ordering::AcqRel`] as the `order`. For example, [`AtomicI32::fetch_min`]. /// [`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; pub fn atomic_min_acqrel<T: Copy>(dst: *mut T, src: T) -> T;
/// Minimum with the current value using a signed comparison. /// Minimum with the current value using a signed comparison.
/// ///