@@ -662,20 +662,17 @@ impl<T> Arc<T> {
662
662
///
663
663
/// This will succeed even if there are outstanding weak references.
664
664
///
665
- // FIXME: when `Arc::into_inner` is stabilized, add this paragraph:
666
- /*
667
665
/// It is strongly recommended to use [`Arc::into_inner`] instead if you don't
668
666
/// want to keep the `Arc` in the [`Err`] case.
669
667
/// Immediately dropping the [`Err`] payload, like in the expression
670
668
/// `Arc::try_unwrap(this).ok()`, can still cause the strong count to
671
669
/// drop to zero and the inner value of the `Arc` to be dropped:
672
- /// For instance if two threads execute this expression in parallel, then
670
+ /// For instance if two threads each execute this expression in parallel, then
673
671
/// there is a race condition. The threads could first both check whether they
674
672
/// have the last clone of their `Arc` via `Arc::try_unwrap`, and then
675
673
/// both drop their `Arc` in the call to [`ok`][`Result::ok`],
676
674
/// taking the strong count from two down to zero.
677
675
///
678
- */
679
676
/// # Examples
680
677
///
681
678
/// ```
@@ -719,20 +716,13 @@ impl<T> Arc<T> {
719
716
/// This means in particular that the inner value is not dropped.
720
717
///
721
718
/// The similar expression `Arc::try_unwrap(this).ok()` does not
722
- /// offer such a guarantee. See the last example below.
723
- //
724
- // FIXME: when `Arc::into_inner` is stabilized, add this to end
725
- // of the previous sentence:
726
- /*
719
+ /// offer such a guarantee. See the last example below
727
720
/// and the documentation of [`Arc::try_unwrap`].
728
- */
729
721
///
730
722
/// # Examples
731
723
///
732
724
/// Minimal example demonstrating the guarantee that `Arc::into_inner` gives.
733
725
/// ```
734
- /// #![feature(arc_into_inner)]
735
- ///
736
726
/// use std::sync::Arc;
737
727
///
738
728
/// let x = Arc::new(3);
@@ -756,8 +746,6 @@ impl<T> Arc<T> {
756
746
///
757
747
/// A more practical example demonstrating the need for `Arc::into_inner`:
758
748
/// ```
759
- /// #![feature(arc_into_inner)]
760
- ///
761
749
/// use std::sync::Arc;
762
750
///
763
751
/// // Definition of a simple singly linked list using `Arc`:
@@ -807,13 +795,8 @@ impl<T> Arc<T> {
807
795
/// x_thread.join().unwrap();
808
796
/// y_thread.join().unwrap();
809
797
/// ```
810
-
811
- // FIXME: when `Arc::into_inner` is stabilized, adjust above documentation
812
- // and the documentation of `Arc::try_unwrap` according to the `FIXME`s. Also
813
- // open an issue on rust-lang/rust-clippy, asking for a lint against
814
- // `Arc::try_unwrap(...).ok()`.
815
798
#[ inline]
816
- #[ unstable ( feature = "arc_into_inner" , issue = "106894 " ) ]
799
+ #[ stable ( feature = "arc_into_inner" , since = "CURRENT_RUSTC_VERSION " ) ]
817
800
pub fn into_inner ( this : Self ) -> Option < T > {
818
801
// Make sure that the ordinary `Drop` implementation isn’t called as well
819
802
let mut this = mem:: ManuallyDrop :: new ( this) ;
0 commit comments