@@ -1115,13 +1115,8 @@ impl AtomicBool {
11151115 ///
11161116 /// Doing non-atomic reads and writes on the resulting boolean can be a data race.
11171117 /// 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.
11251120 ///
11261121 /// # Examples
11271122 ///
@@ -1134,6 +1129,8 @@ impl AtomicBool {
11341129 /// }
11351130 ///
11361131 /// 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.
11371134 /// unsafe {
11381135 /// my_atomic_op(atomic.as_ptr());
11391136 /// }
@@ -2308,13 +2305,8 @@ impl<T> AtomicPtr<T> {
23082305 ///
23092306 /// Doing non-atomic reads and writes on the resulting pointer can be a data race.
23102307 /// 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.
23182310 ///
23192311 /// # Examples
23202312 ///
0 commit comments