Skip to content

Commit 00d50fe

Browse files
committed
Hide recommendations for using nightly-only API; clean up a core::mem path.
1 parent 5d81f76 commit 00d50fe

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

library/alloc/src/sync.rs

+7-1
Original file line numberDiff line numberDiff line change
@@ -485,6 +485,8 @@ impl<T> Arc<T> {
485485
///
486486
/// This will succeed even if there are outstanding weak references.
487487
///
488+
// FIXME: when `Arc::unwrap_or_drop` is stabilized, add this paragraph:
489+
/*
488490
/// It is strongly recommended to use [`Arc::unwrap_or_drop`] instead if you don't
489491
/// want to keep the `Arc` in the [`Err`] case.
490492
/// Immediately dropping the [`Err`] payload, like in the expression
@@ -496,6 +498,7 @@ impl<T> Arc<T> {
496498
/// both drop their `Arc` in the call to [`ok`][`Result::ok`],
497499
/// taking the strong count from two down to zero.
498500
///
501+
*/
499502
/// # Examples
500503
///
501504
/// ```
@@ -621,11 +624,14 @@ impl<T> Arc<T> {
621624
/// t2.join().unwrap();
622625
/// }
623626
/// ```
627+
628+
// FIXME: when `Arc::unwrap_or_drop` is stabilized, adjust the documentation of
629+
// `Arc::try_unwrap` according to the `FIXME` presented there.
624630
#[inline]
625631
#[unstable(feature = "unwrap_or_drop", issue = "none")] // FIXME: add issue
626632
pub fn unwrap_or_drop(this: Self) -> Option<T> {
627633
// Make sure that the ordinary `Drop` implementation isn’t called as well
628-
let mut this = core::mem::ManuallyDrop::new(this);
634+
let mut this = mem::ManuallyDrop::new(this);
629635

630636
// Following the implementation of `drop` and `drop_slow`
631637
if this.inner().strong.fetch_sub(1, Release) != 1 {

0 commit comments

Comments
 (0)