Add 'feature' and 'since' to stability attributes
This commit is contained in:
@@ -142,7 +142,7 @@
|
||||
//! }
|
||||
//! ```
|
||||
|
||||
#![stable]
|
||||
#![stable(feature = "grandfathered", since = "1.0.0")]
|
||||
|
||||
use core::borrow::BorrowFrom;
|
||||
use core::cell::Cell;
|
||||
@@ -173,8 +173,8 @@ struct RcBox<T> {
|
||||
///
|
||||
/// See the [module level documentation](../index.html) for more details.
|
||||
#[unsafe_no_drop_flag]
|
||||
#[stable]
|
||||
#[cfg(stage0)] // NOTE remove impl after next snapshot
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
pub struct Rc<T> {
|
||||
// FIXME #12808: strange names to try to avoid interfering with field accesses of the contained
|
||||
// type via Deref
|
||||
@@ -187,7 +187,7 @@ pub struct Rc<T> {
|
||||
///
|
||||
/// See the [module level documentation](../index.html) for more details.
|
||||
#[unsafe_no_drop_flag]
|
||||
#[stable]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[cfg(not(stage0))] // NOTE remove cfg after next snapshot
|
||||
pub struct Rc<T> {
|
||||
// FIXME #12808: strange names to try to avoid interfering with field accesses of the contained
|
||||
@@ -211,8 +211,8 @@ impl<T> Rc<T> {
|
||||
///
|
||||
/// let five = Rc::new(5i);
|
||||
/// ```
|
||||
#[stable]
|
||||
#[cfg(stage0)] // NOTE remove after next snapshot
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
pub fn new(value: T) -> Rc<T> {
|
||||
unsafe {
|
||||
Rc {
|
||||
@@ -239,7 +239,7 @@ impl<T> Rc<T> {
|
||||
///
|
||||
/// let five = Rc::new(5i);
|
||||
/// ```
|
||||
#[stable]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[cfg(not(stage0))] // NOTE remove cfg after next snapshot
|
||||
pub fn new(value: T) -> Rc<T> {
|
||||
unsafe {
|
||||
@@ -268,7 +268,8 @@ impl<T> Rc<T> {
|
||||
/// let weak_five = five.downgrade();
|
||||
/// ```
|
||||
#[cfg(stage0)] // NOTE remove after next snapshot
|
||||
#[unstable = "Weak pointers may not belong in this module"]
|
||||
#[unstable(feature = "unnamed_feature", since = "1.0.0",
|
||||
reason = "Weak pointers may not belong in this module")]
|
||||
pub fn downgrade(&self) -> Weak<T> {
|
||||
self.inc_weak();
|
||||
Weak {
|
||||
@@ -290,7 +291,8 @@ impl<T> Rc<T> {
|
||||
/// let weak_five = five.downgrade();
|
||||
/// ```
|
||||
#[cfg(not(stage0))] // NOTE remove cfg after next snapshot
|
||||
#[unstable = "Weak pointers may not belong in this module"]
|
||||
#[unstable(feature = "unnamed_feature", since = "1.0.0",
|
||||
reason = "Weak pointers may not belong in this module")]
|
||||
pub fn downgrade(&self) -> Weak<T> {
|
||||
self.inc_weak();
|
||||
Weak { _ptr: self._ptr }
|
||||
@@ -299,12 +301,12 @@ impl<T> Rc<T> {
|
||||
|
||||
/// Get the number of weak references to this value.
|
||||
#[inline]
|
||||
#[unstable]
|
||||
#[unstable(feature = "unnamed_feature", since = "1.0.0")]
|
||||
pub fn weak_count<T>(this: &Rc<T>) -> uint { this.weak() - 1 }
|
||||
|
||||
/// Get the number of strong references to this value.
|
||||
#[inline]
|
||||
#[unstable]
|
||||
#[unstable(feature = "unnamed_feature", since = "1.0.0")]
|
||||
pub fn strong_count<T>(this: &Rc<T>) -> uint { this.strong() }
|
||||
|
||||
/// Returns true if there are no other `Rc` or `Weak<T>` values that share the same inner value.
|
||||
@@ -320,7 +322,7 @@ pub fn strong_count<T>(this: &Rc<T>) -> uint { this.strong() }
|
||||
/// rc::is_unique(&five);
|
||||
/// ```
|
||||
#[inline]
|
||||
#[unstable]
|
||||
#[unstable(feature = "unnamed_feature", since = "1.0.0")]
|
||||
pub fn is_unique<T>(rc: &Rc<T>) -> bool {
|
||||
weak_count(rc) == 0 && strong_count(rc) == 1
|
||||
}
|
||||
@@ -342,7 +344,7 @@ pub fn is_unique<T>(rc: &Rc<T>) -> bool {
|
||||
/// assert_eq!(rc::try_unwrap(x), Err(Rc::new(4u)));
|
||||
/// ```
|
||||
#[inline]
|
||||
#[unstable]
|
||||
#[unstable(feature = "unnamed_feature", since = "1.0.0")]
|
||||
pub fn try_unwrap<T>(rc: Rc<T>) -> Result<T, Rc<T>> {
|
||||
if is_unique(&rc) {
|
||||
unsafe {
|
||||
@@ -376,7 +378,7 @@ pub fn try_unwrap<T>(rc: Rc<T>) -> Result<T, Rc<T>> {
|
||||
/// assert!(rc::get_mut(&mut x).is_none());
|
||||
/// ```
|
||||
#[inline]
|
||||
#[unstable]
|
||||
#[unstable(feature = "unnamed_feature", since = "1.0.0")]
|
||||
pub fn get_mut<'a, T>(rc: &'a mut Rc<T>) -> Option<&'a mut T> {
|
||||
if is_unique(rc) {
|
||||
let inner = unsafe { &mut **rc._ptr };
|
||||
@@ -402,7 +404,7 @@ impl<T: Clone> Rc<T> {
|
||||
/// let mut_five = five.make_unique();
|
||||
/// ```
|
||||
#[inline]
|
||||
#[unstable]
|
||||
#[unstable(feature = "unnamed_feature", since = "1.0.0")]
|
||||
pub fn make_unique(&mut self) -> &mut T {
|
||||
if !is_unique(self) {
|
||||
*self = Rc::new((**self).clone())
|
||||
@@ -422,7 +424,7 @@ impl<T> BorrowFrom<Rc<T>> for T {
|
||||
}
|
||||
}
|
||||
|
||||
#[stable]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
impl<T> Deref for Rc<T> {
|
||||
type Target = T;
|
||||
|
||||
@@ -433,7 +435,7 @@ impl<T> Deref for Rc<T> {
|
||||
}
|
||||
|
||||
#[unsafe_destructor]
|
||||
#[stable]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
impl<T> Drop for Rc<T> {
|
||||
/// Drops the `Rc<T>`.
|
||||
///
|
||||
@@ -481,7 +483,7 @@ impl<T> Drop for Rc<T> {
|
||||
}
|
||||
}
|
||||
|
||||
#[stable]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
impl<T> Clone for Rc<T> {
|
||||
/// Makes a clone of the `Rc<T>`.
|
||||
///
|
||||
@@ -524,7 +526,7 @@ impl<T> Clone for Rc<T> {
|
||||
}
|
||||
}
|
||||
|
||||
#[stable]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
impl<T: Default> Default for Rc<T> {
|
||||
/// Creates a new `Rc<T>`, with the `Default` value for `T`.
|
||||
///
|
||||
@@ -537,13 +539,13 @@ impl<T: Default> Default for Rc<T> {
|
||||
/// let x: Rc<int> = Default::default();
|
||||
/// ```
|
||||
#[inline]
|
||||
#[stable]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
fn default() -> Rc<T> {
|
||||
Rc::new(Default::default())
|
||||
}
|
||||
}
|
||||
|
||||
#[stable]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
impl<T: PartialEq> PartialEq for Rc<T> {
|
||||
/// Equality for two `Rc<T>`s.
|
||||
///
|
||||
@@ -578,10 +580,10 @@ impl<T: PartialEq> PartialEq for Rc<T> {
|
||||
fn ne(&self, other: &Rc<T>) -> bool { **self != **other }
|
||||
}
|
||||
|
||||
#[stable]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
impl<T: Eq> Eq for Rc<T> {}
|
||||
|
||||
#[stable]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
impl<T: PartialOrd> PartialOrd for Rc<T> {
|
||||
/// Partial comparison for two `Rc<T>`s.
|
||||
///
|
||||
@@ -666,7 +668,7 @@ impl<T: PartialOrd> PartialOrd for Rc<T> {
|
||||
fn ge(&self, other: &Rc<T>) -> bool { **self >= **other }
|
||||
}
|
||||
|
||||
#[stable]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
impl<T: Ord> Ord for Rc<T> {
|
||||
/// Comparison for two `Rc<T>`s.
|
||||
///
|
||||
@@ -693,14 +695,14 @@ impl<S: hash::Hasher, T: Hash<S>> Hash<S> for Rc<T> {
|
||||
}
|
||||
}
|
||||
|
||||
#[unstable = "Show is experimental."]
|
||||
#[unstable(feature = "unnamed_feature", since = "1.0.0", reason = "Show is experimental.")]
|
||||
impl<T: fmt::Show> fmt::Show for Rc<T> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
write!(f, "Rc({:?})", **self)
|
||||
}
|
||||
}
|
||||
|
||||
#[stable]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
impl<T: fmt::String> fmt::String for Rc<T> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
fmt::String::fmt(&**self, f)
|
||||
@@ -713,8 +715,9 @@ impl<T: fmt::String> fmt::String for Rc<T> {
|
||||
///
|
||||
/// See the [module level documentation](../index.html) for more.
|
||||
#[unsafe_no_drop_flag]
|
||||
#[unstable = "Weak pointers may not belong in this module."]
|
||||
#[cfg(stage0)] // NOTE remove impl after next snapshot
|
||||
#[unstable(feature = "unnamed_feature", since = "1.0.0",
|
||||
reason = "Weak pointers may not belong in this module.")]
|
||||
pub struct Weak<T> {
|
||||
// FIXME #12808: strange names to try to avoid interfering with
|
||||
// field accesses of the contained type via Deref
|
||||
@@ -729,7 +732,8 @@ pub struct Weak<T> {
|
||||
///
|
||||
/// See the [module level documentation](../index.html) for more.
|
||||
#[unsafe_no_drop_flag]
|
||||
#[unstable = "Weak pointers may not belong in this module."]
|
||||
#[unstable(feature = "unnamed_feature", since = "1.0.0",
|
||||
reason = "Weak pointers may not belong in this module.")]
|
||||
#[cfg(not(stage0))] // NOTE remove cfg after next snapshot
|
||||
pub struct Weak<T> {
|
||||
// FIXME #12808: strange names to try to avoid interfering with
|
||||
@@ -746,7 +750,8 @@ impl<T> !marker::Send for Weak<T> {}
|
||||
impl<T> !marker::Sync for Weak<T> {}
|
||||
|
||||
|
||||
#[unstable = "Weak pointers may not belong in this module."]
|
||||
#[unstable(feature = "unnamed_feature", since = "1.0.0",
|
||||
reason = "Weak pointers may not belong in this module.")]
|
||||
impl<T> Weak<T> {
|
||||
/// Upgrades a weak reference to a strong reference.
|
||||
///
|
||||
@@ -804,7 +809,7 @@ impl<T> Weak<T> {
|
||||
}
|
||||
|
||||
#[unsafe_destructor]
|
||||
#[stable]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
impl<T> Drop for Weak<T> {
|
||||
/// Drops the `Weak<T>`.
|
||||
///
|
||||
@@ -847,7 +852,8 @@ impl<T> Drop for Weak<T> {
|
||||
}
|
||||
}
|
||||
|
||||
#[unstable = "Weak pointers may not belong in this module."]
|
||||
#[unstable(feature = "unnamed_feature", since = "1.0.0",
|
||||
reason = "Weak pointers may not belong in this module.")]
|
||||
impl<T> Clone for Weak<T> {
|
||||
/// Makes a clone of the `Weak<T>`.
|
||||
///
|
||||
@@ -890,7 +896,7 @@ impl<T> Clone for Weak<T> {
|
||||
}
|
||||
}
|
||||
|
||||
#[unstable = "Show is experimental."]
|
||||
#[unstable(feature = "unnamed_feature", since = "1.0.0", reason = "Show is experimental.")]
|
||||
impl<T: fmt::Show> fmt::Show for Weak<T> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
write!(f, "(Weak)")
|
||||
|
||||
Reference in New Issue
Block a user