Skip to content

Commit 115dede

Browse files
authored
Rollup merge of #64349 - arnohaase:pr_documentation_atomicptr, r=cramertj
documentation for AtomicPtr CAS operations The examples in the documentation for AtomicPtr CAS operations only show code that does *not* perform the CAS operation. I suggest to change them so that they actually do exchange the AtomicPtr's value.
2 parents 3d06207 + 7ad44c7 commit 115dede

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

src/libcore/sync/atomic.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -979,9 +979,8 @@ impl<T> AtomicPtr<T> {
979979
/// let some_ptr = AtomicPtr::new(ptr);
980980
///
981981
/// let other_ptr = &mut 10;
982-
/// let another_ptr = &mut 10;
983982
///
984-
/// let value = some_ptr.compare_and_swap(other_ptr, another_ptr, Ordering::Relaxed);
983+
/// let value = some_ptr.compare_and_swap(ptr, other_ptr, Ordering::Relaxed);
985984
/// ```
986985
#[inline]
987986
#[stable(feature = "rust1", since = "1.0.0")]
@@ -1021,9 +1020,8 @@ impl<T> AtomicPtr<T> {
10211020
/// let some_ptr = AtomicPtr::new(ptr);
10221021
///
10231022
/// let other_ptr = &mut 10;
1024-
/// let another_ptr = &mut 10;
10251023
///
1026-
/// let value = some_ptr.compare_exchange(other_ptr, another_ptr,
1024+
/// let value = some_ptr.compare_exchange(ptr, other_ptr,
10271025
/// Ordering::SeqCst, Ordering::Relaxed);
10281026
/// ```
10291027
#[inline]

0 commit comments

Comments
 (0)