@@ -1113,7 +1113,9 @@ impl AtomicBool {
1113
1113
1114
1114
/// Returns a mutable pointer to the underlying [`bool`].
1115
1115
///
1116
- /// Doing non-atomic reads and writes on the resulting boolean can be a data race.
1116
+ /// Note that doing non-atomic reads or writes on the resulting integer can be
1117
+ /// Undefined Behavior due to a data race; see the [memory model section] for further information.
1118
+ ///
1117
1119
/// This method is mostly useful for FFI, where the function signature may use
1118
1120
/// `*mut bool` instead of `&AtomicBool`. All modifications of an atomic change the value
1119
1121
/// through a shared reference, and can do so safely as long as they use atomic operations.
@@ -1136,6 +1138,7 @@ impl AtomicBool {
1136
1138
/// }
1137
1139
/// # }
1138
1140
/// ```
1141
+ /// [memory model section]: self#memory-model-for-atomic-accesses
1139
1142
#[ inline]
1140
1143
#[ stable( feature = "atomic_as_ptr" , since = "1.70.0" ) ]
1141
1144
#[ rustc_const_stable( feature = "atomic_as_ptr" , since = "1.70.0" ) ]
@@ -2303,7 +2306,9 @@ impl<T> AtomicPtr<T> {
2303
2306
2304
2307
/// Returns a mutable pointer to the underlying pointer.
2305
2308
///
2306
- /// Doing non-atomic reads and writes on the resulting pointer can be a data race.
2309
+ /// Note that doing non-atomic reads or writes on the resulting integer can be
2310
+ /// Undefined Behavior due to a data race; see the [memory model section] for further information.
2311
+ ///
2307
2312
/// This method is mostly useful for FFI, where the function signature may use
2308
2313
/// `*mut *mut T` instead of `&AtomicPtr<T>`. All modifications of an atomic change the value
2309
2314
/// through a shared reference, and can do so safely as long as they use atomic operations.
@@ -2325,6 +2330,7 @@ impl<T> AtomicPtr<T> {
2325
2330
/// my_atomic_op(atomic.as_ptr());
2326
2331
/// }
2327
2332
/// ```
2333
+ /// [memory model section]: self#memory-model-for-atomic-accesses
2328
2334
#[ inline]
2329
2335
#[ stable( feature = "atomic_as_ptr" , since = "1.70.0" ) ]
2330
2336
#[ rustc_const_stable( feature = "atomic_as_ptr" , since = "1.70.0" ) ]
@@ -3390,7 +3396,9 @@ macro_rules! atomic_int {
3390
3396
3391
3397
/// Returns a mutable pointer to the underlying integer.
3392
3398
///
3393
- /// Doing non-atomic reads and writes on the resulting integer can be a data race.
3399
+ /// Note that doing non-atomic reads or writes on the resulting integer can be
3400
+ /// Undefined Behavior due to a data race; see the [memory model section] for further information.
3401
+ ///
3394
3402
/// This method is mostly useful for FFI, where the function signature may use
3395
3403
#[ doc = concat!( "`*mut " , stringify!( $int_type) , "` instead of `&" , stringify!( $atomic_type) , "`." ) ]
3396
3404
/// All modifications of an atomic change the value through a shared reference, and can do so safely
@@ -3414,6 +3422,7 @@ macro_rules! atomic_int {
3414
3422
/// }
3415
3423
/// # }
3416
3424
/// ```
3425
+ /// [memory model section]: self#memory-model-for-atomic-accesses
3417
3426
#[ inline]
3418
3427
#[ stable( feature = "atomic_as_ptr" , since = "1.70.0" ) ]
3419
3428
#[ rustc_const_stable( feature = "atomic_as_ptr" , since = "1.70.0" ) ]
0 commit comments