Skip to content

Commit 0832364

Browse files
committed
std: Stabilize Atomic{Isize,Usize} methods
These methods were intended to be stable as of #16258 but the tags have since been lost in various refactorings. This commit re-adds the `#[stable]` attributes to each of these functions.
1 parent 1d00c54 commit 0832364

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

src/libcore/atomic.rs

+20
Original file line numberDiff line numberDiff line change
@@ -415,6 +415,7 @@ impl AtomicIsize {
415415
/// let atomic_forty_two = AtomicIsize::new(42);
416416
/// ```
417417
#[inline]
418+
#[stable(feature = "rust1", since = "1.0.0")]
418419
pub fn new(v: isize) -> AtomicIsize {
419420
AtomicIsize {v: UnsafeCell::new(v)}
420421
}
@@ -437,6 +438,7 @@ impl AtomicIsize {
437438
/// let value = some_isize.load(Ordering::Relaxed);
438439
/// ```
439440
#[inline]
441+
#[stable(feature = "rust1", since = "1.0.0")]
440442
pub fn load(&self, order: Ordering) -> isize {
441443
unsafe { atomic_load(self.v.get(), order) }
442444
}
@@ -459,6 +461,7 @@ impl AtomicIsize {
459461
///
460462
/// Panics if `order` is `Acquire` or `AcqRel`.
461463
#[inline]
464+
#[stable(feature = "rust1", since = "1.0.0")]
462465
pub fn store(&self, val: isize, order: Ordering) {
463466
unsafe { atomic_store(self.v.get(), val, order); }
464467
}
@@ -477,6 +480,7 @@ impl AtomicIsize {
477480
/// let value = some_isize.swap(10, Ordering::Relaxed);
478481
/// ```
479482
#[inline]
483+
#[stable(feature = "rust1", since = "1.0.0")]
480484
pub fn swap(&self, val: isize, order: Ordering) -> isize {
481485
unsafe { atomic_swap(self.v.get(), val, order) }
482486
}
@@ -498,6 +502,7 @@ impl AtomicIsize {
498502
/// let value = some_isize.compare_and_swap(5, 10, Ordering::Relaxed);
499503
/// ```
500504
#[inline]
505+
#[stable(feature = "rust1", since = "1.0.0")]
501506
pub fn compare_and_swap(&self, old: isize, new: isize, order: Ordering) -> isize {
502507
unsafe { atomic_compare_and_swap(self.v.get(), old, new, order) }
503508
}
@@ -514,6 +519,7 @@ impl AtomicIsize {
514519
/// assert_eq!(10, foo.load(Ordering::SeqCst));
515520
/// ```
516521
#[inline]
522+
#[stable(feature = "rust1", since = "1.0.0")]
517523
pub fn fetch_add(&self, val: isize, order: Ordering) -> isize {
518524
unsafe { atomic_add(self.v.get(), val, order) }
519525
}
@@ -530,6 +536,7 @@ impl AtomicIsize {
530536
/// assert_eq!(-10, foo.load(Ordering::SeqCst));
531537
/// ```
532538
#[inline]
539+
#[stable(feature = "rust1", since = "1.0.0")]
533540
pub fn fetch_sub(&self, val: isize, order: Ordering) -> isize {
534541
unsafe { atomic_sub(self.v.get(), val, order) }
535542
}
@@ -545,6 +552,7 @@ impl AtomicIsize {
545552
/// assert_eq!(0b101101, foo.fetch_and(0b110011, Ordering::SeqCst));
546553
/// assert_eq!(0b100001, foo.load(Ordering::SeqCst));
547554
#[inline]
555+
#[stable(feature = "rust1", since = "1.0.0")]
548556
pub fn fetch_and(&self, val: isize, order: Ordering) -> isize {
549557
unsafe { atomic_and(self.v.get(), val, order) }
550558
}
@@ -560,6 +568,7 @@ impl AtomicIsize {
560568
/// assert_eq!(0b101101, foo.fetch_or(0b110011, Ordering::SeqCst));
561569
/// assert_eq!(0b111111, foo.load(Ordering::SeqCst));
562570
#[inline]
571+
#[stable(feature = "rust1", since = "1.0.0")]
563572
pub fn fetch_or(&self, val: isize, order: Ordering) -> isize {
564573
unsafe { atomic_or(self.v.get(), val, order) }
565574
}
@@ -575,6 +584,7 @@ impl AtomicIsize {
575584
/// assert_eq!(0b101101, foo.fetch_xor(0b110011, Ordering::SeqCst));
576585
/// assert_eq!(0b011110, foo.load(Ordering::SeqCst));
577586
#[inline]
587+
#[stable(feature = "rust1", since = "1.0.0")]
578588
pub fn fetch_xor(&self, val: isize, order: Ordering) -> isize {
579589
unsafe { atomic_xor(self.v.get(), val, order) }
580590
}
@@ -592,6 +602,7 @@ impl AtomicUsize {
592602
/// let atomic_forty_two = AtomicUsize::new(42);
593603
/// ```
594604
#[inline]
605+
#[stable(feature = "rust1", since = "1.0.0")]
595606
pub fn new(v: usize) -> AtomicUsize {
596607
AtomicUsize { v: UnsafeCell::new(v) }
597608
}
@@ -614,6 +625,7 @@ impl AtomicUsize {
614625
/// let value = some_usize.load(Ordering::Relaxed);
615626
/// ```
616627
#[inline]
628+
#[stable(feature = "rust1", since = "1.0.0")]
617629
pub fn load(&self, order: Ordering) -> usize {
618630
unsafe { atomic_load(self.v.get(), order) }
619631
}
@@ -636,6 +648,7 @@ impl AtomicUsize {
636648
///
637649
/// Panics if `order` is `Acquire` or `AcqRel`.
638650
#[inline]
651+
#[stable(feature = "rust1", since = "1.0.0")]
639652
pub fn store(&self, val: usize, order: Ordering) {
640653
unsafe { atomic_store(self.v.get(), val, order); }
641654
}
@@ -654,6 +667,7 @@ impl AtomicUsize {
654667
/// let value = some_usize.swap(10, Ordering::Relaxed);
655668
/// ```
656669
#[inline]
670+
#[stable(feature = "rust1", since = "1.0.0")]
657671
pub fn swap(&self, val: usize, order: Ordering) -> usize {
658672
unsafe { atomic_swap(self.v.get(), val, order) }
659673
}
@@ -675,6 +689,7 @@ impl AtomicUsize {
675689
/// let value = some_usize.compare_and_swap(5, 10, Ordering::Relaxed);
676690
/// ```
677691
#[inline]
692+
#[stable(feature = "rust1", since = "1.0.0")]
678693
pub fn compare_and_swap(&self, old: usize, new: usize, order: Ordering) -> usize {
679694
unsafe { atomic_compare_and_swap(self.v.get(), old, new, order) }
680695
}
@@ -691,6 +706,7 @@ impl AtomicUsize {
691706
/// assert_eq!(10, foo.load(Ordering::SeqCst));
692707
/// ```
693708
#[inline]
709+
#[stable(feature = "rust1", since = "1.0.0")]
694710
pub fn fetch_add(&self, val: usize, order: Ordering) -> usize {
695711
unsafe { atomic_add(self.v.get(), val, order) }
696712
}
@@ -707,6 +723,7 @@ impl AtomicUsize {
707723
/// assert_eq!(0, foo.load(Ordering::SeqCst));
708724
/// ```
709725
#[inline]
726+
#[stable(feature = "rust1", since = "1.0.0")]
710727
pub fn fetch_sub(&self, val: usize, order: Ordering) -> usize {
711728
unsafe { atomic_sub(self.v.get(), val, order) }
712729
}
@@ -722,6 +739,7 @@ impl AtomicUsize {
722739
/// assert_eq!(0b101101, foo.fetch_and(0b110011, Ordering::SeqCst));
723740
/// assert_eq!(0b100001, foo.load(Ordering::SeqCst));
724741
#[inline]
742+
#[stable(feature = "rust1", since = "1.0.0")]
725743
pub fn fetch_and(&self, val: usize, order: Ordering) -> usize {
726744
unsafe { atomic_and(self.v.get(), val, order) }
727745
}
@@ -737,6 +755,7 @@ impl AtomicUsize {
737755
/// assert_eq!(0b101101, foo.fetch_or(0b110011, Ordering::SeqCst));
738756
/// assert_eq!(0b111111, foo.load(Ordering::SeqCst));
739757
#[inline]
758+
#[stable(feature = "rust1", since = "1.0.0")]
740759
pub fn fetch_or(&self, val: usize, order: Ordering) -> usize {
741760
unsafe { atomic_or(self.v.get(), val, order) }
742761
}
@@ -752,6 +771,7 @@ impl AtomicUsize {
752771
/// assert_eq!(0b101101, foo.fetch_xor(0b110011, Ordering::SeqCst));
753772
/// assert_eq!(0b011110, foo.load(Ordering::SeqCst));
754773
#[inline]
774+
#[stable(feature = "rust1", since = "1.0.0")]
755775
pub fn fetch_xor(&self, val: usize, order: Ordering) -> usize {
756776
unsafe { atomic_xor(self.v.get(), val, order) }
757777
}

0 commit comments

Comments
 (0)