Skip to content

Commit fe42025

Browse files
committed
update Atomic*::from_ptr and Atomic*::as_ptr docs
1 parent 12865ff commit fe42025

File tree

1 file changed

+15
-9
lines changed

1 file changed

+15
-9
lines changed

library/core/src/sync/atomic.rs

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -563,8 +563,8 @@ impl AtomicBool {
563563
/// `align_of::<AtomicBool>() == 1`).
564564
/// * `ptr` must be [valid] for both reads and writes for the whole lifetime `'a`.
565565
/// * You must adhere to the [Memory model for atomic accesses]. In particular, it is not
566-
/// allowed to mix atomic and non-atomic accesses, or atomic accesses of different sizes,
567-
/// without synchronization.
566+
/// allowed to mix conflicting atomic and non-atomic accesses, or atomic accesses of different
567+
/// sizes, without synchronization.
568568
///
569569
/// [valid]: crate::ptr#safety
570570
/// [Memory model for atomic accesses]: self#memory-model-for-atomic-accesses
@@ -1246,7 +1246,7 @@ impl AtomicBool {
12461246
/// atomic types work with interior mutability. All modifications of an atomic change the value
12471247
/// through a shared reference, and can do so safely as long as they use atomic operations. Any
12481248
/// use of the returned raw pointer requires an `unsafe` block and still has to uphold the same
1249-
/// restriction: operations on it must be atomic.
1249+
/// restriction in [Memory model for atomic accesses].
12501250
///
12511251
/// # Examples
12521252
///
@@ -1264,6 +1264,8 @@ impl AtomicBool {
12641264
/// }
12651265
/// # }
12661266
/// ```
1267+
///
1268+
/// [Memory model for atomic accesses]: self#memory-model-for-atomic-accesses
12671269
#[inline]
12681270
#[stable(feature = "atomic_as_ptr", since = "1.70.0")]
12691271
#[rustc_const_stable(feature = "atomic_as_ptr", since = "1.70.0")]
@@ -1519,8 +1521,8 @@ impl<T> AtomicPtr<T> {
15191521
/// can be bigger than `align_of::<*mut T>()`).
15201522
/// * `ptr` must be [valid] for both reads and writes for the whole lifetime `'a`.
15211523
/// * You must adhere to the [Memory model for atomic accesses]. In particular, it is not
1522-
/// allowed to mix atomic and non-atomic accesses, or atomic accesses of different sizes,
1523-
/// without synchronization.
1524+
/// allowed to mix conflicting atomic and non-atomic accesses, or atomic accesses of different
1525+
/// sizes, without synchronization.
15241526
///
15251527
/// [valid]: crate::ptr#safety
15261528
/// [Memory model for atomic accesses]: self#memory-model-for-atomic-accesses
@@ -2488,7 +2490,7 @@ impl<T> AtomicPtr<T> {
24882490
/// atomic types work with interior mutability. All modifications of an atomic change the value
24892491
/// through a shared reference, and can do so safely as long as they use atomic operations. Any
24902492
/// use of the returned raw pointer requires an `unsafe` block and still has to uphold the same
2491-
/// restriction: operations on it must be atomic.
2493+
/// restriction in [Memory model for atomic accesses].
24922494
///
24932495
/// # Examples
24942496
///
@@ -2507,6 +2509,8 @@ impl<T> AtomicPtr<T> {
25072509
/// my_atomic_op(atomic.as_ptr());
25082510
/// }
25092511
/// ```
2512+
///
2513+
/// [Memory model for atomic accesses]: self#memory-model-for-atomic-accesses
25102514
#[inline]
25112515
#[stable(feature = "atomic_as_ptr", since = "1.70.0")]
25122516
#[rustc_const_stable(feature = "atomic_as_ptr", since = "1.70.0")]
@@ -2696,8 +2700,8 @@ macro_rules! atomic_int {
26962700
}]
26972701
/// * `ptr` must be [valid] for both reads and writes for the whole lifetime `'a`.
26982702
/// * You must adhere to the [Memory model for atomic accesses]. In particular, it is not
2699-
/// allowed to mix atomic and non-atomic accesses, or atomic accesses of different sizes,
2700-
/// without synchronization.
2703+
/// allowed to mix conflicting atomic and non-atomic accesses, or atomic accesses of different
2704+
/// sizes, without synchronization.
27012705
///
27022706
/// [valid]: crate::ptr#safety
27032707
/// [Memory model for atomic accesses]: self#memory-model-for-atomic-accesses
@@ -3618,7 +3622,7 @@ macro_rules! atomic_int {
36183622
/// atomic types work with interior mutability. All modifications of an atomic change the value
36193623
/// through a shared reference, and can do so safely as long as they use atomic operations. Any
36203624
/// use of the returned raw pointer requires an `unsafe` block and still has to uphold the same
3621-
/// restriction: operations on it must be atomic.
3625+
/// restriction in [Memory model for atomic accesses].
36223626
///
36233627
/// # Examples
36243628
///
@@ -3638,6 +3642,8 @@ macro_rules! atomic_int {
36383642
/// }
36393643
/// # }
36403644
/// ```
3645+
///
3646+
/// [Memory model for atomic accesses]: self#memory-model-for-atomic-accesses
36413647
#[inline]
36423648
#[stable(feature = "atomic_as_ptr", since = "1.70.0")]
36433649
#[rustc_const_stable(feature = "atomic_as_ptr", since = "1.70.0")]

0 commit comments

Comments
 (0)