@@ -485,9 +485,9 @@ impl<T> Arc<T> {
485
485
///
486
486
/// This will succeed even if there are outstanding weak references.
487
487
///
488
- // FIXME: when `Arc::unwrap_or_drop ` is stabilized, add this paragraph:
488
+ // FIXME: when `Arc::into_inner ` is stabilized, add this paragraph:
489
489
/*
490
- /// It is strongly recommended to use [`Arc::unwrap_or_drop `] instead if you don't
490
+ /// It is strongly recommended to use [`Arc::into_inner `] instead if you don't
491
491
/// want to keep the `Arc` in the [`Err`] case.
492
492
/// Immediately dropping the [`Err`] payload, like in the expression
493
493
/// `Arc::try_unwrap(this).ok()`, can still cause the strong count to
@@ -537,7 +537,7 @@ impl<T> Arc<T> {
537
537
///
538
538
/// This will succeed even if there are outstanding weak references.
539
539
///
540
- /// If `unwrap_or_drop ` is called on every clone of this `Arc`,
540
+ /// If `into_inner ` is called on every clone of this `Arc`,
541
541
/// it is guaranteed that exactly one of the calls returns the inner value.
542
542
/// This means in particular that the inner value is not dropped.
543
543
///
@@ -547,18 +547,18 @@ impl<T> Arc<T> {
547
547
///
548
548
/// # Examples
549
549
///
550
- /// Minimal example demonstrating the guarantee that `unwrap_or_drop ` gives.
550
+ /// Minimal example demonstrating the guarantee that `into_inner ` gives.
551
551
/// ```
552
- /// #![feature(unwrap_or_drop )]
552
+ /// #![feature(arc_into_inner )]
553
553
///
554
554
/// use std::sync::Arc;
555
555
///
556
556
/// let x = Arc::new(3);
557
557
/// let y = Arc::clone(&x);
558
558
///
559
- /// // Two threads calling `unwrap_or_drop ` on both clones of an `Arc`:
560
- /// let x_unwrap_thread = std::thread::spawn(|| Arc::unwrap_or_drop (x));
561
- /// let y_unwrap_thread = std::thread::spawn(|| Arc::unwrap_or_drop (y));
559
+ /// // Two threads calling `into_inner ` on both clones of an `Arc`:
560
+ /// let x_unwrap_thread = std::thread::spawn(|| Arc::into_inner (x));
561
+ /// let y_unwrap_thread = std::thread::spawn(|| Arc::into_inner (y));
562
562
///
563
563
/// let x_unwrapped_value = x_unwrap_thread.join().unwrap();
564
564
/// let y_unwrapped_value = y_unwrap_thread.join().unwrap();
@@ -572,9 +572,9 @@ impl<T> Arc<T> {
572
572
/// // `Arc::try_unwrap(x).ok()` and `Arc::try_unwrap(y).ok()` instead.
573
573
/// ```
574
574
///
575
- /// A more practical example demonstrating the need for `unwrap_or_drop `:
575
+ /// A more practical example demonstrating the need for `into_inner `:
576
576
/// ```
577
- /// #![feature(unwrap_or_drop )]
577
+ /// #![feature(arc_into_inner )]
578
578
///
579
579
/// use std::sync::Arc;
580
580
///
@@ -590,7 +590,7 @@ impl<T> Arc<T> {
590
590
/// fn drop(&mut self) {
591
591
/// let mut x = self.0.take();
592
592
/// while let Some(arc) = x.take() {
593
- /// Arc::unwrap_or_drop (arc).map(|node| x = node.1);
593
+ /// Arc::into_inner (arc).map(|node| x = node.1);
594
594
/// }
595
595
/// }
596
596
/// }
@@ -608,7 +608,7 @@ impl<T> Arc<T> {
608
608
///
609
609
/// // The following code could still cause a stack overflow
610
610
/// // despite the manual `Drop` impl if that `Drop` impl used
611
- /// // `Arc::try_unwrap(arc).ok()` instead of `Arc::unwrap_or_drop (arc)`.
611
+ /// // `Arc::try_unwrap(arc).ok()` instead of `Arc::into_inner (arc)`.
612
612
/// {
613
613
/// // Create a long list and clone it
614
614
/// let mut x = LinkedList::new();
@@ -625,11 +625,11 @@ impl<T> Arc<T> {
625
625
/// }
626
626
/// ```
627
627
628
- // FIXME: when `Arc::unwrap_or_drop ` is stabilized, adjust the documentation of
628
+ // FIXME: when `Arc::into_inner ` is stabilized, adjust the documentation of
629
629
// `Arc::try_unwrap` according to the `FIXME` presented there.
630
630
#[ inline]
631
- #[ unstable( feature = "unwrap_or_drop " , issue = "none" ) ] // FIXME: add issue
632
- pub fn unwrap_or_drop ( this : Self ) -> Option < T > {
631
+ #[ unstable( feature = "arc_into_inner " , issue = "none" ) ] // FIXME: create and add issue
632
+ pub fn into_inner ( this : Self ) -> Option < T > {
633
633
// Make sure that the ordinary `Drop` implementation isn’t called as well
634
634
let mut this = mem:: ManuallyDrop :: new ( this) ;
635
635
0 commit comments