@@ -272,13 +272,13 @@ impl AtomicBool {
272272 unsafe { atomic_swap ( self . v . get ( ) , val, order) > 0 }
273273 }
274274
275- /// Stores a value into the bool if the current value is the same as the expected value.
275+ /// Stores a value into the ` bool` if the current value is the same as the `current` value.
276276 ///
277- /// The return value is always the previous value. If it is equal to `old `, then the value was
278- /// updated.
277+ /// The return value is always the previous value. If it is equal to `current `, then the value
278+ /// was updated.
279279 ///
280- /// `swap ` also takes an `Ordering` argument which describes the memory ordering of this
281- /// operation.
280+ /// `compare_and_swap ` also takes an `Ordering` argument which describes the memory ordering of
281+ /// this operation.
282282 ///
283283 /// # Examples
284284 ///
@@ -295,11 +295,11 @@ impl AtomicBool {
295295 /// ```
296296 #[ inline]
297297 #[ stable( feature = "rust1" , since = "1.0.0" ) ]
298- pub fn compare_and_swap ( & self , old : bool , new : bool , order : Ordering ) -> bool {
299- let old = if old { UINT_TRUE } else { 0 } ;
298+ pub fn compare_and_swap ( & self , current : bool , new : bool , order : Ordering ) -> bool {
299+ let current = if current { UINT_TRUE } else { 0 } ;
300300 let new = if new { UINT_TRUE } else { 0 } ;
301301
302- unsafe { atomic_compare_and_swap ( self . v . get ( ) , old , new, order) > 0 }
302+ unsafe { atomic_compare_and_swap ( self . v . get ( ) , current , new, order) > 0 }
303303 }
304304
305305 /// Logical "and" with a boolean value.
@@ -515,10 +515,10 @@ impl AtomicIsize {
515515 unsafe { atomic_swap ( self . v . get ( ) , val, order) }
516516 }
517517
518- /// Stores a value into the isize if the current value is the same as the expected value.
518+ /// Stores a value into the ` isize` if the current value is the same as the `current` value.
519519 ///
520- /// The return value is always the previous value. If it is equal to `old `, then the value was
521- /// updated.
520+ /// The return value is always the previous value. If it is equal to `current `, then the value
521+ /// was updated.
522522 ///
523523 /// `compare_and_swap` also takes an `Ordering` argument which describes the memory ordering of
524524 /// this operation.
@@ -538,8 +538,8 @@ impl AtomicIsize {
538538 /// ```
539539 #[ inline]
540540 #[ stable( feature = "rust1" , since = "1.0.0" ) ]
541- pub fn compare_and_swap ( & self , old : isize , new : isize , order : Ordering ) -> isize {
542- unsafe { atomic_compare_and_swap ( self . v . get ( ) , old , new, order) }
541+ pub fn compare_and_swap ( & self , current : isize , new : isize , order : Ordering ) -> isize {
542+ unsafe { atomic_compare_and_swap ( self . v . get ( ) , current , new, order) }
543543 }
544544
545545 /// Add an isize to the current value, returning the previous value.
@@ -709,10 +709,10 @@ impl AtomicUsize {
709709 unsafe { atomic_swap ( self . v . get ( ) , val, order) }
710710 }
711711
712- /// Stores a value into the usize if the current value is the same as the expected value.
712+ /// Stores a value into the ` usize` if the current value is the same as the `current` value.
713713 ///
714- /// The return value is always the previous value. If it is equal to `old `, then the value was
715- /// updated.
714+ /// The return value is always the previous value. If it is equal to `current `, then the value
715+ /// was updated.
716716 ///
717717 /// `compare_and_swap` also takes an `Ordering` argument which describes the memory ordering of
718718 /// this operation.
@@ -732,8 +732,8 @@ impl AtomicUsize {
732732 /// ```
733733 #[ inline]
734734 #[ stable( feature = "rust1" , since = "1.0.0" ) ]
735- pub fn compare_and_swap ( & self , old : usize , new : usize , order : Ordering ) -> usize {
736- unsafe { atomic_compare_and_swap ( self . v . get ( ) , old , new, order) }
735+ pub fn compare_and_swap ( & self , current : usize , new : usize , order : Ordering ) -> usize {
736+ unsafe { atomic_compare_and_swap ( self . v . get ( ) , current , new, order) }
737737 }
738738
739739 /// Add to the current usize, returning the previous value.
@@ -910,10 +910,10 @@ impl<T> AtomicPtr<T> {
910910 unsafe { atomic_swap ( self . p . get ( ) as * mut usize , ptr as usize , order) as * mut T }
911911 }
912912
913- /// Stores a value into the pointer if the current value is the same as the expected value.
913+ /// Stores a value into the pointer if the current value is the same as the `current` value.
914914 ///
915- /// The return value is always the previous value. If it is equal to `old `, then the value was
916- /// updated.
915+ /// The return value is always the previous value. If it is equal to `current `, then the value
916+ /// was updated.
917917 ///
918918 /// `compare_and_swap` also takes an `Ordering` argument which describes the memory ordering of
919919 /// this operation.
@@ -933,9 +933,9 @@ impl<T> AtomicPtr<T> {
933933 /// ```
934934 #[ inline]
935935 #[ stable( feature = "rust1" , since = "1.0.0" ) ]
936- pub fn compare_and_swap ( & self , old : * mut T , new : * mut T , order : Ordering ) -> * mut T {
936+ pub fn compare_and_swap ( & self , current : * mut T , new : * mut T , order : Ordering ) -> * mut T {
937937 unsafe {
938- atomic_compare_and_swap ( self . p . get ( ) as * mut usize , old as usize ,
938+ atomic_compare_and_swap ( self . p . get ( ) as * mut usize , current as usize ,
939939 new as usize , order) as * mut T
940940 }
941941 }
0 commit comments