1
Fork 0

Rollup merge of #32147 - steveklabnik:gh31950, r=bluss

Clarify that try_unwrap needs exactly one

Fixes #31950
This commit is contained in:
Steve Klabnik 2016-03-10 14:01:54 +03:00
commit 76bcf6430f
2 changed files with 6 additions and 4 deletions

View file

@ -201,11 +201,12 @@ impl<T> Arc<T> {
Arc { _ptr: unsafe { Shared::new(Box::into_raw(x)) } } Arc { _ptr: unsafe { Shared::new(Box::into_raw(x)) } }
} }
/// Unwraps the contained value if the `Arc<T>` has only one strong reference. /// Unwraps the contained value if the `Arc<T>` has exactly one strong reference.
/// This will succeed even if there are outstanding weak references.
/// ///
/// Otherwise, an `Err` is returned with the same `Arc<T>`. /// Otherwise, an `Err` is returned with the same `Arc<T>`.
/// ///
/// This will succeed even if there are outstanding weak references.
///
/// # Examples /// # Examples
/// ///
/// ``` /// ```

View file

@ -224,11 +224,12 @@ impl<T> Rc<T> {
} }
} }
/// Unwraps the contained value if the `Rc<T>` has only one strong reference. /// Unwraps the contained value if the `Rc<T>` has exactly one strong reference.
/// This will succeed even if there are outstanding weak references.
/// ///
/// Otherwise, an `Err` is returned with the same `Rc<T>`. /// Otherwise, an `Err` is returned with the same `Rc<T>`.
/// ///
/// This will succeed even if there are outstanding weak references.
///
/// # Examples /// # Examples
/// ///
/// ``` /// ```