@@ -1115,13 +1115,8 @@ impl AtomicBool {
1115
1115
///
1116
1116
/// Doing non-atomic reads and writes on the resulting boolean can be a data race.
1117
1117
/// This method is mostly useful for FFI, where the function signature may use
1118
- /// `*mut bool` instead of `&AtomicBool`.
1119
- ///
1120
- /// Returning an `*mut` pointer from a shared reference to this atomic is safe because the
1121
- /// atomic types work with interior mutability. All modifications of an atomic change the value
1122
- /// through a shared reference, and can do so safely as long as they use atomic operations. Any
1123
- /// use of the returned raw pointer requires an `unsafe` block and still has to uphold the same
1124
- /// restriction: operations on it must be atomic.
1118
+ /// `*mut bool` instead of `&AtomicBool`. All modifications of an atomic change the value
1119
+ /// through a shared reference, and can do so safely as long as they use atomic operations.
1125
1120
///
1126
1121
/// # Examples
1127
1122
///
@@ -1134,6 +1129,8 @@ impl AtomicBool {
1134
1129
/// }
1135
1130
///
1136
1131
/// let mut atomic = AtomicBool::new(true);
1132
+ ///
1133
+ /// // SAFETY: `my_atomic_op` only uses atomic operations so it will not lead to a data race.
1137
1134
/// unsafe {
1138
1135
/// my_atomic_op(atomic.as_ptr());
1139
1136
/// }
@@ -2308,13 +2305,8 @@ impl<T> AtomicPtr<T> {
2308
2305
///
2309
2306
/// Doing non-atomic reads and writes on the resulting pointer can be a data race.
2310
2307
/// This method is mostly useful for FFI, where the function signature may use
2311
- /// `*mut *mut T` instead of `&AtomicPtr<T>`.
2312
- ///
2313
- /// Returning an `*mut` pointer from a shared reference to this atomic is safe because the
2314
- /// atomic types work with interior mutability. All modifications of an atomic change the value
2315
- /// through a shared reference, and can do so safely as long as they use atomic operations. Any
2316
- /// use of the returned raw pointer requires an `unsafe` block and still has to uphold the same
2317
- /// restriction: operations on it must be atomic.
2308
+ /// `*mut *mut T` instead of `&AtomicPtr<T>`. All modifications of an atomic change the value
2309
+ /// through a shared reference, and can do so safely as long as they use atomic operations.
2318
2310
///
2319
2311
/// # Examples
2320
2312
///
0 commit comments