Rollup merge of #61797 - Thomasdezeeuw:stablise-weak_ptr_eq, r=RalfJung

Stabilise weak_ptr_eq

Implemented in #55987.

Closes #55981.
This commit is contained in:
Mazdak Farrokhzad
2019-09-14 22:16:03 +02:00
committed by GitHub
2 changed files with 8 additions and 11 deletions
+4 -5
View File
@@ -1832,8 +1832,9 @@ fn inner(&self) -> Option<&RcBox<T>> {
}
}
/// Returns `true` if the two `Weak`s point to the same value (not just values
/// that compare as equal).
/// Returns `true` if the two `Weak`s point to the same value (not just
/// values that compare as equal), or if both don't point to any value
/// (because they were created with `Weak::new()`).
///
/// # Notes
///
@@ -1843,7 +1844,6 @@ fn inner(&self) -> Option<&RcBox<T>> {
/// # Examples
///
/// ```
/// #![feature(weak_ptr_eq)]
/// use std::rc::Rc;
///
/// let first_rc = Rc::new(5);
@@ -1861,7 +1861,6 @@ fn inner(&self) -> Option<&RcBox<T>> {
/// Comparing `Weak::new`.
///
/// ```
/// #![feature(weak_ptr_eq)]
/// use std::rc::{Rc, Weak};
///
/// let first = Weak::new();
@@ -1873,7 +1872,7 @@ fn inner(&self) -> Option<&RcBox<T>> {
/// assert!(!first.ptr_eq(&third));
/// ```
#[inline]
#[unstable(feature = "weak_ptr_eq", issue = "55981")]
#[stable(feature = "weak_ptr_eq", since = "1.39.0")]
pub fn ptr_eq(&self, other: &Self) -> bool {
self.ptr.as_ptr() == other.ptr.as_ptr()
}
+4 -6
View File
@@ -1550,19 +1550,18 @@ fn inner(&self) -> Option<&ArcInner<T>> {
}
}
/// Returns `true` if the two `Weak`s point to the same value (not just values
/// that compare as equal).
/// Returns `true` if the two `Weak`s point to the same value (not just
/// values that compare as equal), or if both don't point to any value
/// (because they were created with `Weak::new()`).
///
/// # Notes
///
/// Since this compares pointers it means that `Weak::new()` will equal each
/// other, even though they don't point to any value.
///
///
/// # Examples
///
/// ```
/// #![feature(weak_ptr_eq)]
/// use std::sync::Arc;
///
/// let first_rc = Arc::new(5);
@@ -1580,7 +1579,6 @@ fn inner(&self) -> Option<&ArcInner<T>> {
/// Comparing `Weak::new`.
///
/// ```
/// #![feature(weak_ptr_eq)]
/// use std::sync::{Arc, Weak};
///
/// let first = Weak::new();
@@ -1592,7 +1590,7 @@ fn inner(&self) -> Option<&ArcInner<T>> {
/// assert!(!first.ptr_eq(&third));
/// ```
#[inline]
#[unstable(feature = "weak_ptr_eq", issue = "55981")]
#[stable(feature = "weak_ptr_eq", since = "1.39.0")]
pub fn ptr_eq(&self, other: &Self) -> bool {
self.ptr.as_ptr() == other.ptr.as_ptr()
}