grandfathered -> rust1

This commit is contained in:
Brian Anderson 2015-01-23 21:48:20 -08:00
parent b7fe2c54b7
commit b44ee371b8
102 changed files with 1490 additions and 1490 deletions

View File

@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
#![stable(feature = "grandfathered", since = "1.0.0")] #![stable(feature = "rust1", since = "1.0.0")]
//! Threadsafe reference-counted boxes (the `Arc<T>` type). //! Threadsafe reference-counted boxes (the `Arc<T>` type).
//! //!
@ -110,7 +110,7 @@ use heap::deallocate;
/// } /// }
/// ``` /// ```
#[unsafe_no_drop_flag] #[unsafe_no_drop_flag]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub struct Arc<T> { pub struct Arc<T> {
// FIXME #12808: strange name to try to avoid interfering with // FIXME #12808: strange name to try to avoid interfering with
// field accesses of the contained type via Deref // field accesses of the contained type via Deref
@ -157,7 +157,7 @@ impl<T> Arc<T> {
/// let five = Arc::new(5i); /// let five = Arc::new(5i);
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn new(data: T) -> Arc<T> { pub fn new(data: T) -> Arc<T> {
// Start the weak pointer count as 1 which is the weak pointer that's // Start the weak pointer count as 1 which is the weak pointer that's
// held by all the strong pointers (kinda), see std/rc.rs for more info // held by all the strong pointers (kinda), see std/rc.rs for more info
@ -210,7 +210,7 @@ pub fn weak_count<T>(this: &Arc<T>) -> uint { this.inner().weak.load(SeqCst) - 1
#[unstable(feature = "alloc")] #[unstable(feature = "alloc")]
pub fn strong_count<T>(this: &Arc<T>) -> uint { this.inner().strong.load(SeqCst) } pub fn strong_count<T>(this: &Arc<T>) -> uint { this.inner().strong.load(SeqCst) }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<T> Clone for Arc<T> { impl<T> Clone for Arc<T> {
/// Makes a clone of the `Arc<T>`. /// Makes a clone of the `Arc<T>`.
/// ///
@ -247,7 +247,7 @@ impl<T> BorrowFrom<Arc<T>> for T {
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<T> Deref for Arc<T> { impl<T> Deref for Arc<T> {
type Target = T; type Target = T;
@ -291,7 +291,7 @@ impl<T: Send + Sync + Clone> Arc<T> {
} }
#[unsafe_destructor] #[unsafe_destructor]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<T: Sync + Send> Drop for Arc<T> { impl<T: Sync + Send> Drop for Arc<T> {
/// Drops the `Arc<T>`. /// Drops the `Arc<T>`.
/// ///
@ -421,7 +421,7 @@ impl<T: Sync + Send> Clone for Weak<T> {
} }
#[unsafe_destructor] #[unsafe_destructor]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<T: Sync + Send> Drop for Weak<T> { impl<T: Sync + Send> Drop for Weak<T> {
/// Drops the `Weak<T>`. /// Drops the `Weak<T>`.
/// ///
@ -464,7 +464,7 @@ impl<T: Sync + Send> Drop for Weak<T> {
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<T: PartialEq> PartialEq for Arc<T> { impl<T: PartialEq> PartialEq for Arc<T> {
/// Equality for two `Arc<T>`s. /// Equality for two `Arc<T>`s.
/// ///
@ -496,7 +496,7 @@ impl<T: PartialEq> PartialEq for Arc<T> {
/// ``` /// ```
fn ne(&self, other: &Arc<T>) -> bool { *(*self) != *(*other) } fn ne(&self, other: &Arc<T>) -> bool { *(*self) != *(*other) }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<T: PartialOrd> PartialOrd for Arc<T> { impl<T: PartialOrd> PartialOrd for Arc<T> {
/// Partial comparison for two `Arc<T>`s. /// Partial comparison for two `Arc<T>`s.
/// ///
@ -575,11 +575,11 @@ impl<T: PartialOrd> PartialOrd for Arc<T> {
/// ``` /// ```
fn ge(&self, other: &Arc<T>) -> bool { *(*self) >= *(*other) } fn ge(&self, other: &Arc<T>) -> bool { *(*self) >= *(*other) }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<T: Ord> Ord for Arc<T> { impl<T: Ord> Ord for Arc<T> {
fn cmp(&self, other: &Arc<T>) -> Ordering { (**self).cmp(&**other) } fn cmp(&self, other: &Arc<T>) -> Ordering { (**self).cmp(&**other) }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<T: Eq> Eq for Arc<T> {} impl<T: Eq> Eq for Arc<T> {}
impl<T: fmt::Show> fmt::Show for Arc<T> { impl<T: fmt::Show> fmt::Show for Arc<T> {
@ -588,16 +588,16 @@ impl<T: fmt::Show> fmt::Show for Arc<T> {
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<T: fmt::String> fmt::String for Arc<T> { impl<T: fmt::String> fmt::String for Arc<T> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fmt::String::fmt(&**self, f) fmt::String::fmt(&**self, f)
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<T: Default + Sync + Send> Default for Arc<T> { impl<T: Default + Sync + Send> Default for Arc<T> {
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn default() -> Arc<T> { Arc::new(Default::default()) } fn default() -> Arc<T> { Arc::new(Default::default()) }
} }

View File

@ -10,7 +10,7 @@
//! A unique pointer type. //! A unique pointer type.
#![stable(feature = "grandfathered", since = "1.0.0")] #![stable(feature = "rust1", since = "1.0.0")]
use core::any::Any; use core::any::Any;
use core::clone::Clone; use core::clone::Clone;
@ -50,30 +50,30 @@ pub static HEAP: () = ();
/// A type that represents a uniquely-owned value. /// A type that represents a uniquely-owned value.
#[lang = "owned_box"] #[lang = "owned_box"]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub struct Box<T>(Unique<T>); pub struct Box<T>(Unique<T>);
impl<T> Box<T> { impl<T> Box<T> {
/// Moves `x` into a freshly allocated box on the global exchange heap. /// Moves `x` into a freshly allocated box on the global exchange heap.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn new(x: T) -> Box<T> { pub fn new(x: T) -> Box<T> {
box x box x
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<T: Default> Default for Box<T> { impl<T: Default> Default for Box<T> {
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn default() -> Box<T> { box Default::default() } fn default() -> Box<T> { box Default::default() }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<T> Default for Box<[T]> { impl<T> Default for Box<[T]> {
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn default() -> Box<[T]> { box [] } fn default() -> Box<[T]> { box [] }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<T: Clone> Clone for Box<T> { impl<T: Clone> Clone for Box<T> {
/// Returns a copy of the owned box. /// Returns a copy of the owned box.
#[inline] #[inline]
@ -86,14 +86,14 @@ impl<T: Clone> Clone for Box<T> {
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<T: ?Sized + PartialEq> PartialEq for Box<T> { impl<T: ?Sized + PartialEq> PartialEq for Box<T> {
#[inline] #[inline]
fn eq(&self, other: &Box<T>) -> bool { PartialEq::eq(&**self, &**other) } fn eq(&self, other: &Box<T>) -> bool { PartialEq::eq(&**self, &**other) }
#[inline] #[inline]
fn ne(&self, other: &Box<T>) -> bool { PartialEq::ne(&**self, &**other) } fn ne(&self, other: &Box<T>) -> bool { PartialEq::ne(&**self, &**other) }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<T: ?Sized + PartialOrd> PartialOrd for Box<T> { impl<T: ?Sized + PartialOrd> PartialOrd for Box<T> {
#[inline] #[inline]
fn partial_cmp(&self, other: &Box<T>) -> Option<Ordering> { fn partial_cmp(&self, other: &Box<T>) -> Option<Ordering> {
@ -108,14 +108,14 @@ impl<T: ?Sized + PartialOrd> PartialOrd for Box<T> {
#[inline] #[inline]
fn gt(&self, other: &Box<T>) -> bool { PartialOrd::gt(&**self, &**other) } fn gt(&self, other: &Box<T>) -> bool { PartialOrd::gt(&**self, &**other) }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<T: ?Sized + Ord> Ord for Box<T> { impl<T: ?Sized + Ord> Ord for Box<T> {
#[inline] #[inline]
fn cmp(&self, other: &Box<T>) -> Ordering { fn cmp(&self, other: &Box<T>) -> Ordering {
Ord::cmp(&**self, &**other) Ord::cmp(&**self, &**other)
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<T: ?Sized + Eq> Eq for Box<T> {} impl<T: ?Sized + Eq> Eq for Box<T> {}
impl<S: hash::Hasher, T: ?Sized + Hash<S>> Hash<S> for Box<T> { impl<S: hash::Hasher, T: ?Sized + Hash<S>> Hash<S> for Box<T> {
@ -135,11 +135,11 @@ impl<S: hash::Hasher, T: ?Sized + Hash<S>> Hash<S> for Box<T> {
pub trait BoxAny { pub trait BoxAny {
/// Returns the boxed value if it is of type `T`, or /// Returns the boxed value if it is of type `T`, or
/// `Err(Self)` if it isn't. /// `Err(Self)` if it isn't.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn downcast<T: 'static>(self) -> Result<Box<T>, Self>; fn downcast<T: 'static>(self) -> Result<Box<T>, Self>;
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl BoxAny for Box<Any> { impl BoxAny for Box<Any> {
#[inline] #[inline]
fn downcast<T: 'static>(self) -> Result<Box<T>, Box<Any>> { fn downcast<T: 'static>(self) -> Result<Box<T>, Box<Any>> {
@ -164,7 +164,7 @@ impl<T: ?Sized + fmt::Show> fmt::Show for Box<T> {
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<T: ?Sized + fmt::String> fmt::String for Box<T> { impl<T: ?Sized + fmt::String> fmt::String for Box<T> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fmt::String::fmt(&**self, f) fmt::String::fmt(&**self, f)
@ -177,14 +177,14 @@ impl fmt::Show for Box<Any> {
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<T: ?Sized> Deref for Box<T> { impl<T: ?Sized> Deref for Box<T> {
type Target = T; type Target = T;
fn deref(&self) -> &T { &**self } fn deref(&self) -> &T { &**self }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<T: ?Sized> DerefMut for Box<T> { impl<T: ?Sized> DerefMut for Box<T> {
fn deref_mut(&mut self) -> &mut T { &mut **self } fn deref_mut(&mut self) -> &mut T { &mut **self }
} }

View File

@ -142,7 +142,7 @@
//! } //! }
//! ``` //! ```
#![stable(feature = "grandfathered", since = "1.0.0")] #![stable(feature = "rust1", since = "1.0.0")]
use core::borrow::BorrowFrom; use core::borrow::BorrowFrom;
use core::cell::Cell; use core::cell::Cell;
@ -174,7 +174,7 @@ struct RcBox<T> {
/// See the [module level documentation](../index.html) for more details. /// See the [module level documentation](../index.html) for more details.
#[unsafe_no_drop_flag] #[unsafe_no_drop_flag]
#[cfg(stage0)] // NOTE remove impl after next snapshot #[cfg(stage0)] // NOTE remove impl after next snapshot
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub struct Rc<T> { pub struct Rc<T> {
// FIXME #12808: strange names to try to avoid interfering with field accesses of the contained // FIXME #12808: strange names to try to avoid interfering with field accesses of the contained
// type via Deref // type via Deref
@ -187,7 +187,7 @@ pub struct Rc<T> {
/// ///
/// See the [module level documentation](../index.html) for more details. /// See the [module level documentation](../index.html) for more details.
#[unsafe_no_drop_flag] #[unsafe_no_drop_flag]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[cfg(not(stage0))] // NOTE remove cfg after next snapshot #[cfg(not(stage0))] // NOTE remove cfg after next snapshot
pub struct Rc<T> { pub struct Rc<T> {
// FIXME #12808: strange names to try to avoid interfering with field accesses of the contained // FIXME #12808: strange names to try to avoid interfering with field accesses of the contained
@ -212,7 +212,7 @@ impl<T> Rc<T> {
/// let five = Rc::new(5i); /// let five = Rc::new(5i);
/// ``` /// ```
#[cfg(stage0)] // NOTE remove after next snapshot #[cfg(stage0)] // NOTE remove after next snapshot
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn new(value: T) -> Rc<T> { pub fn new(value: T) -> Rc<T> {
unsafe { unsafe {
Rc { Rc {
@ -239,7 +239,7 @@ impl<T> Rc<T> {
/// ///
/// let five = Rc::new(5i); /// let five = Rc::new(5i);
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[cfg(not(stage0))] // NOTE remove cfg after next snapshot #[cfg(not(stage0))] // NOTE remove cfg after next snapshot
pub fn new(value: T) -> Rc<T> { pub fn new(value: T) -> Rc<T> {
unsafe { unsafe {
@ -424,7 +424,7 @@ impl<T> BorrowFrom<Rc<T>> for T {
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<T> Deref for Rc<T> { impl<T> Deref for Rc<T> {
type Target = T; type Target = T;
@ -435,7 +435,7 @@ impl<T> Deref for Rc<T> {
} }
#[unsafe_destructor] #[unsafe_destructor]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<T> Drop for Rc<T> { impl<T> Drop for Rc<T> {
/// Drops the `Rc<T>`. /// Drops the `Rc<T>`.
/// ///
@ -483,7 +483,7 @@ impl<T> Drop for Rc<T> {
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<T> Clone for Rc<T> { impl<T> Clone for Rc<T> {
/// Makes a clone of the `Rc<T>`. /// Makes a clone of the `Rc<T>`.
/// ///
@ -526,7 +526,7 @@ impl<T> Clone for Rc<T> {
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<T: Default> Default for Rc<T> { impl<T: Default> Default for Rc<T> {
/// Creates a new `Rc<T>`, with the `Default` value for `T`. /// Creates a new `Rc<T>`, with the `Default` value for `T`.
/// ///
@ -539,13 +539,13 @@ impl<T: Default> Default for Rc<T> {
/// let x: Rc<int> = Default::default(); /// let x: Rc<int> = Default::default();
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn default() -> Rc<T> { fn default() -> Rc<T> {
Rc::new(Default::default()) Rc::new(Default::default())
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<T: PartialEq> PartialEq for Rc<T> { impl<T: PartialEq> PartialEq for Rc<T> {
/// Equality for two `Rc<T>`s. /// Equality for two `Rc<T>`s.
/// ///
@ -580,10 +580,10 @@ impl<T: PartialEq> PartialEq for Rc<T> {
fn ne(&self, other: &Rc<T>) -> bool { **self != **other } fn ne(&self, other: &Rc<T>) -> bool { **self != **other }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<T: Eq> Eq for Rc<T> {} impl<T: Eq> Eq for Rc<T> {}
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<T: PartialOrd> PartialOrd for Rc<T> { impl<T: PartialOrd> PartialOrd for Rc<T> {
/// Partial comparison for two `Rc<T>`s. /// Partial comparison for two `Rc<T>`s.
/// ///
@ -668,7 +668,7 @@ impl<T: PartialOrd> PartialOrd for Rc<T> {
fn ge(&self, other: &Rc<T>) -> bool { **self >= **other } fn ge(&self, other: &Rc<T>) -> bool { **self >= **other }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<T: Ord> Ord for Rc<T> { impl<T: Ord> Ord for Rc<T> {
/// Comparison for two `Rc<T>`s. /// Comparison for two `Rc<T>`s.
/// ///
@ -702,7 +702,7 @@ impl<T: fmt::Show> fmt::Show for Rc<T> {
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<T: fmt::String> fmt::String for Rc<T> { impl<T: fmt::String> fmt::String for Rc<T> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fmt::String::fmt(&**self, f) fmt::String::fmt(&**self, f)
@ -807,7 +807,7 @@ impl<T> Weak<T> {
} }
#[unsafe_destructor] #[unsafe_destructor]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<T> Drop for Weak<T> { impl<T> Drop for Weak<T> {
/// Drops the `Weak<T>`. /// Drops the `Weak<T>`.
/// ///

View File

@ -148,7 +148,7 @@
//! ``` //! ```
#![allow(missing_docs)] #![allow(missing_docs)]
#![stable(feature = "grandfathered", since = "1.0.0")] #![stable(feature = "rust1", since = "1.0.0")]
use core::prelude::*; use core::prelude::*;
@ -164,12 +164,12 @@ use vec::{self, Vec};
/// ///
/// This will be a max-heap. /// This will be a max-heap.
#[derive(Clone)] #[derive(Clone)]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub struct BinaryHeap<T> { pub struct BinaryHeap<T> {
data: Vec<T>, data: Vec<T>,
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<T: Ord> Default for BinaryHeap<T> { impl<T: Ord> Default for BinaryHeap<T> {
#[inline] #[inline]
fn default() -> BinaryHeap<T> { BinaryHeap::new() } fn default() -> BinaryHeap<T> { BinaryHeap::new() }
@ -185,7 +185,7 @@ impl<T: Ord> BinaryHeap<T> {
/// let mut heap = BinaryHeap::new(); /// let mut heap = BinaryHeap::new();
/// heap.push(4u); /// heap.push(4u);
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn new() -> BinaryHeap<T> { BinaryHeap { data: vec![] } } pub fn new() -> BinaryHeap<T> { BinaryHeap { data: vec![] } }
/// Creates an empty `BinaryHeap` with a specific capacity. /// Creates an empty `BinaryHeap` with a specific capacity.
@ -200,7 +200,7 @@ impl<T: Ord> BinaryHeap<T> {
/// let mut heap = BinaryHeap::with_capacity(10); /// let mut heap = BinaryHeap::with_capacity(10);
/// heap.push(4u); /// heap.push(4u);
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn with_capacity(capacity: uint) -> BinaryHeap<T> { pub fn with_capacity(capacity: uint) -> BinaryHeap<T> {
BinaryHeap { data: Vec::with_capacity(capacity) } BinaryHeap { data: Vec::with_capacity(capacity) }
} }
@ -238,7 +238,7 @@ impl<T: Ord> BinaryHeap<T> {
/// println!("{}", x); /// println!("{}", x);
/// } /// }
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn iter(&self) -> Iter<T> { pub fn iter(&self) -> Iter<T> {
Iter { iter: self.data.iter() } Iter { iter: self.data.iter() }
} }
@ -259,7 +259,7 @@ impl<T: Ord> BinaryHeap<T> {
/// println!("{}", x); /// println!("{}", x);
/// } /// }
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn into_iter(self) -> IntoIter<T> { pub fn into_iter(self) -> IntoIter<T> {
IntoIter { iter: self.data.into_iter() } IntoIter { iter: self.data.into_iter() }
} }
@ -279,7 +279,7 @@ impl<T: Ord> BinaryHeap<T> {
/// assert_eq!(heap.peek(), Some(&5)); /// assert_eq!(heap.peek(), Some(&5));
/// ///
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn peek(&self) -> Option<&T> { pub fn peek(&self) -> Option<&T> {
self.data.get(0) self.data.get(0)
} }
@ -294,7 +294,7 @@ impl<T: Ord> BinaryHeap<T> {
/// assert!(heap.capacity() >= 100); /// assert!(heap.capacity() >= 100);
/// heap.push(4u); /// heap.push(4u);
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn capacity(&self) -> uint { self.data.capacity() } pub fn capacity(&self) -> uint { self.data.capacity() }
/// Reserves the minimum capacity for exactly `additional` more elements to be inserted in the /// Reserves the minimum capacity for exactly `additional` more elements to be inserted in the
@ -317,7 +317,7 @@ impl<T: Ord> BinaryHeap<T> {
/// assert!(heap.capacity() >= 100); /// assert!(heap.capacity() >= 100);
/// heap.push(4u); /// heap.push(4u);
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn reserve_exact(&mut self, additional: uint) { pub fn reserve_exact(&mut self, additional: uint) {
self.data.reserve_exact(additional); self.data.reserve_exact(additional);
} }
@ -338,13 +338,13 @@ impl<T: Ord> BinaryHeap<T> {
/// assert!(heap.capacity() >= 100); /// assert!(heap.capacity() >= 100);
/// heap.push(4u); /// heap.push(4u);
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn reserve(&mut self, additional: uint) { pub fn reserve(&mut self, additional: uint) {
self.data.reserve(additional); self.data.reserve(additional);
} }
/// Discards as much additional capacity as possible. /// Discards as much additional capacity as possible.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn shrink_to_fit(&mut self) { pub fn shrink_to_fit(&mut self) {
self.data.shrink_to_fit(); self.data.shrink_to_fit();
} }
@ -362,7 +362,7 @@ impl<T: Ord> BinaryHeap<T> {
/// assert_eq!(heap.pop(), Some(1)); /// assert_eq!(heap.pop(), Some(1));
/// assert_eq!(heap.pop(), None); /// assert_eq!(heap.pop(), None);
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn pop(&mut self) -> Option<T> { pub fn pop(&mut self) -> Option<T> {
self.data.pop().map(|mut item| { self.data.pop().map(|mut item| {
if !self.is_empty() { if !self.is_empty() {
@ -387,7 +387,7 @@ impl<T: Ord> BinaryHeap<T> {
/// assert_eq!(heap.len(), 3); /// assert_eq!(heap.len(), 3);
/// assert_eq!(heap.peek(), Some(&5)); /// assert_eq!(heap.peek(), Some(&5));
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn push(&mut self, item: T) { pub fn push(&mut self, item: T) {
let old_len = self.len(); let old_len = self.len();
self.data.push(item); self.data.push(item);
@ -542,11 +542,11 @@ impl<T: Ord> BinaryHeap<T> {
} }
/// Returns the length of the binary heap. /// Returns the length of the binary heap.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn len(&self) -> uint { self.data.len() } pub fn len(&self) -> uint { self.data.len() }
/// Checks if the binary heap is empty. /// Checks if the binary heap is empty.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn is_empty(&self) -> bool { self.len() == 0 } pub fn is_empty(&self) -> bool { self.len() == 0 }
/// Clears the binary heap, returning an iterator over the removed elements. /// Clears the binary heap, returning an iterator over the removed elements.
@ -558,25 +558,25 @@ impl<T: Ord> BinaryHeap<T> {
} }
/// Drops all items from the binary heap. /// Drops all items from the binary heap.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn clear(&mut self) { self.drain(); } pub fn clear(&mut self) { self.drain(); }
} }
/// `BinaryHeap` iterator. /// `BinaryHeap` iterator.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub struct Iter <'a, T: 'a> { pub struct Iter <'a, T: 'a> {
iter: slice::Iter<'a, T>, iter: slice::Iter<'a, T>,
} }
// FIXME(#19839) Remove in favor of `#[derive(Clone)]` // FIXME(#19839) Remove in favor of `#[derive(Clone)]`
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a, T> Clone for Iter<'a, T> { impl<'a, T> Clone for Iter<'a, T> {
fn clone(&self) -> Iter<'a, T> { fn clone(&self) -> Iter<'a, T> {
Iter { iter: self.iter.clone() } Iter { iter: self.iter.clone() }
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a, T> Iterator for Iter<'a, T> { impl<'a, T> Iterator for Iter<'a, T> {
type Item = &'a T; type Item = &'a T;
@ -587,22 +587,22 @@ impl<'a, T> Iterator for Iter<'a, T> {
fn size_hint(&self) -> (uint, Option<uint>) { self.iter.size_hint() } fn size_hint(&self) -> (uint, Option<uint>) { self.iter.size_hint() }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a, T> DoubleEndedIterator for Iter<'a, T> { impl<'a, T> DoubleEndedIterator for Iter<'a, T> {
#[inline] #[inline]
fn next_back(&mut self) -> Option<&'a T> { self.iter.next_back() } fn next_back(&mut self) -> Option<&'a T> { self.iter.next_back() }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a, T> ExactSizeIterator for Iter<'a, T> {} impl<'a, T> ExactSizeIterator for Iter<'a, T> {}
/// An iterator that moves out of a `BinaryHeap`. /// An iterator that moves out of a `BinaryHeap`.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub struct IntoIter<T> { pub struct IntoIter<T> {
iter: vec::IntoIter<T>, iter: vec::IntoIter<T>,
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<T> Iterator for IntoIter<T> { impl<T> Iterator for IntoIter<T> {
type Item = T; type Item = T;
@ -613,13 +613,13 @@ impl<T> Iterator for IntoIter<T> {
fn size_hint(&self) -> (uint, Option<uint>) { self.iter.size_hint() } fn size_hint(&self) -> (uint, Option<uint>) { self.iter.size_hint() }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<T> DoubleEndedIterator for IntoIter<T> { impl<T> DoubleEndedIterator for IntoIter<T> {
#[inline] #[inline]
fn next_back(&mut self) -> Option<T> { self.iter.next_back() } fn next_back(&mut self) -> Option<T> { self.iter.next_back() }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<T> ExactSizeIterator for IntoIter<T> {} impl<T> ExactSizeIterator for IntoIter<T> {}
/// An iterator that drains a `BinaryHeap`. /// An iterator that drains a `BinaryHeap`.
@ -628,7 +628,7 @@ pub struct Drain<'a, T: 'a> {
iter: vec::Drain<'a, T>, iter: vec::Drain<'a, T>,
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a, T: 'a> Iterator for Drain<'a, T> { impl<'a, T: 'a> Iterator for Drain<'a, T> {
type Item = T; type Item = T;
@ -639,23 +639,23 @@ impl<'a, T: 'a> Iterator for Drain<'a, T> {
fn size_hint(&self) -> (uint, Option<uint>) { self.iter.size_hint() } fn size_hint(&self) -> (uint, Option<uint>) { self.iter.size_hint() }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a, T: 'a> DoubleEndedIterator for Drain<'a, T> { impl<'a, T: 'a> DoubleEndedIterator for Drain<'a, T> {
#[inline] #[inline]
fn next_back(&mut self) -> Option<T> { self.iter.next_back() } fn next_back(&mut self) -> Option<T> { self.iter.next_back() }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a, T: 'a> ExactSizeIterator for Drain<'a, T> {} impl<'a, T: 'a> ExactSizeIterator for Drain<'a, T> {}
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<T: Ord> FromIterator<T> for BinaryHeap<T> { impl<T: Ord> FromIterator<T> for BinaryHeap<T> {
fn from_iter<Iter: Iterator<Item=T>>(iter: Iter) -> BinaryHeap<T> { fn from_iter<Iter: Iterator<Item=T>>(iter: Iter) -> BinaryHeap<T> {
BinaryHeap::from_vec(iter.collect()) BinaryHeap::from_vec(iter.collect())
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<T: Ord> Extend<T> for BinaryHeap<T> { impl<T: Ord> Extend<T> for BinaryHeap<T> {
fn extend<Iter: Iterator<Item=T>>(&mut self, mut iter: Iter) { fn extend<Iter: Iterator<Item=T>>(&mut self, mut iter: Iter) {
let (lower, _) = iter.size_hint(); let (lower, _) = iter.size_hint();

View File

@ -253,7 +253,7 @@ impl Bitv {
/// use std::collections::Bitv; /// use std::collections::Bitv;
/// let mut bv = Bitv::new(); /// let mut bv = Bitv::new();
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn new() -> Bitv { pub fn new() -> Bitv {
Bitv { storage: Vec::new(), nbits: 0 } Bitv { storage: Vec::new(), nbits: 0 }
} }
@ -289,7 +289,7 @@ impl Bitv {
/// ///
/// It is important to note that this function does not specify the /// It is important to note that this function does not specify the
/// *length* of the returned bitvector, but only the *capacity*. /// *length* of the returned bitvector, but only the *capacity*.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn with_capacity(nbits: uint) -> Bitv { pub fn with_capacity(nbits: uint) -> Bitv {
Bitv { Bitv {
storage: Vec::with_capacity(blocks_for_bits(nbits)), storage: Vec::with_capacity(blocks_for_bits(nbits)),
@ -375,7 +375,7 @@ impl Bitv {
/// assert_eq!(bv[1], true); /// assert_eq!(bv[1], true);
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn get(&self, i: uint) -> Option<bool> { pub fn get(&self, i: uint) -> Option<bool> {
if i >= self.nbits { if i >= self.nbits {
return None; return None;
@ -587,7 +587,7 @@ impl Bitv {
/// assert_eq!(bv.iter().filter(|x| *x).count(), 7); /// assert_eq!(bv.iter().filter(|x| *x).count(), 7);
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn iter(&self) -> Iter { pub fn iter(&self) -> Iter {
Iter { bitv: self, next_idx: 0, end_idx: self.nbits } Iter { bitv: self, next_idx: 0, end_idx: self.nbits }
} }
@ -708,7 +708,7 @@ impl Bitv {
/// bv.truncate(2); /// bv.truncate(2);
/// assert!(bv.eq_vec(&[false, true])); /// assert!(bv.eq_vec(&[false, true]));
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn truncate(&mut self, len: uint) { pub fn truncate(&mut self, len: uint) {
if len < self.len() { if len < self.len() {
self.nbits = len; self.nbits = len;
@ -735,7 +735,7 @@ impl Bitv {
/// assert_eq!(bv.len(), 3); /// assert_eq!(bv.len(), 3);
/// assert!(bv.capacity() >= 13); /// assert!(bv.capacity() >= 13);
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn reserve(&mut self, additional: uint) { pub fn reserve(&mut self, additional: uint) {
let desired_cap = self.len().checked_add(additional).expect("capacity overflow"); let desired_cap = self.len().checked_add(additional).expect("capacity overflow");
let storage_len = self.storage.len(); let storage_len = self.storage.len();
@ -765,7 +765,7 @@ impl Bitv {
/// assert_eq!(bv.len(), 3); /// assert_eq!(bv.len(), 3);
/// assert!(bv.capacity() >= 13); /// assert!(bv.capacity() >= 13);
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn reserve_exact(&mut self, additional: uint) { pub fn reserve_exact(&mut self, additional: uint) {
let desired_cap = self.len().checked_add(additional).expect("capacity overflow"); let desired_cap = self.len().checked_add(additional).expect("capacity overflow");
let storage_len = self.storage.len(); let storage_len = self.storage.len();
@ -787,7 +787,7 @@ impl Bitv {
/// assert!(bv.capacity() >= 10); /// assert!(bv.capacity() >= 10);
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn capacity(&self) -> uint { pub fn capacity(&self) -> uint {
self.storage.capacity().checked_mul(u32::BITS).unwrap_or(uint::MAX) self.storage.capacity().checked_mul(u32::BITS).unwrap_or(uint::MAX)
} }
@ -858,7 +858,7 @@ impl Bitv {
/// assert_eq!(bv.pop(), Some(false)); /// assert_eq!(bv.pop(), Some(false));
/// assert_eq!(bv.len(), 6); /// assert_eq!(bv.len(), 6);
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn pop(&mut self) -> Option<bool> { pub fn pop(&mut self) -> Option<bool> {
if self.is_empty() { if self.is_empty() {
None None
@ -888,7 +888,7 @@ impl Bitv {
/// bv.push(false); /// bv.push(false);
/// assert!(bv.eq_vec(&[true, false])); /// assert!(bv.eq_vec(&[true, false]));
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn push(&mut self, elem: bool) { pub fn push(&mut self, elem: bool) {
if self.nbits % u32::BITS == 0 { if self.nbits % u32::BITS == 0 {
self.storage.push(0); self.storage.push(0);
@ -900,29 +900,29 @@ impl Bitv {
/// Return the total number of bits in this vector /// Return the total number of bits in this vector
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn len(&self) -> uint { self.nbits } pub fn len(&self) -> uint { self.nbits }
/// Returns true if there are no bits in this vector /// Returns true if there are no bits in this vector
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn is_empty(&self) -> bool { self.len() == 0 } pub fn is_empty(&self) -> bool { self.len() == 0 }
/// Clears all bits in this vector. /// Clears all bits in this vector.
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn clear(&mut self) { pub fn clear(&mut self) {
for w in self.storage.iter_mut() { *w = 0u32; } for w in self.storage.iter_mut() { *w = 0u32; }
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl Default for Bitv { impl Default for Bitv {
#[inline] #[inline]
fn default() -> Bitv { Bitv::new() } fn default() -> Bitv { Bitv::new() }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl FromIterator<bool> for Bitv { impl FromIterator<bool> for Bitv {
fn from_iter<I:Iterator<Item=bool>>(iterator: I) -> Bitv { fn from_iter<I:Iterator<Item=bool>>(iterator: I) -> Bitv {
let mut ret = Bitv::new(); let mut ret = Bitv::new();
@ -931,7 +931,7 @@ impl FromIterator<bool> for Bitv {
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl Extend<bool> for Bitv { impl Extend<bool> for Bitv {
#[inline] #[inline]
fn extend<I: Iterator<Item=bool>>(&mut self, mut iterator: I) { fn extend<I: Iterator<Item=bool>>(&mut self, mut iterator: I) {
@ -943,7 +943,7 @@ impl Extend<bool> for Bitv {
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl Clone for Bitv { impl Clone for Bitv {
#[inline] #[inline]
fn clone(&self) -> Bitv { fn clone(&self) -> Bitv {
@ -957,7 +957,7 @@ impl Clone for Bitv {
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl PartialOrd for Bitv { impl PartialOrd for Bitv {
#[inline] #[inline]
fn partial_cmp(&self, other: &Bitv) -> Option<Ordering> { fn partial_cmp(&self, other: &Bitv) -> Option<Ordering> {
@ -965,7 +965,7 @@ impl PartialOrd for Bitv {
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl Ord for Bitv { impl Ord for Bitv {
#[inline] #[inline]
fn cmp(&self, other: &Bitv) -> Ordering { fn cmp(&self, other: &Bitv) -> Ordering {
@ -973,7 +973,7 @@ impl Ord for Bitv {
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl fmt::Show for Bitv { impl fmt::Show for Bitv {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
for bit in self.iter() { for bit in self.iter() {
@ -983,7 +983,7 @@ impl fmt::Show for Bitv {
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<S: hash::Writer + hash::Hasher> hash::Hash<S> for Bitv { impl<S: hash::Writer + hash::Hasher> hash::Hash<S> for Bitv {
fn hash(&self, state: &mut S) { fn hash(&self, state: &mut S) {
self.nbits.hash(state); self.nbits.hash(state);
@ -993,7 +993,7 @@ impl<S: hash::Writer + hash::Hasher> hash::Hash<S> for Bitv {
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl cmp::PartialEq for Bitv { impl cmp::PartialEq for Bitv {
#[inline] #[inline]
fn eq(&self, other: &Bitv) -> bool { fn eq(&self, other: &Bitv) -> bool {
@ -1004,11 +1004,11 @@ impl cmp::PartialEq for Bitv {
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl cmp::Eq for Bitv {} impl cmp::Eq for Bitv {}
/// An iterator for `Bitv`. /// An iterator for `Bitv`.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[derive(Clone)] #[derive(Clone)]
pub struct Iter<'a> { pub struct Iter<'a> {
bitv: &'a Bitv, bitv: &'a Bitv,
@ -1016,7 +1016,7 @@ pub struct Iter<'a> {
end_idx: uint, end_idx: uint,
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a> Iterator for Iter<'a> { impl<'a> Iterator for Iter<'a> {
type Item = bool; type Item = bool;
@ -1037,7 +1037,7 @@ impl<'a> Iterator for Iter<'a> {
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a> DoubleEndedIterator for Iter<'a> { impl<'a> DoubleEndedIterator for Iter<'a> {
#[inline] #[inline]
fn next_back(&mut self) -> Option<bool> { fn next_back(&mut self) -> Option<bool> {
@ -1050,10 +1050,10 @@ impl<'a> DoubleEndedIterator for Iter<'a> {
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a> ExactSizeIterator for Iter<'a> {} impl<'a> ExactSizeIterator for Iter<'a> {}
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a> RandomAccessIterator for Iter<'a> { impl<'a> RandomAccessIterator for Iter<'a> {
#[inline] #[inline]
fn indexable(&self) -> uint { fn indexable(&self) -> uint {
@ -1115,13 +1115,13 @@ pub struct BitvSet {
bitv: Bitv, bitv: Bitv,
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl Default for BitvSet { impl Default for BitvSet {
#[inline] #[inline]
fn default() -> BitvSet { BitvSet::new() } fn default() -> BitvSet { BitvSet::new() }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl FromIterator<uint> for BitvSet { impl FromIterator<uint> for BitvSet {
fn from_iter<I:Iterator<Item=uint>>(iterator: I) -> BitvSet { fn from_iter<I:Iterator<Item=uint>>(iterator: I) -> BitvSet {
let mut ret = BitvSet::new(); let mut ret = BitvSet::new();
@ -1130,7 +1130,7 @@ impl FromIterator<uint> for BitvSet {
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl Extend<uint> for BitvSet { impl Extend<uint> for BitvSet {
#[inline] #[inline]
fn extend<I: Iterator<Item=uint>>(&mut self, mut iterator: I) { fn extend<I: Iterator<Item=uint>>(&mut self, mut iterator: I) {
@ -1140,7 +1140,7 @@ impl Extend<uint> for BitvSet {
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl PartialOrd for BitvSet { impl PartialOrd for BitvSet {
#[inline] #[inline]
fn partial_cmp(&self, other: &BitvSet) -> Option<Ordering> { fn partial_cmp(&self, other: &BitvSet) -> Option<Ordering> {
@ -1149,7 +1149,7 @@ impl PartialOrd for BitvSet {
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl Ord for BitvSet { impl Ord for BitvSet {
#[inline] #[inline]
fn cmp(&self, other: &BitvSet) -> Ordering { fn cmp(&self, other: &BitvSet) -> Ordering {
@ -1158,7 +1158,7 @@ impl Ord for BitvSet {
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl cmp::PartialEq for BitvSet { impl cmp::PartialEq for BitvSet {
#[inline] #[inline]
fn eq(&self, other: &BitvSet) -> bool { fn eq(&self, other: &BitvSet) -> bool {
@ -1167,7 +1167,7 @@ impl cmp::PartialEq for BitvSet {
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl cmp::Eq for BitvSet {} impl cmp::Eq for BitvSet {}
impl BitvSet { impl BitvSet {
@ -1181,7 +1181,7 @@ impl BitvSet {
/// let mut s = BitvSet::new(); /// let mut s = BitvSet::new();
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn new() -> BitvSet { pub fn new() -> BitvSet {
BitvSet { bitv: Bitv::new() } BitvSet { bitv: Bitv::new() }
} }
@ -1198,7 +1198,7 @@ impl BitvSet {
/// assert!(s.capacity() >= 100); /// assert!(s.capacity() >= 100);
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn with_capacity(nbits: uint) -> BitvSet { pub fn with_capacity(nbits: uint) -> BitvSet {
let bitv = Bitv::from_elem(nbits, false); let bitv = Bitv::from_elem(nbits, false);
BitvSet::from_bitv(bitv) BitvSet::from_bitv(bitv)
@ -1236,7 +1236,7 @@ impl BitvSet {
/// assert!(s.capacity() >= 100); /// assert!(s.capacity() >= 100);
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn capacity(&self) -> uint { pub fn capacity(&self) -> uint {
self.bitv.capacity() self.bitv.capacity()
} }
@ -1257,7 +1257,7 @@ impl BitvSet {
/// s.reserve_len(10); /// s.reserve_len(10);
/// assert!(s.capacity() >= 10); /// assert!(s.capacity() >= 10);
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn reserve_len(&mut self, len: uint) { pub fn reserve_len(&mut self, len: uint) {
let cur_len = self.bitv.len(); let cur_len = self.bitv.len();
if len >= cur_len { if len >= cur_len {
@ -1283,7 +1283,7 @@ impl BitvSet {
/// s.reserve_len_exact(10); /// s.reserve_len_exact(10);
/// assert!(s.capacity() >= 10); /// assert!(s.capacity() >= 10);
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn reserve_len_exact(&mut self, len: uint) { pub fn reserve_len_exact(&mut self, len: uint) {
let cur_len = self.bitv.len(); let cur_len = self.bitv.len();
if len >= cur_len { if len >= cur_len {
@ -1377,7 +1377,7 @@ impl BitvSet {
/// println!("new capacity: {}", s.capacity()); /// println!("new capacity: {}", s.capacity());
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn shrink_to_fit(&mut self) { pub fn shrink_to_fit(&mut self) {
let bitv = &mut self.bitv; let bitv = &mut self.bitv;
// Obtain original length // Obtain original length
@ -1405,7 +1405,7 @@ impl BitvSet {
/// } /// }
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn iter(&self) -> bitv_set::Iter { pub fn iter(&self) -> bitv_set::Iter {
SetIter {set: self, next_idx: 0u} SetIter {set: self, next_idx: 0u}
} }
@ -1427,7 +1427,7 @@ impl BitvSet {
/// } /// }
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn union<'a>(&'a self, other: &'a BitvSet) -> Union<'a> { pub fn union<'a>(&'a self, other: &'a BitvSet) -> Union<'a> {
fn or(w1: u32, w2: u32) -> u32 { w1 | w2 } fn or(w1: u32, w2: u32) -> u32 { w1 | w2 }
@ -1457,7 +1457,7 @@ impl BitvSet {
/// } /// }
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn intersection<'a>(&'a self, other: &'a BitvSet) -> Intersection<'a> { pub fn intersection<'a>(&'a self, other: &'a BitvSet) -> Intersection<'a> {
fn bitand(w1: u32, w2: u32) -> u32 { w1 & w2 } fn bitand(w1: u32, w2: u32) -> u32 { w1 & w2 }
let min = cmp::min(self.bitv.len(), other.bitv.len()); let min = cmp::min(self.bitv.len(), other.bitv.len());
@ -1494,7 +1494,7 @@ impl BitvSet {
/// } /// }
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn difference<'a>(&'a self, other: &'a BitvSet) -> Difference<'a> { pub fn difference<'a>(&'a self, other: &'a BitvSet) -> Difference<'a> {
fn diff(w1: u32, w2: u32) -> u32 { w1 & !w2 } fn diff(w1: u32, w2: u32) -> u32 { w1 & !w2 }
@ -1525,7 +1525,7 @@ impl BitvSet {
/// } /// }
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn symmetric_difference<'a>(&'a self, other: &'a BitvSet) -> SymmetricDifference<'a> { pub fn symmetric_difference<'a>(&'a self, other: &'a BitvSet) -> SymmetricDifference<'a> {
fn bitxor(w1: u32, w2: u32) -> u32 { w1 ^ w2 } fn bitxor(w1: u32, w2: u32) -> u32 { w1 ^ w2 }
@ -1642,28 +1642,28 @@ impl BitvSet {
/// Return the number of set bits in this set. /// Return the number of set bits in this set.
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn len(&self) -> uint { pub fn len(&self) -> uint {
self.bitv.blocks().fold(0, |acc, n| acc + n.count_ones()) self.bitv.blocks().fold(0, |acc, n| acc + n.count_ones())
} }
/// Returns whether there are no bits set in this set /// Returns whether there are no bits set in this set
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn is_empty(&self) -> bool { pub fn is_empty(&self) -> bool {
self.bitv.none() self.bitv.none()
} }
/// Clears all bits in this set /// Clears all bits in this set
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn clear(&mut self) { pub fn clear(&mut self) {
self.bitv.clear(); self.bitv.clear();
} }
/// Returns `true` if this set contains the specified integer. /// Returns `true` if this set contains the specified integer.
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn contains(&self, value: &uint) -> bool { pub fn contains(&self, value: &uint) -> bool {
let bitv = &self.bitv; let bitv = &self.bitv;
*value < bitv.nbits && bitv[*value] *value < bitv.nbits && bitv[*value]
@ -1672,14 +1672,14 @@ impl BitvSet {
/// Returns `true` if the set has no elements in common with `other`. /// Returns `true` if the set has no elements in common with `other`.
/// This is equivalent to checking for an empty intersection. /// This is equivalent to checking for an empty intersection.
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn is_disjoint(&self, other: &BitvSet) -> bool { pub fn is_disjoint(&self, other: &BitvSet) -> bool {
self.intersection(other).next().is_none() self.intersection(other).next().is_none()
} }
/// Returns `true` if the set is a subset of another. /// Returns `true` if the set is a subset of another.
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn is_subset(&self, other: &BitvSet) -> bool { pub fn is_subset(&self, other: &BitvSet) -> bool {
let self_bitv = &self.bitv; let self_bitv = &self.bitv;
let other_bitv = &other.bitv; let other_bitv = &other.bitv;
@ -1693,14 +1693,14 @@ impl BitvSet {
/// Returns `true` if the set is a superset of another. /// Returns `true` if the set is a superset of another.
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn is_superset(&self, other: &BitvSet) -> bool { pub fn is_superset(&self, other: &BitvSet) -> bool {
other.is_subset(self) other.is_subset(self)
} }
/// Adds a value to the set. Returns `true` if the value was not already /// Adds a value to the set. Returns `true` if the value was not already
/// present in the set. /// present in the set.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn insert(&mut self, value: uint) -> bool { pub fn insert(&mut self, value: uint) -> bool {
if self.contains(&value) { if self.contains(&value) {
return false; return false;
@ -1718,7 +1718,7 @@ impl BitvSet {
/// Removes a value from the set. Returns `true` if the value was /// Removes a value from the set. Returns `true` if the value was
/// present in the set. /// present in the set.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn remove(&mut self, value: &uint) -> bool { pub fn remove(&mut self, value: &uint) -> bool {
if !self.contains(value) { if !self.contains(value) {
return false; return false;
@ -1755,7 +1755,7 @@ impl<S: hash::Writer + hash::Hasher> hash::Hash<S> for BitvSet {
/// An iterator for `BitvSet`. /// An iterator for `BitvSet`.
#[derive(Clone)] #[derive(Clone)]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub struct SetIter<'a> { pub struct SetIter<'a> {
set: &'a BitvSet, set: &'a BitvSet,
next_idx: uint next_idx: uint
@ -1771,16 +1771,16 @@ struct TwoBitPositions<'a> {
next_idx: uint next_idx: uint
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub struct Union<'a>(TwoBitPositions<'a>); pub struct Union<'a>(TwoBitPositions<'a>);
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub struct Intersection<'a>(Take<TwoBitPositions<'a>>); pub struct Intersection<'a>(Take<TwoBitPositions<'a>>);
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub struct Difference<'a>(TwoBitPositions<'a>); pub struct Difference<'a>(TwoBitPositions<'a>);
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub struct SymmetricDifference<'a>(TwoBitPositions<'a>); pub struct SymmetricDifference<'a>(TwoBitPositions<'a>);
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a> Iterator for SetIter<'a> { impl<'a> Iterator for SetIter<'a> {
type Item = uint; type Item = uint;
@ -1803,7 +1803,7 @@ impl<'a> Iterator for SetIter<'a> {
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a> Iterator for TwoBitPositions<'a> { impl<'a> Iterator for TwoBitPositions<'a> {
type Item = uint; type Item = uint;
@ -1841,7 +1841,7 @@ impl<'a> Iterator for TwoBitPositions<'a> {
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a> Iterator for Union<'a> { impl<'a> Iterator for Union<'a> {
type Item = uint; type Item = uint;
@ -1849,7 +1849,7 @@ impl<'a> Iterator for Union<'a> {
#[inline] fn size_hint(&self) -> (uint, Option<uint>) { self.0.size_hint() } #[inline] fn size_hint(&self) -> (uint, Option<uint>) { self.0.size_hint() }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a> Iterator for Intersection<'a> { impl<'a> Iterator for Intersection<'a> {
type Item = uint; type Item = uint;
@ -1857,7 +1857,7 @@ impl<'a> Iterator for Intersection<'a> {
#[inline] fn size_hint(&self) -> (uint, Option<uint>) { self.0.size_hint() } #[inline] fn size_hint(&self) -> (uint, Option<uint>) { self.0.size_hint() }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a> Iterator for Difference<'a> { impl<'a> Iterator for Difference<'a> {
type Item = uint; type Item = uint;
@ -1865,7 +1865,7 @@ impl<'a> Iterator for Difference<'a> {
#[inline] fn size_hint(&self) -> (uint, Option<uint>) { self.0.size_hint() } #[inline] fn size_hint(&self) -> (uint, Option<uint>) { self.0.size_hint() }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a> Iterator for SymmetricDifference<'a> { impl<'a> Iterator for SymmetricDifference<'a> {
type Item = uint; type Item = uint;

View File

@ -81,7 +81,7 @@ use super::node::{self, Node, Found, GoDown};
/// done on each operation isn't *catastrophic*, and *is* still bounded by O(B log<sub>B</sub>n), /// done on each operation isn't *catastrophic*, and *is* still bounded by O(B log<sub>B</sub>n),
/// it is certainly much slower when it does. /// it is certainly much slower when it does.
#[derive(Clone)] #[derive(Clone)]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub struct BTreeMap<K, V> { pub struct BTreeMap<K, V> {
root: Node<K, V>, root: Node<K, V>,
length: uint, length: uint,
@ -96,31 +96,31 @@ struct AbsIter<T> {
} }
/// An iterator over a BTreeMap's entries. /// An iterator over a BTreeMap's entries.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub struct Iter<'a, K: 'a, V: 'a> { pub struct Iter<'a, K: 'a, V: 'a> {
inner: AbsIter<Traversal<'a, K, V>> inner: AbsIter<Traversal<'a, K, V>>
} }
/// A mutable iterator over a BTreeMap's entries. /// A mutable iterator over a BTreeMap's entries.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub struct IterMut<'a, K: 'a, V: 'a> { pub struct IterMut<'a, K: 'a, V: 'a> {
inner: AbsIter<MutTraversal<'a, K, V>> inner: AbsIter<MutTraversal<'a, K, V>>
} }
/// An owning iterator over a BTreeMap's entries. /// An owning iterator over a BTreeMap's entries.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub struct IntoIter<K, V> { pub struct IntoIter<K, V> {
inner: AbsIter<MoveTraversal<K, V>> inner: AbsIter<MoveTraversal<K, V>>
} }
/// An iterator over a BTreeMap's keys. /// An iterator over a BTreeMap's keys.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub struct Keys<'a, K: 'a, V: 'a> { pub struct Keys<'a, K: 'a, V: 'a> {
inner: Map<(&'a K, &'a V), &'a K, Iter<'a, K, V>, fn((&'a K, &'a V)) -> &'a K> inner: Map<(&'a K, &'a V), &'a K, Iter<'a, K, V>, fn((&'a K, &'a V)) -> &'a K>
} }
/// An iterator over a BTreeMap's values. /// An iterator over a BTreeMap's values.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub struct Values<'a, K: 'a, V: 'a> { pub struct Values<'a, K: 'a, V: 'a> {
inner: Map<(&'a K, &'a V), &'a V, Iter<'a, K, V>, fn((&'a K, &'a V)) -> &'a V> inner: Map<(&'a K, &'a V), &'a V, Iter<'a, K, V>, fn((&'a K, &'a V)) -> &'a V>
} }
@ -162,7 +162,7 @@ pub struct OccupiedEntry<'a, K:'a, V:'a> {
impl<K: Ord, V> BTreeMap<K, V> { impl<K: Ord, V> BTreeMap<K, V> {
/// Makes a new empty BTreeMap with a reasonable choice for B. /// Makes a new empty BTreeMap with a reasonable choice for B.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn new() -> BTreeMap<K, V> { pub fn new() -> BTreeMap<K, V> {
//FIXME(Gankro): Tune this as a function of size_of<K/V>? //FIXME(Gankro): Tune this as a function of size_of<K/V>?
BTreeMap::with_b(6) BTreeMap::with_b(6)
@ -193,7 +193,7 @@ impl<K: Ord, V> BTreeMap<K, V> {
/// a.clear(); /// a.clear();
/// assert!(a.is_empty()); /// assert!(a.is_empty());
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn clear(&mut self) { pub fn clear(&mut self) {
let b = self.b; let b = self.b;
// avoid recursive destructors by manually traversing the tree // avoid recursive destructors by manually traversing the tree
@ -223,7 +223,7 @@ impl<K: Ord, V> BTreeMap<K, V> {
/// assert_eq!(map.get(&1), Some(&"a")); /// assert_eq!(map.get(&1), Some(&"a"));
/// assert_eq!(map.get(&2), None); /// assert_eq!(map.get(&2), None);
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn get<Q: ?Sized>(&self, key: &Q) -> Option<&V> where Q: BorrowFrom<K> + Ord { pub fn get<Q: ?Sized>(&self, key: &Q) -> Option<&V> where Q: BorrowFrom<K> + Ord {
let mut cur_node = &self.root; let mut cur_node = &self.root;
loop { loop {
@ -255,7 +255,7 @@ impl<K: Ord, V> BTreeMap<K, V> {
/// assert_eq!(map.contains_key(&1), true); /// assert_eq!(map.contains_key(&1), true);
/// assert_eq!(map.contains_key(&2), false); /// assert_eq!(map.contains_key(&2), false);
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn contains_key<Q: ?Sized>(&self, key: &Q) -> bool where Q: BorrowFrom<K> + Ord { pub fn contains_key<Q: ?Sized>(&self, key: &Q) -> bool where Q: BorrowFrom<K> + Ord {
self.get(key).is_some() self.get(key).is_some()
} }
@ -279,7 +279,7 @@ impl<K: Ord, V> BTreeMap<K, V> {
/// assert_eq!(map[1], "b"); /// assert_eq!(map[1], "b");
/// ``` /// ```
// See `get` for implementation notes, this is basically a copy-paste with mut's added // See `get` for implementation notes, this is basically a copy-paste with mut's added
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn get_mut<Q: ?Sized>(&mut self, key: &Q) -> Option<&mut V> where Q: BorrowFrom<K> + Ord { pub fn get_mut<Q: ?Sized>(&mut self, key: &Q) -> Option<&mut V> where Q: BorrowFrom<K> + Ord {
// temp_node is a Borrowck hack for having a mutable value outlive a loop iteration // temp_node is a Borrowck hack for having a mutable value outlive a loop iteration
let mut temp_node = &mut self.root; let mut temp_node = &mut self.root;
@ -340,7 +340,7 @@ impl<K: Ord, V> BTreeMap<K, V> {
/// assert_eq!(map.insert(37, "c"), Some("b")); /// assert_eq!(map.insert(37, "c"), Some("b"));
/// assert_eq!(map[37], "c"); /// assert_eq!(map[37], "c");
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn insert(&mut self, mut key: K, mut value: V) -> Option<V> { pub fn insert(&mut self, mut key: K, mut value: V) -> Option<V> {
// This is a stack of rawptrs to nodes paired with indices, respectively // This is a stack of rawptrs to nodes paired with indices, respectively
// representing the nodes and edges of our search path. We have to store rawptrs // representing the nodes and edges of our search path. We have to store rawptrs
@ -449,7 +449,7 @@ impl<K: Ord, V> BTreeMap<K, V> {
/// assert_eq!(map.remove(&1), Some("a")); /// assert_eq!(map.remove(&1), Some("a"));
/// assert_eq!(map.remove(&1), None); /// assert_eq!(map.remove(&1), None);
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn remove<Q: ?Sized>(&mut self, key: &Q) -> Option<V> where Q: BorrowFrom<K> + Ord { pub fn remove<Q: ?Sized>(&mut self, key: &Q) -> Option<V> where Q: BorrowFrom<K> + Ord {
// See `swap` for a more thorough description of the stuff going on in here // See `swap` for a more thorough description of the stuff going on in here
let mut stack = stack::PartialSearchStack::new(self); let mut stack = stack::PartialSearchStack::new(self);
@ -810,7 +810,7 @@ mod stack {
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<K: Ord, V> FromIterator<(K, V)> for BTreeMap<K, V> { impl<K: Ord, V> FromIterator<(K, V)> for BTreeMap<K, V> {
fn from_iter<T: Iterator<Item=(K, V)>>(iter: T) -> BTreeMap<K, V> { fn from_iter<T: Iterator<Item=(K, V)>>(iter: T) -> BTreeMap<K, V> {
let mut map = BTreeMap::new(); let mut map = BTreeMap::new();
@ -819,7 +819,7 @@ impl<K: Ord, V> FromIterator<(K, V)> for BTreeMap<K, V> {
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<K: Ord, V> Extend<(K, V)> for BTreeMap<K, V> { impl<K: Ord, V> Extend<(K, V)> for BTreeMap<K, V> {
#[inline] #[inline]
fn extend<T: Iterator<Item=(K, V)>>(&mut self, mut iter: T) { fn extend<T: Iterator<Item=(K, V)>>(&mut self, mut iter: T) {
@ -829,7 +829,7 @@ impl<K: Ord, V> Extend<(K, V)> for BTreeMap<K, V> {
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<S: Hasher, K: Hash<S>, V: Hash<S>> Hash<S> for BTreeMap<K, V> { impl<S: Hasher, K: Hash<S>, V: Hash<S>> Hash<S> for BTreeMap<K, V> {
fn hash(&self, state: &mut S) { fn hash(&self, state: &mut S) {
for elt in self.iter() { for elt in self.iter() {
@ -838,15 +838,15 @@ impl<S: Hasher, K: Hash<S>, V: Hash<S>> Hash<S> for BTreeMap<K, V> {
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<K: Ord, V> Default for BTreeMap<K, V> { impl<K: Ord, V> Default for BTreeMap<K, V> {
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn default() -> BTreeMap<K, V> { fn default() -> BTreeMap<K, V> {
BTreeMap::new() BTreeMap::new()
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<K: PartialEq, V: PartialEq> PartialEq for BTreeMap<K, V> { impl<K: PartialEq, V: PartialEq> PartialEq for BTreeMap<K, V> {
fn eq(&self, other: &BTreeMap<K, V>) -> bool { fn eq(&self, other: &BTreeMap<K, V>) -> bool {
self.len() == other.len() && self.len() == other.len() &&
@ -854,10 +854,10 @@ impl<K: PartialEq, V: PartialEq> PartialEq for BTreeMap<K, V> {
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<K: Eq, V: Eq> Eq for BTreeMap<K, V> {} impl<K: Eq, V: Eq> Eq for BTreeMap<K, V> {}
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<K: PartialOrd, V: PartialOrd> PartialOrd for BTreeMap<K, V> { impl<K: PartialOrd, V: PartialOrd> PartialOrd for BTreeMap<K, V> {
#[inline] #[inline]
fn partial_cmp(&self, other: &BTreeMap<K, V>) -> Option<Ordering> { fn partial_cmp(&self, other: &BTreeMap<K, V>) -> Option<Ordering> {
@ -865,7 +865,7 @@ impl<K: PartialOrd, V: PartialOrd> PartialOrd for BTreeMap<K, V> {
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<K: Ord, V: Ord> Ord for BTreeMap<K, V> { impl<K: Ord, V: Ord> Ord for BTreeMap<K, V> {
#[inline] #[inline]
fn cmp(&self, other: &BTreeMap<K, V>) -> Ordering { fn cmp(&self, other: &BTreeMap<K, V>) -> Ordering {
@ -873,7 +873,7 @@ impl<K: Ord, V: Ord> Ord for BTreeMap<K, V> {
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<K: Show, V: Show> Show for BTreeMap<K, V> { impl<K: Show, V: Show> Show for BTreeMap<K, V> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
try!(write!(f, "BTreeMap {{")); try!(write!(f, "BTreeMap {{"));
@ -887,7 +887,7 @@ impl<K: Show, V: Show> Show for BTreeMap<K, V> {
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<K: Ord, Q: ?Sized, V> Index<Q> for BTreeMap<K, V> impl<K: Ord, Q: ?Sized, V> Index<Q> for BTreeMap<K, V>
where Q: BorrowFrom<K> + Ord where Q: BorrowFrom<K> + Ord
{ {
@ -898,7 +898,7 @@ impl<K: Ord, Q: ?Sized, V> Index<Q> for BTreeMap<K, V>
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<K: Ord, Q: ?Sized, V> IndexMut<Q> for BTreeMap<K, V> impl<K: Ord, Q: ?Sized, V> IndexMut<Q> for BTreeMap<K, V>
where Q: BorrowFrom<K> + Ord where Q: BorrowFrom<K> + Ord
{ {
@ -1009,75 +1009,75 @@ impl<K, V, E, T> DoubleEndedIterator for AbsIter<T> where
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a, K, V> Iterator for Iter<'a, K, V> { impl<'a, K, V> Iterator for Iter<'a, K, V> {
type Item = (&'a K, &'a V); type Item = (&'a K, &'a V);
fn next(&mut self) -> Option<(&'a K, &'a V)> { self.inner.next() } fn next(&mut self) -> Option<(&'a K, &'a V)> { self.inner.next() }
fn size_hint(&self) -> (uint, Option<uint>) { self.inner.size_hint() } fn size_hint(&self) -> (uint, Option<uint>) { self.inner.size_hint() }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a, K, V> DoubleEndedIterator for Iter<'a, K, V> { impl<'a, K, V> DoubleEndedIterator for Iter<'a, K, V> {
fn next_back(&mut self) -> Option<(&'a K, &'a V)> { self.inner.next_back() } fn next_back(&mut self) -> Option<(&'a K, &'a V)> { self.inner.next_back() }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a, K, V> ExactSizeIterator for Iter<'a, K, V> {} impl<'a, K, V> ExactSizeIterator for Iter<'a, K, V> {}
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a, K, V> Iterator for IterMut<'a, K, V> { impl<'a, K, V> Iterator for IterMut<'a, K, V> {
type Item = (&'a K, &'a mut V); type Item = (&'a K, &'a mut V);
fn next(&mut self) -> Option<(&'a K, &'a mut V)> { self.inner.next() } fn next(&mut self) -> Option<(&'a K, &'a mut V)> { self.inner.next() }
fn size_hint(&self) -> (uint, Option<uint>) { self.inner.size_hint() } fn size_hint(&self) -> (uint, Option<uint>) { self.inner.size_hint() }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a, K, V> DoubleEndedIterator for IterMut<'a, K, V> { impl<'a, K, V> DoubleEndedIterator for IterMut<'a, K, V> {
fn next_back(&mut self) -> Option<(&'a K, &'a mut V)> { self.inner.next_back() } fn next_back(&mut self) -> Option<(&'a K, &'a mut V)> { self.inner.next_back() }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a, K, V> ExactSizeIterator for IterMut<'a, K, V> {} impl<'a, K, V> ExactSizeIterator for IterMut<'a, K, V> {}
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<K, V> Iterator for IntoIter<K, V> { impl<K, V> Iterator for IntoIter<K, V> {
type Item = (K, V); type Item = (K, V);
fn next(&mut self) -> Option<(K, V)> { self.inner.next() } fn next(&mut self) -> Option<(K, V)> { self.inner.next() }
fn size_hint(&self) -> (uint, Option<uint>) { self.inner.size_hint() } fn size_hint(&self) -> (uint, Option<uint>) { self.inner.size_hint() }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<K, V> DoubleEndedIterator for IntoIter<K, V> { impl<K, V> DoubleEndedIterator for IntoIter<K, V> {
fn next_back(&mut self) -> Option<(K, V)> { self.inner.next_back() } fn next_back(&mut self) -> Option<(K, V)> { self.inner.next_back() }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<K, V> ExactSizeIterator for IntoIter<K, V> {} impl<K, V> ExactSizeIterator for IntoIter<K, V> {}
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a, K, V> Iterator for Keys<'a, K, V> { impl<'a, K, V> Iterator for Keys<'a, K, V> {
type Item = &'a K; type Item = &'a K;
fn next(&mut self) -> Option<(&'a K)> { self.inner.next() } fn next(&mut self) -> Option<(&'a K)> { self.inner.next() }
fn size_hint(&self) -> (uint, Option<uint>) { self.inner.size_hint() } fn size_hint(&self) -> (uint, Option<uint>) { self.inner.size_hint() }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a, K, V> DoubleEndedIterator for Keys<'a, K, V> { impl<'a, K, V> DoubleEndedIterator for Keys<'a, K, V> {
fn next_back(&mut self) -> Option<(&'a K)> { self.inner.next_back() } fn next_back(&mut self) -> Option<(&'a K)> { self.inner.next_back() }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a, K, V> ExactSizeIterator for Keys<'a, K, V> {} impl<'a, K, V> ExactSizeIterator for Keys<'a, K, V> {}
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a, K, V> Iterator for Values<'a, K, V> { impl<'a, K, V> Iterator for Values<'a, K, V> {
type Item = &'a V; type Item = &'a V;
fn next(&mut self) -> Option<(&'a V)> { self.inner.next() } fn next(&mut self) -> Option<(&'a V)> { self.inner.next() }
fn size_hint(&self) -> (uint, Option<uint>) { self.inner.size_hint() } fn size_hint(&self) -> (uint, Option<uint>) { self.inner.size_hint() }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a, K, V> DoubleEndedIterator for Values<'a, K, V> { impl<'a, K, V> DoubleEndedIterator for Values<'a, K, V> {
fn next_back(&mut self) -> Option<(&'a V)> { self.inner.next_back() } fn next_back(&mut self) -> Option<(&'a V)> { self.inner.next_back() }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a, K, V> ExactSizeIterator for Values<'a, K, V> {} impl<'a, K, V> ExactSizeIterator for Values<'a, K, V> {}
impl<'a, K, V> Iterator for Range<'a, K, V> { impl<'a, K, V> Iterator for Range<'a, K, V> {
@ -1179,7 +1179,7 @@ impl<K, V> BTreeMap<K, V> {
/// let (first_key, first_value) = map.iter().next().unwrap(); /// let (first_key, first_value) = map.iter().next().unwrap();
/// assert_eq!((*first_key, *first_value), (1u, "a")); /// assert_eq!((*first_key, *first_value), (1u, "a"));
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn iter(&self) -> Iter<K, V> { pub fn iter(&self) -> Iter<K, V> {
let len = self.len(); let len = self.len();
// NB. The initial capacity for ringbuf is large enough to avoid reallocs in many cases. // NB. The initial capacity for ringbuf is large enough to avoid reallocs in many cases.
@ -1212,7 +1212,7 @@ impl<K, V> BTreeMap<K, V> {
/// } /// }
/// } /// }
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn iter_mut(&mut self) -> IterMut<K, V> { pub fn iter_mut(&mut self) -> IterMut<K, V> {
let len = self.len(); let len = self.len();
let mut lca = RingBuf::new(); let mut lca = RingBuf::new();
@ -1241,7 +1241,7 @@ impl<K, V> BTreeMap<K, V> {
/// println!("{}: {}", key, value); /// println!("{}: {}", key, value);
/// } /// }
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn into_iter(self) -> IntoIter<K, V> { pub fn into_iter(self) -> IntoIter<K, V> {
let len = self.len(); let len = self.len();
let mut lca = RingBuf::new(); let mut lca = RingBuf::new();
@ -1268,7 +1268,7 @@ impl<K, V> BTreeMap<K, V> {
/// let keys: Vec<uint> = a.keys().cloned().collect(); /// let keys: Vec<uint> = a.keys().cloned().collect();
/// assert_eq!(keys, vec![1u,2,]); /// assert_eq!(keys, vec![1u,2,]);
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn keys<'a>(&'a self) -> Keys<'a, K, V> { pub fn keys<'a>(&'a self) -> Keys<'a, K, V> {
fn first<A, B>((a, _): (A, B)) -> A { a } fn first<A, B>((a, _): (A, B)) -> A { a }
let first: fn((&'a K, &'a V)) -> &'a K = first; // coerce to fn pointer let first: fn((&'a K, &'a V)) -> &'a K = first; // coerce to fn pointer
@ -1290,7 +1290,7 @@ impl<K, V> BTreeMap<K, V> {
/// let values: Vec<&str> = a.values().cloned().collect(); /// let values: Vec<&str> = a.values().cloned().collect();
/// assert_eq!(values, vec!["a","b"]); /// assert_eq!(values, vec!["a","b"]);
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn values<'a>(&'a self) -> Values<'a, K, V> { pub fn values<'a>(&'a self) -> Values<'a, K, V> {
fn second<A, B>((_, b): (A, B)) -> B { b } fn second<A, B>((_, b): (A, B)) -> B { b }
let second: fn((&'a K, &'a V)) -> &'a V = second; // coerce to fn pointer let second: fn((&'a K, &'a V)) -> &'a V = second; // coerce to fn pointer
@ -1310,7 +1310,7 @@ impl<K, V> BTreeMap<K, V> {
/// a.insert(1u, "a"); /// a.insert(1u, "a");
/// assert_eq!(a.len(), 1); /// assert_eq!(a.len(), 1);
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn len(&self) -> uint { self.length } pub fn len(&self) -> uint { self.length }
/// Return true if the map contains no elements. /// Return true if the map contains no elements.
@ -1325,7 +1325,7 @@ impl<K, V> BTreeMap<K, V> {
/// a.insert(1u, "a"); /// a.insert(1u, "a");
/// assert!(!a.is_empty()); /// assert!(!a.is_empty());
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn is_empty(&self) -> bool { self.len() == 0 } pub fn is_empty(&self) -> bool { self.len() == 0 }
} }

View File

@ -420,7 +420,7 @@ impl<K, V> Node<K, V> {
} }
// FIXME(gereeter) Write an efficient clone_from // FIXME(gereeter) Write an efficient clone_from
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<K: Clone, V: Clone> Clone for Node<K, V> { impl<K: Clone, V: Clone> Clone for Node<K, V> {
fn clone(&self) -> Node<K, V> { fn clone(&self) -> Node<K, V> {
let mut ret = if self.is_leaf() { let mut ret = if self.is_leaf() {

View File

@ -34,19 +34,19 @@ use Bound;
/// See BTreeMap's documentation for a detailed discussion of this collection's performance /// See BTreeMap's documentation for a detailed discussion of this collection's performance
/// benefits and drawbacks. /// benefits and drawbacks.
#[derive(Clone, Hash, PartialEq, Eq, Ord, PartialOrd)] #[derive(Clone, Hash, PartialEq, Eq, Ord, PartialOrd)]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub struct BTreeSet<T>{ pub struct BTreeSet<T>{
map: BTreeMap<T, ()>, map: BTreeMap<T, ()>,
} }
/// An iterator over a BTreeSet's items. /// An iterator over a BTreeSet's items.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub struct Iter<'a, T: 'a> { pub struct Iter<'a, T: 'a> {
iter: Keys<'a, T, ()> iter: Keys<'a, T, ()>
} }
/// An owning iterator over a BTreeSet's items. /// An owning iterator over a BTreeSet's items.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub struct IntoIter<T> { pub struct IntoIter<T> {
iter: Map<(T, ()), T, ::btree_map::IntoIter<T, ()>, fn((T, ())) -> T> iter: Map<(T, ()), T, ::btree_map::IntoIter<T, ()>, fn((T, ())) -> T>
} }
@ -57,28 +57,28 @@ pub struct Range<'a, T: 'a> {
} }
/// A lazy iterator producing elements in the set difference (in-order). /// A lazy iterator producing elements in the set difference (in-order).
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub struct Difference<'a, T:'a> { pub struct Difference<'a, T:'a> {
a: Peekable<&'a T, Iter<'a, T>>, a: Peekable<&'a T, Iter<'a, T>>,
b: Peekable<&'a T, Iter<'a, T>>, b: Peekable<&'a T, Iter<'a, T>>,
} }
/// A lazy iterator producing elements in the set symmetric difference (in-order). /// A lazy iterator producing elements in the set symmetric difference (in-order).
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub struct SymmetricDifference<'a, T:'a> { pub struct SymmetricDifference<'a, T:'a> {
a: Peekable<&'a T, Iter<'a, T>>, a: Peekable<&'a T, Iter<'a, T>>,
b: Peekable<&'a T, Iter<'a, T>>, b: Peekable<&'a T, Iter<'a, T>>,
} }
/// A lazy iterator producing elements in the set intersection (in-order). /// A lazy iterator producing elements in the set intersection (in-order).
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub struct Intersection<'a, T:'a> { pub struct Intersection<'a, T:'a> {
a: Peekable<&'a T, Iter<'a, T>>, a: Peekable<&'a T, Iter<'a, T>>,
b: Peekable<&'a T, Iter<'a, T>>, b: Peekable<&'a T, Iter<'a, T>>,
} }
/// A lazy iterator producing elements in the set union (in-order). /// A lazy iterator producing elements in the set union (in-order).
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub struct Union<'a, T:'a> { pub struct Union<'a, T:'a> {
a: Peekable<&'a T, Iter<'a, T>>, a: Peekable<&'a T, Iter<'a, T>>,
b: Peekable<&'a T, Iter<'a, T>>, b: Peekable<&'a T, Iter<'a, T>>,
@ -94,7 +94,7 @@ impl<T: Ord> BTreeSet<T> {
/// ///
/// let mut set: BTreeSet<int> = BTreeSet::new(); /// let mut set: BTreeSet<int> = BTreeSet::new();
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn new() -> BTreeSet<T> { pub fn new() -> BTreeSet<T> {
BTreeSet { map: BTreeMap::new() } BTreeSet { map: BTreeMap::new() }
} }
@ -126,7 +126,7 @@ impl<T> BTreeSet<T> {
/// let v: Vec<uint> = set.iter().map(|&x| x).collect(); /// let v: Vec<uint> = set.iter().map(|&x| x).collect();
/// assert_eq!(v, vec![1u,2,3,4]); /// assert_eq!(v, vec![1u,2,3,4]);
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn iter(&self) -> Iter<T> { pub fn iter(&self) -> Iter<T> {
Iter { iter: self.map.keys() } Iter { iter: self.map.keys() }
} }
@ -143,7 +143,7 @@ impl<T> BTreeSet<T> {
/// let v: Vec<uint> = set.into_iter().collect(); /// let v: Vec<uint> = set.into_iter().collect();
/// assert_eq!(v, vec![1u,2,3,4]); /// assert_eq!(v, vec![1u,2,3,4]);
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn into_iter(self) -> IntoIter<T> { pub fn into_iter(self) -> IntoIter<T> {
fn first<A, B>((a, _): (A, B)) -> A { a } fn first<A, B>((a, _): (A, B)) -> A { a }
let first: fn((T, ())) -> T = first; // coerce to fn pointer let first: fn((T, ())) -> T = first; // coerce to fn pointer
@ -202,7 +202,7 @@ impl<T: Ord> BTreeSet<T> {
/// let diff: Vec<uint> = a.difference(&b).cloned().collect(); /// let diff: Vec<uint> = a.difference(&b).cloned().collect();
/// assert_eq!(diff, vec![1u]); /// assert_eq!(diff, vec![1u]);
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn difference<'a>(&'a self, other: &'a BTreeSet<T>) -> Difference<'a, T> { pub fn difference<'a>(&'a self, other: &'a BTreeSet<T>) -> Difference<'a, T> {
Difference{a: self.iter().peekable(), b: other.iter().peekable()} Difference{a: self.iter().peekable(), b: other.iter().peekable()}
} }
@ -225,7 +225,7 @@ impl<T: Ord> BTreeSet<T> {
/// let sym_diff: Vec<uint> = a.symmetric_difference(&b).cloned().collect(); /// let sym_diff: Vec<uint> = a.symmetric_difference(&b).cloned().collect();
/// assert_eq!(sym_diff, vec![1u,3]); /// assert_eq!(sym_diff, vec![1u,3]);
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn symmetric_difference<'a>(&'a self, other: &'a BTreeSet<T>) pub fn symmetric_difference<'a>(&'a self, other: &'a BTreeSet<T>)
-> SymmetricDifference<'a, T> { -> SymmetricDifference<'a, T> {
SymmetricDifference{a: self.iter().peekable(), b: other.iter().peekable()} SymmetricDifference{a: self.iter().peekable(), b: other.iter().peekable()}
@ -249,7 +249,7 @@ impl<T: Ord> BTreeSet<T> {
/// let intersection: Vec<uint> = a.intersection(&b).cloned().collect(); /// let intersection: Vec<uint> = a.intersection(&b).cloned().collect();
/// assert_eq!(intersection, vec![2u]); /// assert_eq!(intersection, vec![2u]);
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn intersection<'a>(&'a self, other: &'a BTreeSet<T>) pub fn intersection<'a>(&'a self, other: &'a BTreeSet<T>)
-> Intersection<'a, T> { -> Intersection<'a, T> {
Intersection{a: self.iter().peekable(), b: other.iter().peekable()} Intersection{a: self.iter().peekable(), b: other.iter().peekable()}
@ -271,7 +271,7 @@ impl<T: Ord> BTreeSet<T> {
/// let union: Vec<uint> = a.union(&b).cloned().collect(); /// let union: Vec<uint> = a.union(&b).cloned().collect();
/// assert_eq!(union, vec![1u,2]); /// assert_eq!(union, vec![1u,2]);
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn union<'a>(&'a self, other: &'a BTreeSet<T>) -> Union<'a, T> { pub fn union<'a>(&'a self, other: &'a BTreeSet<T>) -> Union<'a, T> {
Union{a: self.iter().peekable(), b: other.iter().peekable()} Union{a: self.iter().peekable(), b: other.iter().peekable()}
} }
@ -288,7 +288,7 @@ impl<T: Ord> BTreeSet<T> {
/// v.insert(1i); /// v.insert(1i);
/// assert_eq!(v.len(), 1); /// assert_eq!(v.len(), 1);
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn len(&self) -> uint { self.map.len() } pub fn len(&self) -> uint { self.map.len() }
/// Returns true if the set contains no elements /// Returns true if the set contains no elements
@ -303,7 +303,7 @@ impl<T: Ord> BTreeSet<T> {
/// v.insert(1i); /// v.insert(1i);
/// assert!(!v.is_empty()); /// assert!(!v.is_empty());
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn is_empty(&self) -> bool { self.len() == 0 } pub fn is_empty(&self) -> bool { self.len() == 0 }
/// Clears the set, removing all values. /// Clears the set, removing all values.
@ -318,7 +318,7 @@ impl<T: Ord> BTreeSet<T> {
/// v.clear(); /// v.clear();
/// assert!(v.is_empty()); /// assert!(v.is_empty());
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn clear(&mut self) { pub fn clear(&mut self) {
self.map.clear() self.map.clear()
} }
@ -338,7 +338,7 @@ impl<T: Ord> BTreeSet<T> {
/// assert_eq!(set.contains(&1), true); /// assert_eq!(set.contains(&1), true);
/// assert_eq!(set.contains(&4), false); /// assert_eq!(set.contains(&4), false);
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn contains<Q: ?Sized>(&self, value: &Q) -> bool where Q: BorrowFrom<T> + Ord { pub fn contains<Q: ?Sized>(&self, value: &Q) -> bool where Q: BorrowFrom<T> + Ord {
self.map.contains_key(value) self.map.contains_key(value)
} }
@ -360,7 +360,7 @@ impl<T: Ord> BTreeSet<T> {
/// b.insert(1); /// b.insert(1);
/// assert_eq!(a.is_disjoint(&b), false); /// assert_eq!(a.is_disjoint(&b), false);
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn is_disjoint(&self, other: &BTreeSet<T>) -> bool { pub fn is_disjoint(&self, other: &BTreeSet<T>) -> bool {
self.intersection(other).next().is_none() self.intersection(other).next().is_none()
} }
@ -381,7 +381,7 @@ impl<T: Ord> BTreeSet<T> {
/// set.insert(4); /// set.insert(4);
/// assert_eq!(set.is_subset(&sup), false); /// assert_eq!(set.is_subset(&sup), false);
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn is_subset(&self, other: &BTreeSet<T>) -> bool { pub fn is_subset(&self, other: &BTreeSet<T>) -> bool {
// Stolen from TreeMap // Stolen from TreeMap
let mut x = self.iter(); let mut x = self.iter();
@ -426,7 +426,7 @@ impl<T: Ord> BTreeSet<T> {
/// set.insert(2); /// set.insert(2);
/// assert_eq!(set.is_superset(&sub), true); /// assert_eq!(set.is_superset(&sub), true);
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn is_superset(&self, other: &BTreeSet<T>) -> bool { pub fn is_superset(&self, other: &BTreeSet<T>) -> bool {
other.is_subset(self) other.is_subset(self)
} }
@ -445,7 +445,7 @@ impl<T: Ord> BTreeSet<T> {
/// assert_eq!(set.insert(2i), false); /// assert_eq!(set.insert(2i), false);
/// assert_eq!(set.len(), 1); /// assert_eq!(set.len(), 1);
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn insert(&mut self, value: T) -> bool { pub fn insert(&mut self, value: T) -> bool {
self.map.insert(value, ()).is_none() self.map.insert(value, ()).is_none()
} }
@ -468,13 +468,13 @@ impl<T: Ord> BTreeSet<T> {
/// assert_eq!(set.remove(&2), true); /// assert_eq!(set.remove(&2), true);
/// assert_eq!(set.remove(&2), false); /// assert_eq!(set.remove(&2), false);
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn remove<Q: ?Sized>(&mut self, value: &Q) -> bool where Q: BorrowFrom<T> + Ord { pub fn remove<Q: ?Sized>(&mut self, value: &Q) -> bool where Q: BorrowFrom<T> + Ord {
self.map.remove(value).is_some() self.map.remove(value).is_some()
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<T: Ord> FromIterator<T> for BTreeSet<T> { impl<T: Ord> FromIterator<T> for BTreeSet<T> {
fn from_iter<Iter: Iterator<Item=T>>(iter: Iter) -> BTreeSet<T> { fn from_iter<Iter: Iterator<Item=T>>(iter: Iter) -> BTreeSet<T> {
let mut set = BTreeSet::new(); let mut set = BTreeSet::new();
@ -483,7 +483,7 @@ impl<T: Ord> FromIterator<T> for BTreeSet<T> {
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<T: Ord> Extend<T> for BTreeSet<T> { impl<T: Ord> Extend<T> for BTreeSet<T> {
#[inline] #[inline]
fn extend<Iter: Iterator<Item=T>>(&mut self, mut iter: Iter) { fn extend<Iter: Iterator<Item=T>>(&mut self, mut iter: Iter) {
@ -493,15 +493,15 @@ impl<T: Ord> Extend<T> for BTreeSet<T> {
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<T: Ord> Default for BTreeSet<T> { impl<T: Ord> Default for BTreeSet<T> {
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn default() -> BTreeSet<T> { fn default() -> BTreeSet<T> {
BTreeSet::new() BTreeSet::new()
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a, 'b, T: Ord + Clone> Sub<&'b BTreeSet<T>> for &'a BTreeSet<T> { impl<'a, 'b, T: Ord + Clone> Sub<&'b BTreeSet<T>> for &'a BTreeSet<T> {
type Output = BTreeSet<T>; type Output = BTreeSet<T>;
@ -524,7 +524,7 @@ impl<'a, 'b, T: Ord + Clone> Sub<&'b BTreeSet<T>> for &'a BTreeSet<T> {
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a, 'b, T: Ord + Clone> BitXor<&'b BTreeSet<T>> for &'a BTreeSet<T> { impl<'a, 'b, T: Ord + Clone> BitXor<&'b BTreeSet<T>> for &'a BTreeSet<T> {
type Output = BTreeSet<T>; type Output = BTreeSet<T>;
@ -547,7 +547,7 @@ impl<'a, 'b, T: Ord + Clone> BitXor<&'b BTreeSet<T>> for &'a BTreeSet<T> {
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a, 'b, T: Ord + Clone> BitAnd<&'b BTreeSet<T>> for &'a BTreeSet<T> { impl<'a, 'b, T: Ord + Clone> BitAnd<&'b BTreeSet<T>> for &'a BTreeSet<T> {
type Output = BTreeSet<T>; type Output = BTreeSet<T>;
@ -570,7 +570,7 @@ impl<'a, 'b, T: Ord + Clone> BitAnd<&'b BTreeSet<T>> for &'a BTreeSet<T> {
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a, 'b, T: Ord + Clone> BitOr<&'b BTreeSet<T>> for &'a BTreeSet<T> { impl<'a, 'b, T: Ord + Clone> BitOr<&'b BTreeSet<T>> for &'a BTreeSet<T> {
type Output = BTreeSet<T>; type Output = BTreeSet<T>;
@ -593,7 +593,7 @@ impl<'a, 'b, T: Ord + Clone> BitOr<&'b BTreeSet<T>> for &'a BTreeSet<T> {
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<T: Show> Show for BTreeSet<T> { impl<T: Show> Show for BTreeSet<T> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
try!(write!(f, "BTreeSet {{")); try!(write!(f, "BTreeSet {{"));
@ -607,33 +607,33 @@ impl<T: Show> Show for BTreeSet<T> {
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a, T> Iterator for Iter<'a, T> { impl<'a, T> Iterator for Iter<'a, T> {
type Item = &'a T; type Item = &'a T;
fn next(&mut self) -> Option<&'a T> { self.iter.next() } fn next(&mut self) -> Option<&'a T> { self.iter.next() }
fn size_hint(&self) -> (uint, Option<uint>) { self.iter.size_hint() } fn size_hint(&self) -> (uint, Option<uint>) { self.iter.size_hint() }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a, T> DoubleEndedIterator for Iter<'a, T> { impl<'a, T> DoubleEndedIterator for Iter<'a, T> {
fn next_back(&mut self) -> Option<&'a T> { self.iter.next_back() } fn next_back(&mut self) -> Option<&'a T> { self.iter.next_back() }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a, T> ExactSizeIterator for Iter<'a, T> {} impl<'a, T> ExactSizeIterator for Iter<'a, T> {}
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<T> Iterator for IntoIter<T> { impl<T> Iterator for IntoIter<T> {
type Item = T; type Item = T;
fn next(&mut self) -> Option<T> { self.iter.next() } fn next(&mut self) -> Option<T> { self.iter.next() }
fn size_hint(&self) -> (uint, Option<uint>) { self.iter.size_hint() } fn size_hint(&self) -> (uint, Option<uint>) { self.iter.size_hint() }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<T> DoubleEndedIterator for IntoIter<T> { impl<T> DoubleEndedIterator for IntoIter<T> {
fn next_back(&mut self) -> Option<T> { self.iter.next_back() } fn next_back(&mut self) -> Option<T> { self.iter.next_back() }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<T> ExactSizeIterator for IntoIter<T> {} impl<T> ExactSizeIterator for IntoIter<T> {}
@ -656,7 +656,7 @@ fn cmp_opt<T: Ord>(x: Option<&T>, y: Option<&T>,
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a, T: Ord> Iterator for Difference<'a, T> { impl<'a, T: Ord> Iterator for Difference<'a, T> {
type Item = &'a T; type Item = &'a T;
@ -671,7 +671,7 @@ impl<'a, T: Ord> Iterator for Difference<'a, T> {
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a, T: Ord> Iterator for SymmetricDifference<'a, T> { impl<'a, T: Ord> Iterator for SymmetricDifference<'a, T> {
type Item = &'a T; type Item = &'a T;
@ -686,7 +686,7 @@ impl<'a, T: Ord> Iterator for SymmetricDifference<'a, T> {
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a, T: Ord> Iterator for Intersection<'a, T> { impl<'a, T: Ord> Iterator for Intersection<'a, T> {
type Item = &'a T; type Item = &'a T;
@ -707,7 +707,7 @@ impl<'a, T: Ord> Iterator for Intersection<'a, T> {
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a, T: Ord> Iterator for Union<'a, T> { impl<'a, T: Ord> Iterator for Union<'a, T> {
type Item = &'a T; type Item = &'a T;

View File

@ -19,7 +19,7 @@
// Backlinks over DList::prev are raw pointers that form a full chain in // Backlinks over DList::prev are raw pointers that form a full chain in
// the reverse direction. // the reverse direction.
#![stable(feature = "grandfathered", since = "1.0.0")] #![stable(feature = "rust1", since = "1.0.0")]
use core::prelude::*; use core::prelude::*;
@ -33,7 +33,7 @@ use core::mem;
use core::ptr; use core::ptr;
/// A doubly-linked list. /// A doubly-linked list.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub struct DList<T> { pub struct DList<T> {
length: uint, length: uint,
list_head: Link<T>, list_head: Link<T>,
@ -57,7 +57,7 @@ struct Node<T> {
} }
/// An iterator over references to the items of a `DList`. /// An iterator over references to the items of a `DList`.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub struct Iter<'a, T:'a> { pub struct Iter<'a, T:'a> {
head: &'a Link<T>, head: &'a Link<T>,
tail: Rawlink<Node<T>>, tail: Rawlink<Node<T>>,
@ -65,7 +65,7 @@ pub struct Iter<'a, T:'a> {
} }
// FIXME #19839: deriving is too aggressive on the bounds (T doesn't need to be Clone). // FIXME #19839: deriving is too aggressive on the bounds (T doesn't need to be Clone).
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a, T> Clone for Iter<'a, T> { impl<'a, T> Clone for Iter<'a, T> {
fn clone(&self) -> Iter<'a, T> { fn clone(&self) -> Iter<'a, T> {
Iter { Iter {
@ -77,7 +77,7 @@ impl<'a, T> Clone for Iter<'a, T> {
} }
/// An iterator over mutable references to the items of a `DList`. /// An iterator over mutable references to the items of a `DList`.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub struct IterMut<'a, T:'a> { pub struct IterMut<'a, T:'a> {
list: &'a mut DList<T>, list: &'a mut DList<T>,
head: Rawlink<Node<T>>, head: Rawlink<Node<T>>,
@ -87,7 +87,7 @@ pub struct IterMut<'a, T:'a> {
/// An iterator over mutable references to the items of a `DList`. /// An iterator over mutable references to the items of a `DList`.
#[derive(Clone)] #[derive(Clone)]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub struct IntoIter<T> { pub struct IntoIter<T> {
list: DList<T> list: DList<T>
} }
@ -206,17 +206,17 @@ impl<T> DList<T> {
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<T> Default for DList<T> { impl<T> Default for DList<T> {
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn default() -> DList<T> { DList::new() } fn default() -> DList<T> { DList::new() }
} }
impl<T> DList<T> { impl<T> DList<T> {
/// Creates an empty `DList`. /// Creates an empty `DList`.
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn new() -> DList<T> { pub fn new() -> DList<T> {
DList{list_head: None, list_tail: Rawlink::none(), length: 0} DList{list_head: None, list_tail: Rawlink::none(), length: 0}
} }
@ -273,14 +273,14 @@ impl<T> DList<T> {
/// Provides a forward iterator. /// Provides a forward iterator.
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn iter(&self) -> Iter<T> { pub fn iter(&self) -> Iter<T> {
Iter{nelem: self.len(), head: &self.list_head, tail: self.list_tail} Iter{nelem: self.len(), head: &self.list_head, tail: self.list_tail}
} }
/// Provides a forward iterator with mutable references. /// Provides a forward iterator with mutable references.
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn iter_mut(&mut self) -> IterMut<T> { pub fn iter_mut(&mut self) -> IterMut<T> {
let head_raw = match self.list_head { let head_raw = match self.list_head {
Some(ref mut h) => Rawlink::some(&mut **h), Some(ref mut h) => Rawlink::some(&mut **h),
@ -296,7 +296,7 @@ impl<T> DList<T> {
/// Consumes the list into an iterator yielding elements by value. /// Consumes the list into an iterator yielding elements by value.
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn into_iter(self) -> IntoIter<T> { pub fn into_iter(self) -> IntoIter<T> {
IntoIter{list: self} IntoIter{list: self}
} }
@ -317,7 +317,7 @@ impl<T> DList<T> {
/// assert!(!dl.is_empty()); /// assert!(!dl.is_empty());
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn is_empty(&self) -> bool { pub fn is_empty(&self) -> bool {
self.list_head.is_none() self.list_head.is_none()
} }
@ -344,7 +344,7 @@ impl<T> DList<T> {
/// ///
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn len(&self) -> uint { pub fn len(&self) -> uint {
self.length self.length
} }
@ -371,7 +371,7 @@ impl<T> DList<T> {
/// ///
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn clear(&mut self) { pub fn clear(&mut self) {
*self = DList::new() *self = DList::new()
} }
@ -392,7 +392,7 @@ impl<T> DList<T> {
/// ///
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn front(&self) -> Option<&T> { pub fn front(&self) -> Option<&T> {
self.list_head.as_ref().map(|head| &head.value) self.list_head.as_ref().map(|head| &head.value)
} }
@ -419,7 +419,7 @@ impl<T> DList<T> {
/// ///
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn front_mut(&mut self) -> Option<&mut T> { pub fn front_mut(&mut self) -> Option<&mut T> {
self.list_head.as_mut().map(|head| &mut head.value) self.list_head.as_mut().map(|head| &mut head.value)
} }
@ -440,7 +440,7 @@ impl<T> DList<T> {
/// ///
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn back(&self) -> Option<&T> { pub fn back(&self) -> Option<&T> {
self.list_tail.resolve_immut().as_ref().map(|tail| &tail.value) self.list_tail.resolve_immut().as_ref().map(|tail| &tail.value)
} }
@ -467,7 +467,7 @@ impl<T> DList<T> {
/// ///
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn back_mut(&mut self) -> Option<&mut T> { pub fn back_mut(&mut self) -> Option<&mut T> {
self.list_tail.resolve().map(|tail| &mut tail.value) self.list_tail.resolve().map(|tail| &mut tail.value)
} }
@ -490,7 +490,7 @@ impl<T> DList<T> {
/// assert_eq!(dl.front().unwrap(), &1); /// assert_eq!(dl.front().unwrap(), &1);
/// ///
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn push_front(&mut self, elt: T) { pub fn push_front(&mut self, elt: T) {
self.push_front_node(box Node::new(elt)) self.push_front_node(box Node::new(elt))
} }
@ -516,7 +516,7 @@ impl<T> DList<T> {
/// ///
/// ``` /// ```
/// ///
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn pop_front(&mut self) -> Option<T> { pub fn pop_front(&mut self) -> Option<T> {
self.pop_front_node().map(|box Node{value, ..}| value) self.pop_front_node().map(|box Node{value, ..}| value)
} }
@ -533,7 +533,7 @@ impl<T> DList<T> {
/// d.push_back(3); /// d.push_back(3);
/// assert_eq!(3, *d.back().unwrap()); /// assert_eq!(3, *d.back().unwrap());
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn push_back(&mut self, elt: T) { pub fn push_back(&mut self, elt: T) {
self.push_back_node(box Node::new(elt)) self.push_back_node(box Node::new(elt))
} }
@ -552,7 +552,7 @@ impl<T> DList<T> {
/// d.push_back(3); /// d.push_back(3);
/// assert_eq!(d.pop_back(), Some(3)); /// assert_eq!(d.pop_back(), Some(3));
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn pop_back(&mut self) -> Option<T> { pub fn pop_back(&mut self) -> Option<T> {
self.pop_back_node().map(|box Node{value, ..}| value) self.pop_back_node().map(|box Node{value, ..}| value)
} }
@ -577,7 +577,7 @@ impl<T> DList<T> {
/// assert_eq!(splitted.pop_front(), Some(1)); /// assert_eq!(splitted.pop_front(), Some(1));
/// assert_eq!(splitted.pop_front(), None); /// assert_eq!(splitted.pop_front(), None);
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn split_off(&mut self, at: uint) -> DList<T> { pub fn split_off(&mut self, at: uint) -> DList<T> {
let len = self.len(); let len = self.len();
assert!(at < len, "Cannot split off at a nonexistent index"); assert!(at < len, "Cannot split off at a nonexistent index");
@ -620,7 +620,7 @@ impl<T> DList<T> {
} }
#[unsafe_destructor] #[unsafe_destructor]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<T> Drop for DList<T> { impl<T> Drop for DList<T> {
fn drop(&mut self) { fn drop(&mut self) {
// Dissolve the dlist in backwards direction // Dissolve the dlist in backwards direction
@ -642,7 +642,7 @@ impl<T> Drop for DList<T> {
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a, A> Iterator for Iter<'a, A> { impl<'a, A> Iterator for Iter<'a, A> {
type Item = &'a A; type Item = &'a A;
@ -664,7 +664,7 @@ impl<'a, A> Iterator for Iter<'a, A> {
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a, A> DoubleEndedIterator for Iter<'a, A> { impl<'a, A> DoubleEndedIterator for Iter<'a, A> {
#[inline] #[inline]
fn next_back(&mut self) -> Option<&'a A> { fn next_back(&mut self) -> Option<&'a A> {
@ -679,10 +679,10 @@ impl<'a, A> DoubleEndedIterator for Iter<'a, A> {
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a, A> ExactSizeIterator for Iter<'a, A> {} impl<'a, A> ExactSizeIterator for Iter<'a, A> {}
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a, A> Iterator for IterMut<'a, A> { impl<'a, A> Iterator for IterMut<'a, A> {
type Item = &'a mut A; type Item = &'a mut A;
#[inline] #[inline]
@ -706,7 +706,7 @@ impl<'a, A> Iterator for IterMut<'a, A> {
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a, A> DoubleEndedIterator for IterMut<'a, A> { impl<'a, A> DoubleEndedIterator for IterMut<'a, A> {
#[inline] #[inline]
fn next_back(&mut self) -> Option<&'a mut A> { fn next_back(&mut self) -> Option<&'a mut A> {
@ -721,7 +721,7 @@ impl<'a, A> DoubleEndedIterator for IterMut<'a, A> {
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a, A> ExactSizeIterator for IterMut<'a, A> {} impl<'a, A> ExactSizeIterator for IterMut<'a, A> {}
// private methods for IterMut // private methods for IterMut
@ -802,7 +802,7 @@ impl<'a, A> IterMut<'a, A> {
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<A> Iterator for IntoIter<A> { impl<A> Iterator for IntoIter<A> {
type Item = A; type Item = A;
@ -815,13 +815,13 @@ impl<A> Iterator for IntoIter<A> {
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<A> DoubleEndedIterator for IntoIter<A> { impl<A> DoubleEndedIterator for IntoIter<A> {
#[inline] #[inline]
fn next_back(&mut self) -> Option<A> { self.list.pop_back() } fn next_back(&mut self) -> Option<A> { self.list.pop_back() }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<A> FromIterator<A> for DList<A> { impl<A> FromIterator<A> for DList<A> {
fn from_iter<T: Iterator<Item=A>>(iterator: T) -> DList<A> { fn from_iter<T: Iterator<Item=A>>(iterator: T) -> DList<A> {
let mut ret = DList::new(); let mut ret = DList::new();
@ -830,14 +830,14 @@ impl<A> FromIterator<A> for DList<A> {
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<A> Extend<A> for DList<A> { impl<A> Extend<A> for DList<A> {
fn extend<T: Iterator<Item=A>>(&mut self, mut iterator: T) { fn extend<T: Iterator<Item=A>>(&mut self, mut iterator: T) {
for elt in iterator { self.push_back(elt); } for elt in iterator { self.push_back(elt); }
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<A: PartialEq> PartialEq for DList<A> { impl<A: PartialEq> PartialEq for DList<A> {
fn eq(&self, other: &DList<A>) -> bool { fn eq(&self, other: &DList<A>) -> bool {
self.len() == other.len() && self.len() == other.len() &&
@ -850,17 +850,17 @@ impl<A: PartialEq> PartialEq for DList<A> {
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<A: Eq> Eq for DList<A> {} impl<A: Eq> Eq for DList<A> {}
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<A: PartialOrd> PartialOrd for DList<A> { impl<A: PartialOrd> PartialOrd for DList<A> {
fn partial_cmp(&self, other: &DList<A>) -> Option<Ordering> { fn partial_cmp(&self, other: &DList<A>) -> Option<Ordering> {
iter::order::partial_cmp(self.iter(), other.iter()) iter::order::partial_cmp(self.iter(), other.iter())
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<A: Ord> Ord for DList<A> { impl<A: Ord> Ord for DList<A> {
#[inline] #[inline]
fn cmp(&self, other: &DList<A>) -> Ordering { fn cmp(&self, other: &DList<A>) -> Ordering {
@ -868,14 +868,14 @@ impl<A: Ord> Ord for DList<A> {
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<A: Clone> Clone for DList<A> { impl<A: Clone> Clone for DList<A> {
fn clone(&self) -> DList<A> { fn clone(&self) -> DList<A> {
self.iter().map(|x| x.clone()).collect() self.iter().map(|x| x.clone()).collect()
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<A: fmt::Show> fmt::Show for DList<A> { impl<A: fmt::Show> fmt::Show for DList<A> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
try!(write!(f, "DList [")); try!(write!(f, "DList ["));
@ -889,7 +889,7 @@ impl<A: fmt::Show> fmt::Show for DList<A> {
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<S: Writer + Hasher, A: Hash<S>> Hash<S> for DList<A> { impl<S: Writer + Hasher, A: Hash<S>> Hash<S> for DList<A> {
fn hash(&self, state: &mut S) { fn hash(&self, state: &mut S) {
self.len().hash(state); self.len().hash(state);

View File

@ -88,12 +88,12 @@ pub mod bitv_set {
pub use bit::SetIter as Iter; pub use bit::SetIter as Iter;
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub mod btree_map { pub mod btree_map {
pub use btree::map::*; pub use btree::map::*;
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub mod btree_set { pub mod btree_set {
pub use btree::set::*; pub use btree::set::*;
} }

View File

@ -10,7 +10,7 @@
/// Creates a `Vec` containing the arguments. /// Creates a `Vec` containing the arguments.
#[macro_export] #[macro_export]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
macro_rules! vec { macro_rules! vec {
($x:expr; $y:expr) => ({ ($x:expr; $y:expr) => ({
let xs: $crate::boxed::Box<[_]> = $crate::boxed::Box::new([$x; $y]); let xs: $crate::boxed::Box<[_]> = $crate::boxed::Box::new([$x; $y]);

View File

@ -12,7 +12,7 @@
//! ends of the container. It also has `O(1)` indexing like a vector. The contained elements are //! ends of the container. It also has `O(1)` indexing like a vector. The contained elements are
//! not required to be copyable, and the queue will be sendable if the contained type is sendable. //! not required to be copyable, and the queue will be sendable if the contained type is sendable.
#![stable(feature = "grandfathered", since = "1.0.0")] #![stable(feature = "rust1", since = "1.0.0")]
use core::prelude::*; use core::prelude::*;
@ -36,7 +36,7 @@ static INITIAL_CAPACITY: uint = 7u; // 2^3 - 1
static MINIMUM_CAPACITY: uint = 1u; // 2 - 1 static MINIMUM_CAPACITY: uint = 1u; // 2 - 1
/// `RingBuf` is a circular buffer, which can be used as a double-ended queue efficiently. /// `RingBuf` is a circular buffer, which can be used as a double-ended queue efficiently.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub struct RingBuf<T> { pub struct RingBuf<T> {
// tail and head are pointers into the buffer. Tail always points // tail and head are pointers into the buffer. Tail always points
// to the first element that could be read, Head always points // to the first element that could be read, Head always points
@ -50,13 +50,13 @@ pub struct RingBuf<T> {
ptr: *mut T ptr: *mut T
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
unsafe impl<T: Send> Send for RingBuf<T> {} unsafe impl<T: Send> Send for RingBuf<T> {}
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
unsafe impl<T: Sync> Sync for RingBuf<T> {} unsafe impl<T: Sync> Sync for RingBuf<T> {}
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<T: Clone> Clone for RingBuf<T> { impl<T: Clone> Clone for RingBuf<T> {
fn clone(&self) -> RingBuf<T> { fn clone(&self) -> RingBuf<T> {
self.iter().map(|t| t.clone()).collect() self.iter().map(|t| t.clone()).collect()
@ -64,7 +64,7 @@ impl<T: Clone> Clone for RingBuf<T> {
} }
#[unsafe_destructor] #[unsafe_destructor]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<T> Drop for RingBuf<T> { impl<T> Drop for RingBuf<T> {
fn drop(&mut self) { fn drop(&mut self) {
self.clear(); self.clear();
@ -78,7 +78,7 @@ impl<T> Drop for RingBuf<T> {
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<T> Default for RingBuf<T> { impl<T> Default for RingBuf<T> {
#[inline] #[inline]
fn default() -> RingBuf<T> { RingBuf::new() } fn default() -> RingBuf<T> { RingBuf::new() }
@ -146,13 +146,13 @@ impl<T> RingBuf<T> {
impl<T> RingBuf<T> { impl<T> RingBuf<T> {
/// Creates an empty `RingBuf`. /// Creates an empty `RingBuf`.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn new() -> RingBuf<T> { pub fn new() -> RingBuf<T> {
RingBuf::with_capacity(INITIAL_CAPACITY) RingBuf::with_capacity(INITIAL_CAPACITY)
} }
/// Creates an empty `RingBuf` with space for at least `n` elements. /// Creates an empty `RingBuf` with space for at least `n` elements.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn with_capacity(n: uint) -> RingBuf<T> { pub fn with_capacity(n: uint) -> RingBuf<T> {
// +1 since the ringbuffer always leaves one space empty // +1 since the ringbuffer always leaves one space empty
let cap = cmp::max(n + 1, MINIMUM_CAPACITY + 1).next_power_of_two(); let cap = cmp::max(n + 1, MINIMUM_CAPACITY + 1).next_power_of_two();
@ -191,7 +191,7 @@ impl<T> RingBuf<T> {
/// buf.push_back(5); /// buf.push_back(5);
/// assert_eq!(buf.get(1).unwrap(), &4); /// assert_eq!(buf.get(1).unwrap(), &4);
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn get(&self, i: uint) -> Option<&T> { pub fn get(&self, i: uint) -> Option<&T> {
if i < self.len() { if i < self.len() {
let idx = self.wrap_index(self.tail + i); let idx = self.wrap_index(self.tail + i);
@ -221,7 +221,7 @@ impl<T> RingBuf<T> {
/// ///
/// assert_eq!(buf[1], 7); /// assert_eq!(buf[1], 7);
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn get_mut(&mut self, i: uint) -> Option<&mut T> { pub fn get_mut(&mut self, i: uint) -> Option<&mut T> {
if i < self.len() { if i < self.len() {
let idx = self.wrap_index(self.tail + i); let idx = self.wrap_index(self.tail + i);
@ -250,7 +250,7 @@ impl<T> RingBuf<T> {
/// assert_eq!(buf[0], 5); /// assert_eq!(buf[0], 5);
/// assert_eq!(buf[2], 3); /// assert_eq!(buf[2], 3);
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn swap(&mut self, i: uint, j: uint) { pub fn swap(&mut self, i: uint, j: uint) {
assert!(i < self.len()); assert!(i < self.len());
assert!(j < self.len()); assert!(j < self.len());
@ -273,7 +273,7 @@ impl<T> RingBuf<T> {
/// assert!(buf.capacity() >= 10); /// assert!(buf.capacity() >= 10);
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn capacity(&self) -> uint { self.cap - 1 } pub fn capacity(&self) -> uint { self.cap - 1 }
/// Reserves the minimum capacity for exactly `additional` more elements to be inserted in the /// Reserves the minimum capacity for exactly `additional` more elements to be inserted in the
@ -296,7 +296,7 @@ impl<T> RingBuf<T> {
/// buf.reserve_exact(10); /// buf.reserve_exact(10);
/// assert!(buf.capacity() >= 11); /// assert!(buf.capacity() >= 11);
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn reserve_exact(&mut self, additional: uint) { pub fn reserve_exact(&mut self, additional: uint) {
self.reserve(additional); self.reserve(additional);
} }
@ -317,7 +317,7 @@ impl<T> RingBuf<T> {
/// buf.reserve(10); /// buf.reserve(10);
/// assert!(buf.capacity() >= 11); /// assert!(buf.capacity() >= 11);
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn reserve(&mut self, additional: uint) { pub fn reserve(&mut self, additional: uint) {
let new_len = self.len() + additional; let new_len = self.len() + additional;
assert!(new_len + 1 > self.len(), "capacity overflow"); assert!(new_len + 1 > self.len(), "capacity overflow");
@ -502,7 +502,7 @@ impl<T> RingBuf<T> {
/// let b: &[_] = &[&5, &3, &4]; /// let b: &[_] = &[&5, &3, &4];
/// assert_eq!(buf.iter().collect::<Vec<&int>>().as_slice(), b); /// assert_eq!(buf.iter().collect::<Vec<&int>>().as_slice(), b);
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn iter(&self) -> Iter<T> { pub fn iter(&self) -> Iter<T> {
Iter { Iter {
tail: self.tail, tail: self.tail,
@ -528,7 +528,7 @@ impl<T> RingBuf<T> {
/// let b: &[_] = &[&mut 3, &mut 1, &mut 2]; /// let b: &[_] = &[&mut 3, &mut 1, &mut 2];
/// assert_eq!(&buf.iter_mut().collect::<Vec<&mut int>>()[], b); /// assert_eq!(&buf.iter_mut().collect::<Vec<&mut int>>()[], b);
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn iter_mut<'a>(&'a mut self) -> IterMut<'a, T> { pub fn iter_mut<'a>(&'a mut self) -> IterMut<'a, T> {
IterMut { IterMut {
tail: self.tail, tail: self.tail,
@ -540,7 +540,7 @@ impl<T> RingBuf<T> {
} }
/// Consumes the list into an iterator yielding elements by value. /// Consumes the list into an iterator yielding elements by value.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn into_iter(self) -> IntoIter<T> { pub fn into_iter(self) -> IntoIter<T> {
IntoIter { IntoIter {
inner: self, inner: self,
@ -603,7 +603,7 @@ impl<T> RingBuf<T> {
/// v.push_back(1i); /// v.push_back(1i);
/// assert_eq!(v.len(), 1); /// assert_eq!(v.len(), 1);
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn len(&self) -> uint { count(self.tail, self.head, self.cap) } pub fn len(&self) -> uint { count(self.tail, self.head, self.cap) }
/// Returns true if the buffer contains no elements /// Returns true if the buffer contains no elements
@ -618,7 +618,7 @@ impl<T> RingBuf<T> {
/// v.push_front(1i); /// v.push_front(1i);
/// assert!(!v.is_empty()); /// assert!(!v.is_empty());
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn is_empty(&self) -> bool { self.len() == 0 } pub fn is_empty(&self) -> bool { self.len() == 0 }
/// Creates a draining iterator that clears the `RingBuf` and iterates over /// Creates a draining iterator that clears the `RingBuf` and iterates over
@ -655,7 +655,7 @@ impl<T> RingBuf<T> {
/// v.clear(); /// v.clear();
/// assert!(v.is_empty()); /// assert!(v.is_empty());
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[inline] #[inline]
pub fn clear(&mut self) { pub fn clear(&mut self) {
self.drain(); self.drain();
@ -676,7 +676,7 @@ impl<T> RingBuf<T> {
/// d.push_back(2i); /// d.push_back(2i);
/// assert_eq!(d.front(), Some(&1i)); /// assert_eq!(d.front(), Some(&1i));
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn front(&self) -> Option<&T> { pub fn front(&self) -> Option<&T> {
if !self.is_empty() { Some(&self[0]) } else { None } if !self.is_empty() { Some(&self[0]) } else { None }
} }
@ -700,7 +700,7 @@ impl<T> RingBuf<T> {
/// } /// }
/// assert_eq!(d.front(), Some(&9i)); /// assert_eq!(d.front(), Some(&9i));
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn front_mut(&mut self) -> Option<&mut T> { pub fn front_mut(&mut self) -> Option<&mut T> {
if !self.is_empty() { Some(&mut self[0]) } else { None } if !self.is_empty() { Some(&mut self[0]) } else { None }
} }
@ -720,7 +720,7 @@ impl<T> RingBuf<T> {
/// d.push_back(2i); /// d.push_back(2i);
/// assert_eq!(d.back(), Some(&2i)); /// assert_eq!(d.back(), Some(&2i));
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn back(&self) -> Option<&T> { pub fn back(&self) -> Option<&T> {
if !self.is_empty() { Some(&self[self.len() - 1]) } else { None } if !self.is_empty() { Some(&self[self.len() - 1]) } else { None }
} }
@ -744,7 +744,7 @@ impl<T> RingBuf<T> {
/// } /// }
/// assert_eq!(d.back(), Some(&9i)); /// assert_eq!(d.back(), Some(&9i));
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn back_mut(&mut self) -> Option<&mut T> { pub fn back_mut(&mut self) -> Option<&mut T> {
let len = self.len(); let len = self.len();
if !self.is_empty() { Some(&mut self[len - 1]) } else { None } if !self.is_empty() { Some(&mut self[len - 1]) } else { None }
@ -766,7 +766,7 @@ impl<T> RingBuf<T> {
/// assert_eq!(d.pop_front(), Some(2i)); /// assert_eq!(d.pop_front(), Some(2i));
/// assert_eq!(d.pop_front(), None); /// assert_eq!(d.pop_front(), None);
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn pop_front(&mut self) -> Option<T> { pub fn pop_front(&mut self) -> Option<T> {
if self.is_empty() { if self.is_empty() {
None None
@ -789,7 +789,7 @@ impl<T> RingBuf<T> {
/// d.push_front(2i); /// d.push_front(2i);
/// assert_eq!(d.front(), Some(&2i)); /// assert_eq!(d.front(), Some(&2i));
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn push_front(&mut self, t: T) { pub fn push_front(&mut self, t: T) {
if self.is_full() { if self.is_full() {
self.reserve(1); self.reserve(1);
@ -813,7 +813,7 @@ impl<T> RingBuf<T> {
/// buf.push_back(3); /// buf.push_back(3);
/// assert_eq!(3, *buf.back().unwrap()); /// assert_eq!(3, *buf.back().unwrap());
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn push_back(&mut self, t: T) { pub fn push_back(&mut self, t: T) {
if self.is_full() { if self.is_full() {
self.reserve(1); self.reserve(1);
@ -839,7 +839,7 @@ impl<T> RingBuf<T> {
/// buf.push_back(3); /// buf.push_back(3);
/// assert_eq!(buf.pop_back(), Some(3)); /// assert_eq!(buf.pop_back(), Some(3));
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn pop_back(&mut self) -> Option<T> { pub fn pop_back(&mut self) -> Option<T> {
if self.is_empty() { if self.is_empty() {
None None
@ -1143,7 +1143,7 @@ impl<T> RingBuf<T> {
/// buf.remove(2); /// buf.remove(2);
/// assert_eq!(Some(&15), buf.get(2)); /// assert_eq!(Some(&15), buf.get(2));
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn remove(&mut self, i: uint) -> Option<T> { pub fn remove(&mut self, i: uint) -> Option<T> {
if self.is_empty() || self.len() <= i { if self.is_empty() || self.len() <= i {
return None; return None;
@ -1338,7 +1338,7 @@ fn count(tail: uint, head: uint, size: uint) -> uint {
} }
/// `RingBuf` iterator. /// `RingBuf` iterator.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub struct Iter<'a, T:'a> { pub struct Iter<'a, T:'a> {
ring: &'a [T], ring: &'a [T],
tail: uint, tail: uint,
@ -1356,7 +1356,7 @@ impl<'a, T> Clone for Iter<'a, T> {
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a, T> Iterator for Iter<'a, T> { impl<'a, T> Iterator for Iter<'a, T> {
type Item = &'a T; type Item = &'a T;
@ -1377,7 +1377,7 @@ impl<'a, T> Iterator for Iter<'a, T> {
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a, T> DoubleEndedIterator for Iter<'a, T> { impl<'a, T> DoubleEndedIterator for Iter<'a, T> {
#[inline] #[inline]
fn next_back(&mut self) -> Option<&'a T> { fn next_back(&mut self) -> Option<&'a T> {
@ -1389,10 +1389,10 @@ impl<'a, T> DoubleEndedIterator for Iter<'a, T> {
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a, T> ExactSizeIterator for Iter<'a, T> {} impl<'a, T> ExactSizeIterator for Iter<'a, T> {}
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a, T> RandomAccessIterator for Iter<'a, T> { impl<'a, T> RandomAccessIterator for Iter<'a, T> {
#[inline] #[inline]
fn indexable(&self) -> uint { fn indexable(&self) -> uint {
@ -1415,7 +1415,7 @@ impl<'a, T> RandomAccessIterator for Iter<'a, T> {
// with returning the mutable reference. I couldn't find a way to // with returning the mutable reference. I couldn't find a way to
// make the lifetime checker happy so, but there should be a way. // make the lifetime checker happy so, but there should be a way.
/// `RingBuf` mutable iterator. /// `RingBuf` mutable iterator.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub struct IterMut<'a, T:'a> { pub struct IterMut<'a, T:'a> {
ptr: *mut T, ptr: *mut T,
tail: uint, tail: uint,
@ -1424,7 +1424,7 @@ pub struct IterMut<'a, T:'a> {
marker: marker::ContravariantLifetime<'a>, marker: marker::ContravariantLifetime<'a>,
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a, T> Iterator for IterMut<'a, T> { impl<'a, T> Iterator for IterMut<'a, T> {
type Item = &'a mut T; type Item = &'a mut T;
@ -1448,7 +1448,7 @@ impl<'a, T> Iterator for IterMut<'a, T> {
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a, T> DoubleEndedIterator for IterMut<'a, T> { impl<'a, T> DoubleEndedIterator for IterMut<'a, T> {
#[inline] #[inline]
fn next_back(&mut self) -> Option<&'a mut T> { fn next_back(&mut self) -> Option<&'a mut T> {
@ -1463,16 +1463,16 @@ impl<'a, T> DoubleEndedIterator for IterMut<'a, T> {
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a, T> ExactSizeIterator for IterMut<'a, T> {} impl<'a, T> ExactSizeIterator for IterMut<'a, T> {}
/// A by-value RingBuf iterator /// A by-value RingBuf iterator
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub struct IntoIter<T> { pub struct IntoIter<T> {
inner: RingBuf<T>, inner: RingBuf<T>,
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<T> Iterator for IntoIter<T> { impl<T> Iterator for IntoIter<T> {
type Item = T; type Item = T;
@ -1488,7 +1488,7 @@ impl<T> Iterator for IntoIter<T> {
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<T> DoubleEndedIterator for IntoIter<T> { impl<T> DoubleEndedIterator for IntoIter<T> {
#[inline] #[inline]
fn next_back(&mut self) -> Option<T> { fn next_back(&mut self) -> Option<T> {
@ -1496,7 +1496,7 @@ impl<T> DoubleEndedIterator for IntoIter<T> {
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<T> ExactSizeIterator for IntoIter<T> {} impl<T> ExactSizeIterator for IntoIter<T> {}
/// A draining RingBuf iterator /// A draining RingBuf iterator
@ -1507,7 +1507,7 @@ pub struct Drain<'a, T: 'a> {
} }
#[unsafe_destructor] #[unsafe_destructor]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a, T: 'a> Drop for Drain<'a, T> { impl<'a, T: 'a> Drop for Drain<'a, T> {
fn drop(&mut self) { fn drop(&mut self) {
for _ in *self {} for _ in *self {}
@ -1516,7 +1516,7 @@ impl<'a, T: 'a> Drop for Drain<'a, T> {
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a, T: 'a> Iterator for Drain<'a, T> { impl<'a, T: 'a> Iterator for Drain<'a, T> {
type Item = T; type Item = T;
@ -1532,7 +1532,7 @@ impl<'a, T: 'a> Iterator for Drain<'a, T> {
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a, T: 'a> DoubleEndedIterator for Drain<'a, T> { impl<'a, T: 'a> DoubleEndedIterator for Drain<'a, T> {
#[inline] #[inline]
fn next_back(&mut self) -> Option<T> { fn next_back(&mut self) -> Option<T> {
@ -1540,10 +1540,10 @@ impl<'a, T: 'a> DoubleEndedIterator for Drain<'a, T> {
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a, T: 'a> ExactSizeIterator for Drain<'a, T> {} impl<'a, T: 'a> ExactSizeIterator for Drain<'a, T> {}
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<A: PartialEq> PartialEq for RingBuf<A> { impl<A: PartialEq> PartialEq for RingBuf<A> {
fn eq(&self, other: &RingBuf<A>) -> bool { fn eq(&self, other: &RingBuf<A>) -> bool {
self.len() == other.len() && self.len() == other.len() &&
@ -1551,17 +1551,17 @@ impl<A: PartialEq> PartialEq for RingBuf<A> {
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<A: Eq> Eq for RingBuf<A> {} impl<A: Eq> Eq for RingBuf<A> {}
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<A: PartialOrd> PartialOrd for RingBuf<A> { impl<A: PartialOrd> PartialOrd for RingBuf<A> {
fn partial_cmp(&self, other: &RingBuf<A>) -> Option<Ordering> { fn partial_cmp(&self, other: &RingBuf<A>) -> Option<Ordering> {
iter::order::partial_cmp(self.iter(), other.iter()) iter::order::partial_cmp(self.iter(), other.iter())
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<A: Ord> Ord for RingBuf<A> { impl<A: Ord> Ord for RingBuf<A> {
#[inline] #[inline]
fn cmp(&self, other: &RingBuf<A>) -> Ordering { fn cmp(&self, other: &RingBuf<A>) -> Ordering {
@ -1569,7 +1569,7 @@ impl<A: Ord> Ord for RingBuf<A> {
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<S: Writer + Hasher, A: Hash<S>> Hash<S> for RingBuf<A> { impl<S: Writer + Hasher, A: Hash<S>> Hash<S> for RingBuf<A> {
fn hash(&self, state: &mut S) { fn hash(&self, state: &mut S) {
self.len().hash(state); self.len().hash(state);
@ -1579,7 +1579,7 @@ impl<S: Writer + Hasher, A: Hash<S>> Hash<S> for RingBuf<A> {
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<A> Index<uint> for RingBuf<A> { impl<A> Index<uint> for RingBuf<A> {
type Output = A; type Output = A;
@ -1589,7 +1589,7 @@ impl<A> Index<uint> for RingBuf<A> {
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<A> IndexMut<uint> for RingBuf<A> { impl<A> IndexMut<uint> for RingBuf<A> {
type Output = A; type Output = A;
@ -1599,7 +1599,7 @@ impl<A> IndexMut<uint> for RingBuf<A> {
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<A> FromIterator<A> for RingBuf<A> { impl<A> FromIterator<A> for RingBuf<A> {
fn from_iter<T: Iterator<Item=A>>(iterator: T) -> RingBuf<A> { fn from_iter<T: Iterator<Item=A>>(iterator: T) -> RingBuf<A> {
let (lower, _) = iterator.size_hint(); let (lower, _) = iterator.size_hint();
@ -1609,7 +1609,7 @@ impl<A> FromIterator<A> for RingBuf<A> {
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<A> Extend<A> for RingBuf<A> { impl<A> Extend<A> for RingBuf<A> {
fn extend<T: Iterator<Item=A>>(&mut self, mut iterator: T) { fn extend<T: Iterator<Item=A>>(&mut self, mut iterator: T) {
for elt in iterator { for elt in iterator {
@ -1618,7 +1618,7 @@ impl<A> Extend<A> for RingBuf<A> {
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<T: fmt::Show> fmt::Show for RingBuf<T> { impl<T: fmt::Show> fmt::Show for RingBuf<T> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
try!(write!(f, "RingBuf [")); try!(write!(f, "RingBuf ["));

View File

@ -86,7 +86,7 @@
//! * Further iterators exist that split, chunk or permute the slice. //! * Further iterators exist that split, chunk or permute the slice.
#![doc(primitive = "slice")] #![doc(primitive = "slice")]
#![stable(feature = "grandfathered", since = "1.0.0")] #![stable(feature = "rust1", since = "1.0.0")]
use alloc::boxed::Box; use alloc::boxed::Box;
use core::borrow::{BorrowFrom, BorrowFromMut, ToOwned}; use core::borrow::{BorrowFrom, BorrowFromMut, ToOwned};
@ -120,9 +120,9 @@ pub use core::slice::{from_raw_buf, from_raw_mut_buf};
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// Allocating extension methods for slices. /// Allocating extension methods for slices.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub trait SliceExt { pub trait SliceExt {
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
type Item; type Item;
/// Sorts the slice, in place, using `compare` to compare /// Sorts the slice, in place, using `compare` to compare
@ -142,7 +142,7 @@ pub trait SliceExt {
/// v.sort_by(|a, b| b.cmp(a)); /// v.sort_by(|a, b| b.cmp(a));
/// assert!(v == [5, 4, 3, 2, 1]); /// assert!(v == [5, 4, 3, 2, 1]);
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn sort_by<F>(&mut self, compare: F) where F: FnMut(&Self::Item, &Self::Item) -> Ordering; fn sort_by<F>(&mut self, compare: F) where F: FnMut(&Self::Item, &Self::Item) -> Ordering;
/// Consumes `src` and moves as many elements as it can into `self` /// Consumes `src` and moves as many elements as it can into `self`
@ -205,23 +205,23 @@ pub trait SliceExt {
/// indices from `[mid, len)` (excluding the index `len` itself). /// indices from `[mid, len)` (excluding the index `len` itself).
/// ///
/// Panics if `mid > len`. /// Panics if `mid > len`.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn split_at(&self, mid: uint) -> (&[Self::Item], &[Self::Item]); fn split_at(&self, mid: uint) -> (&[Self::Item], &[Self::Item]);
/// Returns an iterator over the slice /// Returns an iterator over the slice
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn iter(&self) -> Iter<Self::Item>; fn iter(&self) -> Iter<Self::Item>;
/// Returns an iterator over subslices separated by elements that match /// Returns an iterator over subslices separated by elements that match
/// `pred`. The matched element is not contained in the subslices. /// `pred`. The matched element is not contained in the subslices.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn split<F>(&self, pred: F) -> Split<Self::Item, F> fn split<F>(&self, pred: F) -> Split<Self::Item, F>
where F: FnMut(&Self::Item) -> bool; where F: FnMut(&Self::Item) -> bool;
/// Returns an iterator over subslices separated by elements that match /// Returns an iterator over subslices separated by elements that match
/// `pred`, limited to splitting at most `n` times. The matched element is /// `pred`, limited to splitting at most `n` times. The matched element is
/// not contained in the subslices. /// not contained in the subslices.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn splitn<F>(&self, n: uint, pred: F) -> SplitN<Self::Item, F> fn splitn<F>(&self, n: uint, pred: F) -> SplitN<Self::Item, F>
where F: FnMut(&Self::Item) -> bool; where F: FnMut(&Self::Item) -> bool;
@ -229,7 +229,7 @@ pub trait SliceExt {
/// `pred` limited to splitting at most `n` times. This starts at the end of /// `pred` limited to splitting at most `n` times. This starts at the end of
/// the slice and works backwards. The matched element is not contained in /// the slice and works backwards. The matched element is not contained in
/// the subslices. /// the subslices.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn rsplitn<F>(&self, n: uint, pred: F) -> RSplitN<Self::Item, F> fn rsplitn<F>(&self, n: uint, pred: F) -> RSplitN<Self::Item, F>
where F: FnMut(&Self::Item) -> bool; where F: FnMut(&Self::Item) -> bool;
@ -252,7 +252,7 @@ pub trait SliceExt {
/// println!("{:?}", win); /// println!("{:?}", win);
/// } /// }
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn windows(&self, size: uint) -> Windows<Self::Item>; fn windows(&self, size: uint) -> Windows<Self::Item>;
/// Returns an iterator over `size` elements of the slice at a /// Returns an iterator over `size` elements of the slice at a
@ -275,16 +275,16 @@ pub trait SliceExt {
/// println!("{:?}", win); /// println!("{:?}", win);
/// } /// }
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn chunks(&self, size: uint) -> Chunks<Self::Item>; fn chunks(&self, size: uint) -> Chunks<Self::Item>;
/// Returns the element of a slice at the given index, or `None` if the /// Returns the element of a slice at the given index, or `None` if the
/// index is out of bounds. /// index is out of bounds.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn get(&self, index: uint) -> Option<&Self::Item>; fn get(&self, index: uint) -> Option<&Self::Item>;
/// Returns the first element of a slice, or `None` if it is empty. /// Returns the first element of a slice, or `None` if it is empty.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn first(&self) -> Option<&Self::Item>; fn first(&self) -> Option<&Self::Item>;
/// Returns all but the first element of a slice. /// Returns all but the first element of a slice.
@ -296,12 +296,12 @@ pub trait SliceExt {
fn init(&self) -> &[Self::Item]; fn init(&self) -> &[Self::Item];
/// Returns the last element of a slice, or `None` if it is empty. /// Returns the last element of a slice, or `None` if it is empty.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn last(&self) -> Option<&Self::Item>; fn last(&self) -> Option<&Self::Item>;
/// Returns a pointer to the element at the given index, without doing /// Returns a pointer to the element at the given index, without doing
/// bounds checking. /// bounds checking.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
unsafe fn get_unchecked(&self, index: uint) -> &Self::Item; unsafe fn get_unchecked(&self, index: uint) -> &Self::Item;
/// Returns an unsafe pointer to the slice's buffer /// Returns an unsafe pointer to the slice's buffer
@ -311,7 +311,7 @@ pub trait SliceExt {
/// ///
/// Modifying the slice may cause its buffer to be reallocated, which /// Modifying the slice may cause its buffer to be reallocated, which
/// would also make any pointers to it invalid. /// would also make any pointers to it invalid.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn as_ptr(&self) -> *const Self::Item; fn as_ptr(&self) -> *const Self::Item;
/// Binary search a sorted slice with a comparator function. /// Binary search a sorted slice with a comparator function.
@ -346,7 +346,7 @@ pub trait SliceExt {
/// let r = s.binary_search_by(|probe| probe.cmp(&seek)); /// let r = s.binary_search_by(|probe| probe.cmp(&seek));
/// assert!(match r { Ok(1...4) => true, _ => false, }); /// assert!(match r { Ok(1...4) => true, _ => false, });
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn binary_search_by<F>(&self, f: F) -> Result<uint, uint> where fn binary_search_by<F>(&self, f: F) -> Result<uint, uint> where
F: FnMut(&Self::Item) -> Ordering; F: FnMut(&Self::Item) -> Ordering;
@ -358,7 +358,7 @@ pub trait SliceExt {
/// let a = [1i, 2, 3]; /// let a = [1i, 2, 3];
/// assert_eq!(a.len(), 3); /// assert_eq!(a.len(), 3);
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn len(&self) -> uint; fn len(&self) -> uint;
/// Returns true if the slice has a length of 0 /// Returns true if the slice has a length of 0
@ -370,16 +370,16 @@ pub trait SliceExt {
/// assert!(!a.is_empty()); /// assert!(!a.is_empty());
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn is_empty(&self) -> bool { self.len() == 0 } fn is_empty(&self) -> bool { self.len() == 0 }
/// Returns a mutable reference to the element at the given index, /// Returns a mutable reference to the element at the given index,
/// or `None` if the index is out of bounds /// or `None` if the index is out of bounds
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn get_mut(&mut self, index: uint) -> Option<&mut Self::Item>; fn get_mut(&mut self, index: uint) -> Option<&mut Self::Item>;
/// Work with `self` as a mut slice. /// Work with `self` as a mut slice.
/// Primarily intended for getting a &mut [T] from a [T; N]. /// Primarily intended for getting a &mut [T] from a [T; N].
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn as_mut_slice(&mut self) -> &mut [Self::Item]; fn as_mut_slice(&mut self) -> &mut [Self::Item];
/// Returns a mutable subslice spanning the interval [`start`, `end`). /// Returns a mutable subslice spanning the interval [`start`, `end`).
@ -411,11 +411,11 @@ pub trait SliceExt {
fn slice_to_mut(&mut self, end: uint) -> &mut [Self::Item]; fn slice_to_mut(&mut self, end: uint) -> &mut [Self::Item];
/// Returns an iterator that allows modifying each value /// Returns an iterator that allows modifying each value
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn iter_mut(&mut self) -> IterMut<Self::Item>; fn iter_mut(&mut self) -> IterMut<Self::Item>;
/// Returns a mutable pointer to the first element of a slice, or `None` if it is empty /// Returns a mutable pointer to the first element of a slice, or `None` if it is empty
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn first_mut(&mut self) -> Option<&mut Self::Item>; fn first_mut(&mut self) -> Option<&mut Self::Item>;
/// Returns all but the first element of a mutable slice /// Returns all but the first element of a mutable slice
@ -429,19 +429,19 @@ pub trait SliceExt {
fn init_mut(&mut self) -> &mut [Self::Item]; fn init_mut(&mut self) -> &mut [Self::Item];
/// Returns a mutable pointer to the last item in the slice. /// Returns a mutable pointer to the last item in the slice.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn last_mut(&mut self) -> Option<&mut Self::Item>; fn last_mut(&mut self) -> Option<&mut Self::Item>;
/// Returns an iterator over mutable subslices separated by elements that /// Returns an iterator over mutable subslices separated by elements that
/// match `pred`. The matched element is not contained in the subslices. /// match `pred`. The matched element is not contained in the subslices.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn split_mut<F>(&mut self, pred: F) -> SplitMut<Self::Item, F> fn split_mut<F>(&mut self, pred: F) -> SplitMut<Self::Item, F>
where F: FnMut(&Self::Item) -> bool; where F: FnMut(&Self::Item) -> bool;
/// Returns an iterator over subslices separated by elements that match /// Returns an iterator over subslices separated by elements that match
/// `pred`, limited to splitting at most `n` times. The matched element is /// `pred`, limited to splitting at most `n` times. The matched element is
/// not contained in the subslices. /// not contained in the subslices.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn splitn_mut<F>(&mut self, n: uint, pred: F) -> SplitNMut<Self::Item, F> fn splitn_mut<F>(&mut self, n: uint, pred: F) -> SplitNMut<Self::Item, F>
where F: FnMut(&Self::Item) -> bool; where F: FnMut(&Self::Item) -> bool;
@ -449,7 +449,7 @@ pub trait SliceExt {
/// `pred` limited to splitting at most `n` times. This starts at the end of /// `pred` limited to splitting at most `n` times. This starts at the end of
/// the slice and works backwards. The matched element is not contained in /// the slice and works backwards. The matched element is not contained in
/// the subslices. /// the subslices.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn rsplitn_mut<F>(&mut self, n: uint, pred: F) -> RSplitNMut<Self::Item, F> fn rsplitn_mut<F>(&mut self, n: uint, pred: F) -> RSplitNMut<Self::Item, F>
where F: FnMut(&Self::Item) -> bool; where F: FnMut(&Self::Item) -> bool;
@ -461,7 +461,7 @@ pub trait SliceExt {
/// # Panics /// # Panics
/// ///
/// Panics if `chunk_size` is 0. /// Panics if `chunk_size` is 0.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn chunks_mut(&mut self, chunk_size: uint) -> ChunksMut<Self::Item>; fn chunks_mut(&mut self, chunk_size: uint) -> ChunksMut<Self::Item>;
/// Swaps two elements in a slice. /// Swaps two elements in a slice.
@ -482,7 +482,7 @@ pub trait SliceExt {
/// v.swap(1, 3); /// v.swap(1, 3);
/// assert!(v == ["a", "d", "c", "b"]); /// assert!(v == ["a", "d", "c", "b"]);
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn swap(&mut self, a: uint, b: uint); fn swap(&mut self, a: uint, b: uint);
/// Divides one `&mut` into two at an index. /// Divides one `&mut` into two at an index.
@ -519,7 +519,7 @@ pub trait SliceExt {
/// assert!(right == []); /// assert!(right == []);
/// } /// }
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn split_at_mut(&mut self, mid: uint) -> (&mut [Self::Item], &mut [Self::Item]); fn split_at_mut(&mut self, mid: uint) -> (&mut [Self::Item], &mut [Self::Item]);
/// Reverse the order of elements in a slice, in place. /// Reverse the order of elements in a slice, in place.
@ -531,11 +531,11 @@ pub trait SliceExt {
/// v.reverse(); /// v.reverse();
/// assert!(v == [3i, 2, 1]); /// assert!(v == [3i, 2, 1]);
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn reverse(&mut self); fn reverse(&mut self);
/// Returns an unsafe mutable pointer to the element in index /// Returns an unsafe mutable pointer to the element in index
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
unsafe fn get_unchecked_mut(&mut self, index: uint) -> &mut Self::Item; unsafe fn get_unchecked_mut(&mut self, index: uint) -> &mut Self::Item;
/// Return an unsafe mutable pointer to the slice's buffer. /// Return an unsafe mutable pointer to the slice's buffer.
@ -546,11 +546,11 @@ pub trait SliceExt {
/// Modifying the slice may cause its buffer to be reallocated, which /// Modifying the slice may cause its buffer to be reallocated, which
/// would also make any pointers to it invalid. /// would also make any pointers to it invalid.
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn as_mut_ptr(&mut self) -> *mut Self::Item; fn as_mut_ptr(&mut self) -> *mut Self::Item;
/// Copies `self` into a new `Vec`. /// Copies `self` into a new `Vec`.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn to_vec(&self) -> Vec<Self::Item> where Self::Item: Clone; fn to_vec(&self) -> Vec<Self::Item> where Self::Item: Clone;
/// Creates an iterator that yields every possible permutation of the /// Creates an iterator that yields every possible permutation of the
@ -612,7 +612,7 @@ pub trait SliceExt {
/// v.sort(); /// v.sort();
/// assert!(v == [-5i, -3, 1, 2, 4]); /// assert!(v == [-5i, -3, 1, 2, 4]);
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn sort(&mut self) where Self::Item: Ord; fn sort(&mut self) where Self::Item: Ord;
/// Binary search a sorted slice for a given element. /// Binary search a sorted slice for a given element.
@ -638,7 +638,7 @@ pub trait SliceExt {
/// let r = s.binary_search(&1); /// let r = s.binary_search(&1);
/// assert!(match r { Ok(1...4) => true, _ => false, }); /// assert!(match r { Ok(1...4) => true, _ => false, });
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn binary_search(&self, x: &Self::Item) -> Result<uint, uint> where Self::Item: Ord; fn binary_search(&self, x: &Self::Item) -> Result<uint, uint> where Self::Item: Ord;
/// Deprecated: use `binary_search` instead. /// Deprecated: use `binary_search` instead.
@ -697,15 +697,15 @@ pub trait SliceExt {
fn rposition_elem(&self, t: &Self::Item) -> Option<uint> where Self::Item: PartialEq; fn rposition_elem(&self, t: &Self::Item) -> Option<uint> where Self::Item: PartialEq;
/// Return true if the slice contains an element with the given value. /// Return true if the slice contains an element with the given value.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn contains(&self, x: &Self::Item) -> bool where Self::Item: PartialEq; fn contains(&self, x: &Self::Item) -> bool where Self::Item: PartialEq;
/// Returns true if `needle` is a prefix of the slice. /// Returns true if `needle` is a prefix of the slice.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn starts_with(&self, needle: &[Self::Item]) -> bool where Self::Item: PartialEq; fn starts_with(&self, needle: &[Self::Item]) -> bool where Self::Item: PartialEq;
/// Returns true if `needle` is a suffix of the slice. /// Returns true if `needle` is a suffix of the slice.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn ends_with(&self, needle: &[Self::Item]) -> bool where Self::Item: PartialEq; fn ends_with(&self, needle: &[Self::Item]) -> bool where Self::Item: PartialEq;
/// Convert `self` into a vector without clones or allocation. /// Convert `self` into a vector without clones or allocation.
@ -713,7 +713,7 @@ pub trait SliceExt {
fn into_vec(self: Box<Self>) -> Vec<Self::Item>; fn into_vec(self: Box<Self>) -> Vec<Self::Item>;
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<T> SliceExt for [T] { impl<T> SliceExt for [T] {
type Item = T; type Item = T;
@ -1005,12 +1005,12 @@ impl<T> SliceExt for [T] {
/// An extension trait for concatenating slices /// An extension trait for concatenating slices
pub trait SliceConcatExt<T: ?Sized, U> { pub trait SliceConcatExt<T: ?Sized, U> {
/// Flattens a slice of `T` into a single value `U`. /// Flattens a slice of `T` into a single value `U`.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn concat(&self) -> U; fn concat(&self) -> U;
/// Flattens a slice of `T` into a single value `U`, placing a /// Flattens a slice of `T` into a single value `U`, placing a
/// given separator between each. /// given separator between each.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn connect(&self, sep: &T) -> U; fn connect(&self, sep: &T) -> U;
} }
@ -1104,7 +1104,7 @@ struct SizeDirection {
dir: Direction, dir: Direction,
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl Iterator for ElementSwaps { impl Iterator for ElementSwaps {
type Item = (uint, uint); type Item = (uint, uint);

View File

@ -50,7 +50,7 @@
//! is the same as `&[u8]`. //! is the same as `&[u8]`.
#![doc(primitive = "str")] #![doc(primitive = "str")]
#![stable(feature = "grandfathered", since = "1.0.0")] #![stable(feature = "rust1", since = "1.0.0")]
use self::RecompositionState::*; use self::RecompositionState::*;
use self::DecompositionType::*; use self::DecompositionType::*;
@ -173,7 +173,7 @@ pub struct Decompositions<'a> {
sorted: bool sorted: bool
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a> Iterator for Decompositions<'a> { impl<'a> Iterator for Decompositions<'a> {
type Item = char; type Item = char;
@ -264,7 +264,7 @@ pub struct Recompositions<'a> {
last_ccc: Option<u8> last_ccc: Option<u8>
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a> Iterator for Recompositions<'a> { impl<'a> Iterator for Recompositions<'a> {
type Item = char; type Item = char;
@ -357,7 +357,7 @@ pub struct Utf16Units<'a> {
encoder: Utf16Encoder<Chars<'a>> encoder: Utf16Encoder<Chars<'a>>
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a> Iterator for Utf16Units<'a> { impl<'a> Iterator for Utf16Units<'a> {
type Item = u16; type Item = u16;
@ -407,7 +407,7 @@ Section: Trait implementations
*/ */
/// Any string that can be represented as a slice. /// Any string that can be represented as a slice.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub trait StrExt: Index<FullRange, Output = str> { pub trait StrExt: Index<FullRange, Output = str> {
/// Escapes each char in `s` with `char::escape_default`. /// Escapes each char in `s` with `char::escape_default`.
#[unstable(feature = "collections", #[unstable(feature = "collections",
@ -447,7 +447,7 @@ pub trait StrExt: Index<FullRange, Output = str> {
/// // not found, so no change. /// // not found, so no change.
/// assert_eq!(s.replace("cookie monster", "little lamb"), s); /// assert_eq!(s.replace("cookie monster", "little lamb"), s);
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn replace(&self, from: &str, to: &str) -> String { fn replace(&self, from: &str, to: &str) -> String {
let mut result = String::new(); let mut result = String::new();
let mut last_end = 0; let mut last_end = 0;
@ -529,7 +529,7 @@ pub trait StrExt: Index<FullRange, Output = str> {
/// ```rust /// ```rust
/// assert!("bananas".contains("nana")); /// assert!("bananas".contains("nana"));
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn contains(&self, pat: &str) -> bool { fn contains(&self, pat: &str) -> bool {
core_str::StrExt::contains(&self[], pat) core_str::StrExt::contains(&self[], pat)
} }
@ -560,7 +560,7 @@ pub trait StrExt: Index<FullRange, Output = str> {
/// let v: Vec<char> = "abc åäö".chars().collect(); /// let v: Vec<char> = "abc åäö".chars().collect();
/// assert_eq!(v, vec!['a', 'b', 'c', ' ', 'å', 'ä', 'ö']); /// assert_eq!(v, vec!['a', 'b', 'c', ' ', 'å', 'ä', 'ö']);
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn chars(&self) -> Chars { fn chars(&self) -> Chars {
core_str::StrExt::chars(&self[]) core_str::StrExt::chars(&self[])
} }
@ -573,13 +573,13 @@ pub trait StrExt: Index<FullRange, Output = str> {
/// let v: Vec<u8> = "bors".bytes().collect(); /// let v: Vec<u8> = "bors".bytes().collect();
/// assert_eq!(v, b"bors".to_vec()); /// assert_eq!(v, b"bors".to_vec());
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn bytes(&self) -> Bytes { fn bytes(&self) -> Bytes {
core_str::StrExt::bytes(&self[]) core_str::StrExt::bytes(&self[])
} }
/// An iterator over the characters of `self` and their byte offsets. /// An iterator over the characters of `self` and their byte offsets.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn char_indices(&self) -> CharIndices { fn char_indices(&self) -> CharIndices {
core_str::StrExt::char_indices(&self[]) core_str::StrExt::char_indices(&self[])
} }
@ -602,7 +602,7 @@ pub trait StrExt: Index<FullRange, Output = str> {
/// let v: Vec<&str> = "".split('X').collect(); /// let v: Vec<&str> = "".split('X').collect();
/// assert_eq!(v, vec![""]); /// assert_eq!(v, vec![""]);
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn split<P: CharEq>(&self, pat: P) -> Split<P> { fn split<P: CharEq>(&self, pat: P) -> Split<P> {
core_str::StrExt::split(&self[], pat) core_str::StrExt::split(&self[], pat)
} }
@ -629,7 +629,7 @@ pub trait StrExt: Index<FullRange, Output = str> {
/// let v: Vec<&str> = "".splitn(1, 'X').collect(); /// let v: Vec<&str> = "".splitn(1, 'X').collect();
/// assert_eq!(v, vec![""]); /// assert_eq!(v, vec![""]);
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn splitn<P: CharEq>(&self, count: uint, pat: P) -> SplitN<P> { fn splitn<P: CharEq>(&self, count: uint, pat: P) -> SplitN<P> {
core_str::StrExt::splitn(&self[], count, pat) core_str::StrExt::splitn(&self[], count, pat)
} }
@ -679,7 +679,7 @@ pub trait StrExt: Index<FullRange, Output = str> {
/// let v: Vec<&str> = "lionXXtigerXleopard".rsplitn(2, 'X').collect(); /// let v: Vec<&str> = "lionXXtigerXleopard".rsplitn(2, 'X').collect();
/// assert_eq!(v, vec!["leopard", "tiger", "lionX"]); /// assert_eq!(v, vec!["leopard", "tiger", "lionX"]);
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn rsplitn<P: CharEq>(&self, count: uint, pat: P) -> RSplitN<P> { fn rsplitn<P: CharEq>(&self, count: uint, pat: P) -> RSplitN<P> {
core_str::StrExt::rsplitn(&self[], count, pat) core_str::StrExt::rsplitn(&self[], count, pat)
} }
@ -738,7 +738,7 @@ pub trait StrExt: Index<FullRange, Output = str> {
/// let v: Vec<&str> = four_lines.lines().collect(); /// let v: Vec<&str> = four_lines.lines().collect();
/// assert_eq!(v, vec!["foo", "bar", "", "baz"]); /// assert_eq!(v, vec!["foo", "bar", "", "baz"]);
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn lines(&self) -> Lines { fn lines(&self) -> Lines {
core_str::StrExt::lines(&self[]) core_str::StrExt::lines(&self[])
} }
@ -754,7 +754,7 @@ pub trait StrExt: Index<FullRange, Output = str> {
/// let v: Vec<&str> = four_lines.lines_any().collect(); /// let v: Vec<&str> = four_lines.lines_any().collect();
/// assert_eq!(v, vec!["foo", "bar", "", "baz"]); /// assert_eq!(v, vec!["foo", "bar", "", "baz"]);
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn lines_any(&self) -> LinesAny { fn lines_any(&self) -> LinesAny {
core_str::StrExt::lines_any(&self[]) core_str::StrExt::lines_any(&self[])
} }
@ -859,7 +859,7 @@ pub trait StrExt: Index<FullRange, Output = str> {
/// ///
/// Caller must check both UTF-8 character boundaries and the boundaries of /// Caller must check both UTF-8 character boundaries and the boundaries of
/// the entire slice as well. /// the entire slice as well.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
unsafe fn slice_unchecked(&self, begin: uint, end: uint) -> &str { unsafe fn slice_unchecked(&self, begin: uint, end: uint) -> &str {
core_str::StrExt::slice_unchecked(&self[], begin, end) core_str::StrExt::slice_unchecked(&self[], begin, end)
} }
@ -871,7 +871,7 @@ pub trait StrExt: Index<FullRange, Output = str> {
/// ```rust /// ```rust
/// assert!("banana".starts_with("ba")); /// assert!("banana".starts_with("ba"));
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn starts_with(&self, pat: &str) -> bool { fn starts_with(&self, pat: &str) -> bool {
core_str::StrExt::starts_with(&self[], pat) core_str::StrExt::starts_with(&self[], pat)
} }
@ -883,7 +883,7 @@ pub trait StrExt: Index<FullRange, Output = str> {
/// ```rust /// ```rust
/// assert!("banana".ends_with("nana")); /// assert!("banana".ends_with("nana"));
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn ends_with(&self, pat: &str) -> bool { fn ends_with(&self, pat: &str) -> bool {
core_str::StrExt::ends_with(&self[], pat) core_str::StrExt::ends_with(&self[], pat)
} }
@ -903,7 +903,7 @@ pub trait StrExt: Index<FullRange, Output = str> {
/// assert_eq!("12foo1bar12".trim_matches(x), "foo1bar"); /// assert_eq!("12foo1bar12".trim_matches(x), "foo1bar");
/// assert_eq!("123foo1bar123".trim_matches(|&: c: char| c.is_numeric()), "foo1bar"); /// assert_eq!("123foo1bar123".trim_matches(|&: c: char| c.is_numeric()), "foo1bar");
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn trim_matches<P: CharEq>(&self, pat: P) -> &str { fn trim_matches<P: CharEq>(&self, pat: P) -> &str {
core_str::StrExt::trim_matches(&self[], pat) core_str::StrExt::trim_matches(&self[], pat)
} }
@ -923,7 +923,7 @@ pub trait StrExt: Index<FullRange, Output = str> {
/// assert_eq!("12foo1bar12".trim_left_matches(x), "foo1bar12"); /// assert_eq!("12foo1bar12".trim_left_matches(x), "foo1bar12");
/// assert_eq!("123foo1bar123".trim_left_matches(|&: c: char| c.is_numeric()), "foo1bar123"); /// assert_eq!("123foo1bar123".trim_left_matches(|&: c: char| c.is_numeric()), "foo1bar123");
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn trim_left_matches<P: CharEq>(&self, pat: P) -> &str { fn trim_left_matches<P: CharEq>(&self, pat: P) -> &str {
core_str::StrExt::trim_left_matches(&self[], pat) core_str::StrExt::trim_left_matches(&self[], pat)
} }
@ -943,7 +943,7 @@ pub trait StrExt: Index<FullRange, Output = str> {
/// assert_eq!("12foo1bar12".trim_right_matches(x), "12foo1bar"); /// assert_eq!("12foo1bar12".trim_right_matches(x), "12foo1bar");
/// assert_eq!("123foo1bar123".trim_right_matches(|&: c: char| c.is_numeric()), "123foo1bar"); /// assert_eq!("123foo1bar123".trim_right_matches(|&: c: char| c.is_numeric()), "123foo1bar");
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn trim_right_matches<P: CharEq>(&self, pat: P) -> &str { fn trim_right_matches<P: CharEq>(&self, pat: P) -> &str {
core_str::StrExt::trim_right_matches(&self[], pat) core_str::StrExt::trim_right_matches(&self[], pat)
} }
@ -1092,7 +1092,7 @@ pub trait StrExt: Index<FullRange, Output = str> {
/// ```rust /// ```rust
/// assert_eq!("bors".as_bytes(), b"bors"); /// assert_eq!("bors".as_bytes(), b"bors");
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn as_bytes(&self) -> &[u8] { fn as_bytes(&self) -> &[u8] {
core_str::StrExt::as_bytes(&self[]) core_str::StrExt::as_bytes(&self[])
} }
@ -1120,7 +1120,7 @@ pub trait StrExt: Index<FullRange, Output = str> {
/// let x: &[_] = &['1', '2']; /// let x: &[_] = &['1', '2'];
/// assert_eq!(s.find(x), None); /// assert_eq!(s.find(x), None);
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn find<P: CharEq>(&self, pat: P) -> Option<uint> { fn find<P: CharEq>(&self, pat: P) -> Option<uint> {
core_str::StrExt::find(&self[], pat) core_str::StrExt::find(&self[], pat)
} }
@ -1148,7 +1148,7 @@ pub trait StrExt: Index<FullRange, Output = str> {
/// let x: &[_] = &['1', '2']; /// let x: &[_] = &['1', '2'];
/// assert_eq!(s.rfind(x), None); /// assert_eq!(s.rfind(x), None);
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn rfind<P: CharEq>(&self, pat: P) -> Option<uint> { fn rfind<P: CharEq>(&self, pat: P) -> Option<uint> {
core_str::StrExt::rfind(&self[], pat) core_str::StrExt::rfind(&self[], pat)
} }
@ -1227,7 +1227,7 @@ pub trait StrExt: Index<FullRange, Output = str> {
/// The caller must ensure that the string outlives this pointer, /// The caller must ensure that the string outlives this pointer,
/// and that it is not reallocated (e.g. by pushing to the /// and that it is not reallocated (e.g. by pushing to the
/// string). /// string).
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[inline] #[inline]
fn as_ptr(&self) -> *const u8 { fn as_ptr(&self) -> *const u8 {
core_str::StrExt::as_ptr(&self[]) core_str::StrExt::as_ptr(&self[])
@ -1248,7 +1248,7 @@ pub trait StrExt: Index<FullRange, Output = str> {
/// assert_eq!("foo".len(), 3); /// assert_eq!("foo".len(), 3);
/// assert_eq!("ƒoo".len(), 4); /// assert_eq!("ƒoo".len(), 4);
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[inline] #[inline]
fn len(&self) -> uint { fn len(&self) -> uint {
core_str::StrExt::len(&self[]) core_str::StrExt::len(&self[])
@ -1262,7 +1262,7 @@ pub trait StrExt: Index<FullRange, Output = str> {
/// assert!("".is_empty()); /// assert!("".is_empty());
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn is_empty(&self) -> bool { fn is_empty(&self) -> bool {
core_str::StrExt::is_empty(&self[]) core_str::StrExt::is_empty(&self[])
} }
@ -1334,7 +1334,7 @@ pub trait StrExt: Index<FullRange, Output = str> {
/// let v: Vec<&str> = some_words.words().collect(); /// let v: Vec<&str> = some_words.words().collect();
/// assert_eq!(v, vec!["Mary", "had", "a", "little", "lamb"]); /// assert_eq!(v, vec!["Mary", "had", "a", "little", "lamb"]);
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn words(&self) -> Words { fn words(&self) -> Words {
UnicodeStr::words(&self[]) UnicodeStr::words(&self[])
} }
@ -1355,25 +1355,25 @@ pub trait StrExt: Index<FullRange, Output = str> {
} }
/// Returns a string with leading and trailing whitespace removed. /// Returns a string with leading and trailing whitespace removed.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn trim(&self) -> &str { fn trim(&self) -> &str {
UnicodeStr::trim(&self[]) UnicodeStr::trim(&self[])
} }
/// Returns a string with leading whitespace removed. /// Returns a string with leading whitespace removed.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn trim_left(&self) -> &str { fn trim_left(&self) -> &str {
UnicodeStr::trim_left(&self[]) UnicodeStr::trim_left(&self[])
} }
/// Returns a string with trailing whitespace removed. /// Returns a string with trailing whitespace removed.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn trim_right(&self) -> &str { fn trim_right(&self) -> &str {
UnicodeStr::trim_right(&self[]) UnicodeStr::trim_right(&self[])
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl StrExt for str {} impl StrExt for str {}
#[cfg(test)] #[cfg(test)]

View File

@ -12,7 +12,7 @@
//! An owned, growable string that enforces that its contents are valid UTF-8. //! An owned, growable string that enforces that its contents are valid UTF-8.
#![stable(feature = "grandfathered", since = "1.0.0")] #![stable(feature = "rust1", since = "1.0.0")]
use core::prelude::*; use core::prelude::*;
@ -33,20 +33,20 @@ use vec::{DerefVec, Vec, as_vec};
/// A growable string stored as a UTF-8 encoded buffer. /// A growable string stored as a UTF-8 encoded buffer.
#[derive(Clone, PartialOrd, Eq, Ord)] #[derive(Clone, PartialOrd, Eq, Ord)]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub struct String { pub struct String {
vec: Vec<u8>, vec: Vec<u8>,
} }
/// A possible error value from the `String::from_utf8` function. /// A possible error value from the `String::from_utf8` function.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub struct FromUtf8Error { pub struct FromUtf8Error {
bytes: Vec<u8>, bytes: Vec<u8>,
error: Utf8Error, error: Utf8Error,
} }
/// A possible error value from the `String::from_utf16` function. /// A possible error value from the `String::from_utf16` function.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[allow(missing_copy_implementations)] #[allow(missing_copy_implementations)]
pub struct FromUtf16Error(()); pub struct FromUtf16Error(());
@ -59,7 +59,7 @@ impl String {
/// let mut s = String::new(); /// let mut s = String::new();
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn new() -> String { pub fn new() -> String {
String { String {
vec: Vec::new(), vec: Vec::new(),
@ -76,7 +76,7 @@ impl String {
/// let mut s = String::with_capacity(10); /// let mut s = String::with_capacity(10);
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn with_capacity(capacity: uint) -> String { pub fn with_capacity(capacity: uint) -> String {
String { String {
vec: Vec::with_capacity(capacity), vec: Vec::with_capacity(capacity),
@ -121,7 +121,7 @@ impl String {
/// assert_eq!(s.into_bytes(), vec![240, 144, 128]); /// assert_eq!(s.into_bytes(), vec![240, 144, 128]);
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn from_utf8(vec: Vec<u8>) -> Result<String, FromUtf8Error> { pub fn from_utf8(vec: Vec<u8>) -> Result<String, FromUtf8Error> {
match str::from_utf8(vec.as_slice()) { match str::from_utf8(vec.as_slice()) {
Ok(..) => Ok(String { vec: vec }), Ok(..) => Ok(String { vec: vec }),
@ -139,7 +139,7 @@ impl String {
/// let output = String::from_utf8_lossy(input); /// let output = String::from_utf8_lossy(input);
/// assert_eq!(output.as_slice(), "Hello \u{FFFD}World"); /// assert_eq!(output.as_slice(), "Hello \u{FFFD}World");
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn from_utf8_lossy<'a>(v: &'a [u8]) -> CowString<'a> { pub fn from_utf8_lossy<'a>(v: &'a [u8]) -> CowString<'a> {
let mut i = 0; let mut i = 0;
match str::from_utf8(v) { match str::from_utf8(v) {
@ -277,7 +277,7 @@ impl String {
/// v[4] = 0xD800; /// v[4] = 0xD800;
/// assert!(String::from_utf16(v).is_err()); /// assert!(String::from_utf16(v).is_err());
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn from_utf16(v: &[u16]) -> Result<String, FromUtf16Error> { pub fn from_utf16(v: &[u16]) -> Result<String, FromUtf16Error> {
let mut s = String::with_capacity(v.len()); let mut s = String::with_capacity(v.len());
for c in unicode_str::utf16_items(v) { for c in unicode_str::utf16_items(v) {
@ -304,7 +304,7 @@ impl String {
/// "𝄞mus\u{FFFD}ic\u{FFFD}".to_string()); /// "𝄞mus\u{FFFD}ic\u{FFFD}".to_string());
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn from_utf16_lossy(v: &[u16]) -> String { pub fn from_utf16_lossy(v: &[u16]) -> String {
unicode_str::utf16_items(v).map(|c| c.to_char_lossy()).collect() unicode_str::utf16_items(v).map(|c| c.to_char_lossy()).collect()
} }
@ -315,7 +315,7 @@ impl String {
/// * We call `Vec::from_raw_parts` to get a `Vec<u8>`; /// * We call `Vec::from_raw_parts` to get a `Vec<u8>`;
/// * We assume that the `Vec` contains valid UTF-8. /// * We assume that the `Vec` contains valid UTF-8.
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub unsafe fn from_raw_parts(buf: *mut u8, length: uint, capacity: uint) -> String { pub unsafe fn from_raw_parts(buf: *mut u8, length: uint, capacity: uint) -> String {
String { String {
vec: Vec::from_raw_parts(buf, length, capacity), vec: Vec::from_raw_parts(buf, length, capacity),
@ -326,7 +326,7 @@ impl String {
/// it contains valid UTF-8. This is unsafe because it assumes that /// it contains valid UTF-8. This is unsafe because it assumes that
/// the UTF-8-ness of the vector has already been validated. /// the UTF-8-ness of the vector has already been validated.
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub unsafe fn from_utf8_unchecked(bytes: Vec<u8>) -> String { pub unsafe fn from_utf8_unchecked(bytes: Vec<u8>) -> String {
String { vec: bytes } String { vec: bytes }
} }
@ -341,7 +341,7 @@ impl String {
/// assert_eq!(bytes, vec![104, 101, 108, 108, 111]); /// assert_eq!(bytes, vec![104, 101, 108, 108, 111]);
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn into_bytes(self) -> Vec<u8> { pub fn into_bytes(self) -> Vec<u8> {
self.vec self.vec
} }
@ -356,7 +356,7 @@ impl String {
/// assert_eq!(s.as_slice(), "foobar"); /// assert_eq!(s.as_slice(), "foobar");
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn push_str(&mut self, string: &str) { pub fn push_str(&mut self, string: &str) {
self.vec.push_all(string.as_bytes()) self.vec.push_all(string.as_bytes())
} }
@ -371,7 +371,7 @@ impl String {
/// assert!(s.capacity() >= 10); /// assert!(s.capacity() >= 10);
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn capacity(&self) -> uint { pub fn capacity(&self) -> uint {
self.vec.capacity() self.vec.capacity()
} }
@ -392,7 +392,7 @@ impl String {
/// assert!(s.capacity() >= 10); /// assert!(s.capacity() >= 10);
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn reserve(&mut self, additional: uint) { pub fn reserve(&mut self, additional: uint) {
self.vec.reserve(additional) self.vec.reserve(additional)
} }
@ -417,7 +417,7 @@ impl String {
/// assert!(s.capacity() >= 10); /// assert!(s.capacity() >= 10);
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn reserve_exact(&mut self, additional: uint) { pub fn reserve_exact(&mut self, additional: uint) {
self.vec.reserve_exact(additional) self.vec.reserve_exact(additional)
} }
@ -434,7 +434,7 @@ impl String {
/// assert_eq!(s.capacity(), 3); /// assert_eq!(s.capacity(), 3);
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn shrink_to_fit(&mut self) { pub fn shrink_to_fit(&mut self) {
self.vec.shrink_to_fit() self.vec.shrink_to_fit()
} }
@ -451,7 +451,7 @@ impl String {
/// assert_eq!(s.as_slice(), "abc123"); /// assert_eq!(s.as_slice(), "abc123");
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn push(&mut self, ch: char) { pub fn push(&mut self, ch: char) {
if (ch as u32) < 0x80 { if (ch as u32) < 0x80 {
self.vec.push(ch as u8); self.vec.push(ch as u8);
@ -484,7 +484,7 @@ impl String {
/// assert_eq!(s.as_bytes(), b); /// assert_eq!(s.as_bytes(), b);
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn as_bytes<'a>(&'a self) -> &'a [u8] { pub fn as_bytes<'a>(&'a self) -> &'a [u8] {
self.vec.as_slice() self.vec.as_slice()
} }
@ -504,7 +504,7 @@ impl String {
/// assert_eq!(s.as_slice(), "he"); /// assert_eq!(s.as_slice(), "he");
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn truncate(&mut self, new_len: uint) { pub fn truncate(&mut self, new_len: uint) {
assert!(self.is_char_boundary(new_len)); assert!(self.is_char_boundary(new_len));
self.vec.truncate(new_len) self.vec.truncate(new_len)
@ -523,7 +523,7 @@ impl String {
/// assert_eq!(s.pop(), None); /// assert_eq!(s.pop(), None);
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn pop(&mut self) -> Option<char> { pub fn pop(&mut self) -> Option<char> {
let len = self.len(); let len = self.len();
if len == 0 { if len == 0 {
@ -559,7 +559,7 @@ impl String {
/// assert_eq!(s.remove(0), 'o'); /// assert_eq!(s.remove(0), 'o');
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn remove(&mut self, idx: uint) -> char { pub fn remove(&mut self, idx: uint) -> char {
let len = self.len(); let len = self.len();
assert!(idx <= len); assert!(idx <= len);
@ -586,7 +586,7 @@ impl String {
/// If `idx` does not lie on a character boundary or is out of bounds, then /// If `idx` does not lie on a character boundary or is out of bounds, then
/// this function will panic. /// this function will panic.
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn insert(&mut self, idx: uint, ch: char) { pub fn insert(&mut self, idx: uint, ch: char) {
let len = self.len(); let len = self.len();
assert!(idx <= len); assert!(idx <= len);
@ -623,7 +623,7 @@ impl String {
/// assert_eq!(s.as_slice(), "olleh"); /// assert_eq!(s.as_slice(), "olleh");
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub unsafe fn as_mut_vec<'a>(&'a mut self) -> &'a mut Vec<u8> { pub unsafe fn as_mut_vec<'a>(&'a mut self) -> &'a mut Vec<u8> {
&mut self.vec &mut self.vec
} }
@ -637,7 +637,7 @@ impl String {
/// assert_eq!(a.len(), 3); /// assert_eq!(a.len(), 3);
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn len(&self) -> uint { self.vec.len() } pub fn len(&self) -> uint { self.vec.len() }
/// Returns true if the string contains no bytes /// Returns true if the string contains no bytes
@ -651,7 +651,7 @@ impl String {
/// assert!(!v.is_empty()); /// assert!(!v.is_empty());
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn is_empty(&self) -> bool { self.len() == 0 } pub fn is_empty(&self) -> bool { self.len() == 0 }
/// Truncates the string, returning it to 0 length. /// Truncates the string, returning it to 0 length.
@ -664,7 +664,7 @@ impl String {
/// assert!(s.is_empty()); /// assert!(s.is_empty());
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn clear(&mut self) { pub fn clear(&mut self) {
self.vec.clear() self.vec.clear()
} }
@ -673,11 +673,11 @@ impl String {
impl FromUtf8Error { impl FromUtf8Error {
/// Consume this error, returning the bytes that were attempted to make a /// Consume this error, returning the bytes that were attempted to make a
/// `String` with. /// `String` with.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn into_bytes(self) -> Vec<u8> { self.bytes } pub fn into_bytes(self) -> Vec<u8> { self.bytes }
/// Access the underlying UTF8-error that was the cause of this error. /// Access the underlying UTF8-error that was the cause of this error.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn utf8_error(&self) -> Utf8Error { self.error } pub fn utf8_error(&self) -> Utf8Error { self.error }
} }
@ -687,7 +687,7 @@ impl fmt::Show for FromUtf8Error {
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl fmt::String for FromUtf8Error { impl fmt::String for FromUtf8Error {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fmt::String::fmt(&self.error, f) fmt::String::fmt(&self.error, f)
@ -700,14 +700,14 @@ impl fmt::Show for FromUtf16Error {
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl fmt::String for FromUtf16Error { impl fmt::String for FromUtf16Error {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fmt::String::fmt("invalid utf-16: lone surrogate found", f) fmt::String::fmt("invalid utf-16: lone surrogate found", f)
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl FromIterator<char> for String { impl FromIterator<char> for String {
fn from_iter<I:Iterator<Item=char>>(iterator: I) -> String { fn from_iter<I:Iterator<Item=char>>(iterator: I) -> String {
let mut buf = String::new(); let mut buf = String::new();
@ -716,7 +716,7 @@ impl FromIterator<char> for String {
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a> FromIterator<&'a str> for String { impl<'a> FromIterator<&'a str> for String {
fn from_iter<I:Iterator<Item=&'a str>>(iterator: I) -> String { fn from_iter<I:Iterator<Item=&'a str>>(iterator: I) -> String {
let mut buf = String::new(); let mut buf = String::new();
@ -750,7 +750,7 @@ impl<'a> Extend<&'a str> for String {
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl PartialEq for String { impl PartialEq for String {
#[inline] #[inline]
fn eq(&self, other: &String) -> bool { PartialEq::eq(&**self, &**other) } fn eq(&self, other: &String) -> bool { PartialEq::eq(&**self, &**other) }
@ -760,7 +760,7 @@ impl PartialEq for String {
macro_rules! impl_eq { macro_rules! impl_eq {
($lhs:ty, $rhs: ty) => { ($lhs:ty, $rhs: ty) => {
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a> PartialEq<$rhs> for $lhs { impl<'a> PartialEq<$rhs> for $lhs {
#[inline] #[inline]
fn eq(&self, other: &$rhs) -> bool { PartialEq::eq(&**self, &**other) } fn eq(&self, other: &$rhs) -> bool { PartialEq::eq(&**self, &**other) }
@ -768,7 +768,7 @@ macro_rules! impl_eq {
fn ne(&self, other: &$rhs) -> bool { PartialEq::ne(&**self, &**other) } fn ne(&self, other: &$rhs) -> bool { PartialEq::ne(&**self, &**other) }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a> PartialEq<$lhs> for $rhs { impl<'a> PartialEq<$lhs> for $rhs {
#[inline] #[inline]
fn eq(&self, other: &$lhs) -> bool { PartialEq::eq(&**self, &**other) } fn eq(&self, other: &$lhs) -> bool { PartialEq::eq(&**self, &**other) }
@ -782,7 +782,7 @@ macro_rules! impl_eq {
impl_eq! { String, &'a str } impl_eq! { String, &'a str }
impl_eq! { CowString<'a>, String } impl_eq! { CowString<'a>, String }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a, 'b> PartialEq<&'b str> for CowString<'a> { impl<'a, 'b> PartialEq<&'b str> for CowString<'a> {
#[inline] #[inline]
fn eq(&self, other: &&'b str) -> bool { PartialEq::eq(&**self, &**other) } fn eq(&self, other: &&'b str) -> bool { PartialEq::eq(&**self, &**other) }
@ -790,7 +790,7 @@ impl<'a, 'b> PartialEq<&'b str> for CowString<'a> {
fn ne(&self, other: &&'b str) -> bool { PartialEq::ne(&**self, &**other) } fn ne(&self, other: &&'b str) -> bool { PartialEq::ne(&**self, &**other) }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a, 'b> PartialEq<CowString<'a>> for &'b str { impl<'a, 'b> PartialEq<CowString<'a>> for &'b str {
#[inline] #[inline]
fn eq(&self, other: &CowString<'a>) -> bool { PartialEq::eq(&**self, &**other) } fn eq(&self, other: &CowString<'a>) -> bool { PartialEq::eq(&**self, &**other) }
@ -801,22 +801,22 @@ impl<'a, 'b> PartialEq<CowString<'a>> for &'b str {
#[unstable(feature = "collections", reason = "waiting on Str stabilization")] #[unstable(feature = "collections", reason = "waiting on Str stabilization")]
impl Str for String { impl Str for String {
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn as_slice<'a>(&'a self) -> &'a str { fn as_slice<'a>(&'a self) -> &'a str {
unsafe { mem::transmute(self.vec.as_slice()) } unsafe { mem::transmute(self.vec.as_slice()) }
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl Default for String { impl Default for String {
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn default() -> String { fn default() -> String {
String::new() String::new()
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl fmt::String for String { impl fmt::String for String {
#[inline] #[inline]
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
@ -881,7 +881,7 @@ impl ops::Index<ops::FullRange> for String {
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl ops::Deref for String { impl ops::Deref for String {
type Target = str; type Target = str;
@ -964,7 +964,7 @@ impl<'a> IntoCow<'a, String, str> for &'a str {
} }
/// A clone-on-write string /// A clone-on-write string
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub type CowString<'a> = Cow<'a, String, str>; pub type CowString<'a> = Cow<'a, String, str>;
impl<'a> Str for CowString<'a> { impl<'a> Str for CowString<'a> {

View File

@ -44,7 +44,7 @@
//! let two = xs.pop(); //! let two = xs.pop();
//! ``` //! ```
#![stable(feature = "grandfathered", since = "1.0.0")] #![stable(feature = "rust1", since = "1.0.0")]
use core::prelude::*; use core::prelude::*;
@ -134,7 +134,7 @@ use core::uint;
/// to reallocate, which can be slow. For this reason, it is recommended to use /// to reallocate, which can be slow. For this reason, it is recommended to use
/// `Vec::with_capacity` whenever possible to specify how big the vector is expected to get. /// `Vec::with_capacity` whenever possible to specify how big the vector is expected to get.
#[unsafe_no_drop_flag] #[unsafe_no_drop_flag]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub struct Vec<T> { pub struct Vec<T> {
ptr: NonZero<*mut T>, ptr: NonZero<*mut T>,
len: uint, len: uint,
@ -159,7 +159,7 @@ impl<T> Vec<T> {
/// let mut vec: Vec<int> = Vec::new(); /// let mut vec: Vec<int> = Vec::new();
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn new() -> Vec<T> { pub fn new() -> Vec<T> {
// We want ptr to never be NULL so instead we set it to some arbitrary // We want ptr to never be NULL so instead we set it to some arbitrary
// non-null value which is fine since we never call deallocate on the ptr // non-null value which is fine since we never call deallocate on the ptr
@ -194,7 +194,7 @@ impl<T> Vec<T> {
/// vec.push(11); /// vec.push(11);
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn with_capacity(capacity: uint) -> Vec<T> { pub fn with_capacity(capacity: uint) -> Vec<T> {
if mem::size_of::<T>() == 0 { if mem::size_of::<T>() == 0 {
Vec { ptr: unsafe { NonZero::new(EMPTY as *mut T) }, len: 0, cap: uint::MAX } Vec { ptr: unsafe { NonZero::new(EMPTY as *mut T) }, len: 0, cap: uint::MAX }
@ -243,7 +243,7 @@ impl<T> Vec<T> {
/// } /// }
/// } /// }
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub unsafe fn from_raw_parts(ptr: *mut T, length: uint, pub unsafe fn from_raw_parts(ptr: *mut T, length: uint,
capacity: uint) -> Vec<T> { capacity: uint) -> Vec<T> {
Vec { ptr: NonZero::new(ptr), len: length, cap: capacity } Vec { ptr: NonZero::new(ptr), len: length, cap: capacity }
@ -274,7 +274,7 @@ impl<T> Vec<T> {
/// assert_eq!(vec.capacity(), 10); /// assert_eq!(vec.capacity(), 10);
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn capacity(&self) -> uint { pub fn capacity(&self) -> uint {
self.cap self.cap
} }
@ -293,7 +293,7 @@ impl<T> Vec<T> {
/// vec.reserve(10); /// vec.reserve(10);
/// assert!(vec.capacity() >= 11); /// assert!(vec.capacity() >= 11);
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn reserve(&mut self, additional: uint) { pub fn reserve(&mut self, additional: uint) {
if self.cap - self.len < additional { if self.cap - self.len < additional {
let err_msg = "Vec::reserve: `uint` overflow"; let err_msg = "Vec::reserve: `uint` overflow";
@ -322,7 +322,7 @@ impl<T> Vec<T> {
/// vec.reserve_exact(10); /// vec.reserve_exact(10);
/// assert!(vec.capacity() >= 11); /// assert!(vec.capacity() >= 11);
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn reserve_exact(&mut self, additional: uint) { pub fn reserve_exact(&mut self, additional: uint) {
if self.cap - self.len < additional { if self.cap - self.len < additional {
match self.len.checked_add(additional) { match self.len.checked_add(additional) {
@ -346,7 +346,7 @@ impl<T> Vec<T> {
/// vec.shrink_to_fit(); /// vec.shrink_to_fit();
/// assert!(vec.capacity() >= 3); /// assert!(vec.capacity() >= 3);
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn shrink_to_fit(&mut self) { pub fn shrink_to_fit(&mut self) {
if mem::size_of::<T>() == 0 { return } if mem::size_of::<T>() == 0 { return }
@ -399,7 +399,7 @@ impl<T> Vec<T> {
/// vec.truncate(2); /// vec.truncate(2);
/// assert_eq!(vec, vec![1, 2]); /// assert_eq!(vec, vec![1, 2]);
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn truncate(&mut self, len: uint) { pub fn truncate(&mut self, len: uint) {
unsafe { unsafe {
// drop any extra elements // drop any extra elements
@ -423,7 +423,7 @@ impl<T> Vec<T> {
/// foo(vec.as_mut_slice()); /// foo(vec.as_mut_slice());
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn as_mut_slice<'a>(&'a mut self) -> &'a mut [T] { pub fn as_mut_slice<'a>(&'a mut self) -> &'a mut [T] {
unsafe { unsafe {
mem::transmute(RawSlice { mem::transmute(RawSlice {
@ -447,7 +447,7 @@ impl<T> Vec<T> {
/// } /// }
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn into_iter(self) -> IntoIter<T> { pub fn into_iter(self) -> IntoIter<T> {
unsafe { unsafe {
let ptr = *self.ptr; let ptr = *self.ptr;
@ -478,7 +478,7 @@ impl<T> Vec<T> {
/// } /// }
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub unsafe fn set_len(&mut self, len: uint) { pub unsafe fn set_len(&mut self, len: uint) {
self.len = len; self.len = len;
} }
@ -504,7 +504,7 @@ impl<T> Vec<T> {
/// assert_eq!(v, vec!["baz", "qux"]); /// assert_eq!(v, vec!["baz", "qux"]);
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn swap_remove(&mut self, index: uint) -> T { pub fn swap_remove(&mut self, index: uint) -> T {
let length = self.len(); let length = self.len();
self.swap(index, length - 1); self.swap(index, length - 1);
@ -528,7 +528,7 @@ impl<T> Vec<T> {
/// vec.insert(4, 5); /// vec.insert(4, 5);
/// assert_eq!(vec, vec![1, 4, 2, 3, 5]); /// assert_eq!(vec, vec![1, 4, 2, 3, 5]);
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn insert(&mut self, index: uint, element: T) { pub fn insert(&mut self, index: uint, element: T) {
let len = self.len(); let len = self.len();
assert!(index <= len); assert!(index <= len);
@ -564,7 +564,7 @@ impl<T> Vec<T> {
/// assert_eq!(v.remove(1), 2); /// assert_eq!(v.remove(1), 2);
/// assert_eq!(v, vec![1, 3]); /// assert_eq!(v, vec![1, 3]);
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn remove(&mut self, index: uint) -> T { pub fn remove(&mut self, index: uint) -> T {
let len = self.len(); let len = self.len();
assert!(index < len); assert!(index < len);
@ -598,7 +598,7 @@ impl<T> Vec<T> {
/// vec.retain(|&x| x%2 == 0); /// vec.retain(|&x| x%2 == 0);
/// assert_eq!(vec, vec![2, 4]); /// assert_eq!(vec, vec![2, 4]);
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn retain<F>(&mut self, mut f: F) where F: FnMut(&T) -> bool { pub fn retain<F>(&mut self, mut f: F) where F: FnMut(&T) -> bool {
let len = self.len(); let len = self.len();
let mut del = 0u; let mut del = 0u;
@ -632,7 +632,7 @@ impl<T> Vec<T> {
/// assert_eq!(vec, vec!(1, 2, 3)); /// assert_eq!(vec, vec!(1, 2, 3));
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn push(&mut self, value: T) { pub fn push(&mut self, value: T) {
if mem::size_of::<T>() == 0 { if mem::size_of::<T>() == 0 {
// zero-size types consume no memory, so we can't rely on the // zero-size types consume no memory, so we can't rely on the
@ -670,7 +670,7 @@ impl<T> Vec<T> {
/// assert_eq!(vec, vec![1, 2]); /// assert_eq!(vec, vec![1, 2]);
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn pop(&mut self) -> Option<T> { pub fn pop(&mut self) -> Option<T> {
if self.len == 0 { if self.len == 0 {
None None
@ -765,7 +765,7 @@ impl<T> Vec<T> {
/// assert!(v.is_empty()); /// assert!(v.is_empty());
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn clear(&mut self) { pub fn clear(&mut self) {
self.truncate(0) self.truncate(0)
} }
@ -779,7 +779,7 @@ impl<T> Vec<T> {
/// assert_eq!(a.len(), 3); /// assert_eq!(a.len(), 3);
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn len(&self) -> uint { self.len } pub fn len(&self) -> uint { self.len }
/// Returns `true` if the vector contains no elements. /// Returns `true` if the vector contains no elements.
@ -793,7 +793,7 @@ impl<T> Vec<T> {
/// v.push(1i); /// v.push(1i);
/// assert!(!v.is_empty()); /// assert!(!v.is_empty());
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn is_empty(&self) -> bool { self.len() == 0 } pub fn is_empty(&self) -> bool { self.len() == 0 }
/// Converts a `Vec<T>` to a `Vec<U>` where `T` and `U` have the same /// Converts a `Vec<T>` to a `Vec<U>` where `T` and `U` have the same
@ -1072,7 +1072,7 @@ impl<T: PartialEq> Vec<T> {
/// ///
/// assert_eq!(vec, vec![1i, 2, 3, 2]); /// assert_eq!(vec, vec![1i, 2, 3, 2]);
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn dedup(&mut self) { pub fn dedup(&mut self) {
unsafe { unsafe {
// Although we have a mutable reference to `self`, we cannot make // Although we have a mutable reference to `self`, we cannot make
@ -1314,19 +1314,19 @@ impl<T> ops::IndexMut<ops::FullRange> for Vec<T> {
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<T> ops::Deref for Vec<T> { impl<T> ops::Deref for Vec<T> {
type Target = [T]; type Target = [T];
fn deref<'a>(&'a self) -> &'a [T] { self.as_slice() } fn deref<'a>(&'a self) -> &'a [T] { self.as_slice() }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<T> ops::DerefMut for Vec<T> { impl<T> ops::DerefMut for Vec<T> {
fn deref_mut<'a>(&'a mut self) -> &'a mut [T] { self.as_mut_slice() } fn deref_mut<'a>(&'a mut self) -> &'a mut [T] { self.as_mut_slice() }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<T> FromIterator<T> for Vec<T> { impl<T> FromIterator<T> for Vec<T> {
#[inline] #[inline]
fn from_iter<I:Iterator<Item=T>>(mut iterator: I) -> Vec<T> { fn from_iter<I:Iterator<Item=T>>(mut iterator: I) -> Vec<T> {
@ -1446,7 +1446,7 @@ impl<T> AsSlice<T> for Vec<T> {
/// foo(vec.as_slice()); /// foo(vec.as_slice());
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn as_slice<'a>(&'a self) -> &'a [T] { fn as_slice<'a>(&'a self) -> &'a [T] {
unsafe { unsafe {
mem::transmute(RawSlice { mem::transmute(RawSlice {
@ -1470,7 +1470,7 @@ impl<'a, T: Clone> Add<&'a [T]> for Vec<T> {
} }
#[unsafe_destructor] #[unsafe_destructor]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<T> Drop for Vec<T> { impl<T> Drop for Vec<T> {
fn drop(&mut self) { fn drop(&mut self) {
// This is (and should always remain) a no-op if the fields are // This is (and should always remain) a no-op if the fields are
@ -1486,9 +1486,9 @@ impl<T> Drop for Vec<T> {
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<T> Default for Vec<T> { impl<T> Default for Vec<T> {
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn default() -> Vec<T> { fn default() -> Vec<T> {
Vec::new() Vec::new()
} }
@ -1541,7 +1541,7 @@ impl<'a, T> IntoCow<'a, Vec<T>, [T]> for &'a [T] where T: Clone {
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// An iterator that moves out of a vector. /// An iterator that moves out of a vector.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub struct IntoIter<T> { pub struct IntoIter<T> {
allocation: *mut T, // the block of memory allocated for the vector allocation: *mut T, // the block of memory allocated for the vector
cap: uint, // the capacity of the vector cap: uint, // the capacity of the vector
@ -1566,7 +1566,7 @@ impl<T> IntoIter<T> {
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<T> Iterator for IntoIter<T> { impl<T> Iterator for IntoIter<T> {
type Item = T; type Item = T;
@ -1603,7 +1603,7 @@ impl<T> Iterator for IntoIter<T> {
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<T> DoubleEndedIterator for IntoIter<T> { impl<T> DoubleEndedIterator for IntoIter<T> {
#[inline] #[inline]
fn next_back<'a>(&'a mut self) -> Option<T> { fn next_back<'a>(&'a mut self) -> Option<T> {
@ -1627,11 +1627,11 @@ impl<T> DoubleEndedIterator for IntoIter<T> {
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<T> ExactSizeIterator for IntoIter<T> {} impl<T> ExactSizeIterator for IntoIter<T> {}
#[unsafe_destructor] #[unsafe_destructor]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<T> Drop for IntoIter<T> { impl<T> Drop for IntoIter<T> {
fn drop(&mut self) { fn drop(&mut self) {
// destroy the remaining elements // destroy the remaining elements
@ -1654,7 +1654,7 @@ pub struct Drain<'a, T> {
marker: ContravariantLifetime<'a>, marker: ContravariantLifetime<'a>,
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a, T> Iterator for Drain<'a, T> { impl<'a, T> Iterator for Drain<'a, T> {
type Item = T; type Item = T;
@ -1691,7 +1691,7 @@ impl<'a, T> Iterator for Drain<'a, T> {
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a, T> DoubleEndedIterator for Drain<'a, T> { impl<'a, T> DoubleEndedIterator for Drain<'a, T> {
#[inline] #[inline]
fn next_back(&mut self) -> Option<T> { fn next_back(&mut self) -> Option<T> {
@ -1715,11 +1715,11 @@ impl<'a, T> DoubleEndedIterator for Drain<'a, T> {
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a, T> ExactSizeIterator for Drain<'a, T> {} impl<'a, T> ExactSizeIterator for Drain<'a, T> {}
#[unsafe_destructor] #[unsafe_destructor]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a, T> Drop for Drain<'a, T> { impl<'a, T> Drop for Drain<'a, T> {
fn drop(&mut self) { fn drop(&mut self) {
// self.ptr == self.end == null if drop has already been called, // self.ptr == self.end == null if drop has already been called,
@ -1752,7 +1752,7 @@ impl<'a, T> Deref for DerefVec<'a, T> {
// Prevent the inner `Vec<T>` from attempting to deallocate memory. // Prevent the inner `Vec<T>` from attempting to deallocate memory.
#[unsafe_destructor] #[unsafe_destructor]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a, T> Drop for DerefVec<'a, T> { impl<'a, T> Drop for DerefVec<'a, T> {
fn drop(&mut self) { fn drop(&mut self) {
self.x.len = 0; self.x.len = 0;

View File

@ -66,9 +66,9 @@ pub struct VecMap<V> {
v: Vec<Option<V>>, v: Vec<Option<V>>,
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<V> Default for VecMap<V> { impl<V> Default for VecMap<V> {
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[inline] #[inline]
fn default() -> VecMap<V> { VecMap::new() } fn default() -> VecMap<V> { VecMap::new() }
} }
@ -107,7 +107,7 @@ impl<V> VecMap<V> {
/// use std::collections::VecMap; /// use std::collections::VecMap;
/// let mut map: VecMap<&str> = VecMap::new(); /// let mut map: VecMap<&str> = VecMap::new();
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn new() -> VecMap<V> { VecMap { v: vec![] } } pub fn new() -> VecMap<V> { VecMap { v: vec![] } }
/// Creates an empty `VecMap` with space for at least `capacity` /// Creates an empty `VecMap` with space for at least `capacity`
@ -119,7 +119,7 @@ impl<V> VecMap<V> {
/// use std::collections::VecMap; /// use std::collections::VecMap;
/// let mut map: VecMap<&str> = VecMap::with_capacity(10); /// let mut map: VecMap<&str> = VecMap::with_capacity(10);
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn with_capacity(capacity: uint) -> VecMap<V> { pub fn with_capacity(capacity: uint) -> VecMap<V> {
VecMap { v: Vec::with_capacity(capacity) } VecMap { v: Vec::with_capacity(capacity) }
} }
@ -135,7 +135,7 @@ impl<V> VecMap<V> {
/// assert!(map.capacity() >= 10); /// assert!(map.capacity() >= 10);
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn capacity(&self) -> uint { pub fn capacity(&self) -> uint {
self.v.capacity() self.v.capacity()
} }
@ -154,7 +154,7 @@ impl<V> VecMap<V> {
/// map.reserve_len(10); /// map.reserve_len(10);
/// assert!(map.capacity() >= 10); /// assert!(map.capacity() >= 10);
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn reserve_len(&mut self, len: uint) { pub fn reserve_len(&mut self, len: uint) {
let cur_len = self.v.len(); let cur_len = self.v.len();
if len >= cur_len { if len >= cur_len {
@ -178,7 +178,7 @@ impl<V> VecMap<V> {
/// map.reserve_len_exact(10); /// map.reserve_len_exact(10);
/// assert!(map.capacity() >= 10); /// assert!(map.capacity() >= 10);
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn reserve_len_exact(&mut self, len: uint) { pub fn reserve_len_exact(&mut self, len: uint) {
let cur_len = self.v.len(); let cur_len = self.v.len();
if len >= cur_len { if len >= cur_len {
@ -188,7 +188,7 @@ impl<V> VecMap<V> {
/// Returns an iterator visiting all keys in ascending order of the keys. /// Returns an iterator visiting all keys in ascending order of the keys.
/// The iterator's element type is `uint`. /// The iterator's element type is `uint`.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn keys<'r>(&'r self) -> Keys<'r, V> { pub fn keys<'r>(&'r self) -> Keys<'r, V> {
fn first<A, B>((a, _): (A, B)) -> A { a } fn first<A, B>((a, _): (A, B)) -> A { a }
let first: fn((uint, &'r V)) -> uint = first; // coerce to fn pointer let first: fn((uint, &'r V)) -> uint = first; // coerce to fn pointer
@ -198,7 +198,7 @@ impl<V> VecMap<V> {
/// Returns an iterator visiting all values in ascending order of the keys. /// Returns an iterator visiting all values in ascending order of the keys.
/// The iterator's element type is `&'r V`. /// The iterator's element type is `&'r V`.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn values<'r>(&'r self) -> Values<'r, V> { pub fn values<'r>(&'r self) -> Values<'r, V> {
fn second<A, B>((_, b): (A, B)) -> B { b } fn second<A, B>((_, b): (A, B)) -> B { b }
let second: fn((uint, &'r V)) -> &'r V = second; // coerce to fn pointer let second: fn((uint, &'r V)) -> &'r V = second; // coerce to fn pointer
@ -224,7 +224,7 @@ impl<V> VecMap<V> {
/// println!("{}: {}", key, value); /// println!("{}: {}", key, value);
/// } /// }
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn iter<'r>(&'r self) -> Iter<'r, V> { pub fn iter<'r>(&'r self) -> Iter<'r, V> {
Iter { Iter {
front: 0, front: 0,
@ -255,7 +255,7 @@ impl<V> VecMap<V> {
/// assert_eq!(value, &"x"); /// assert_eq!(value, &"x");
/// } /// }
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn iter_mut<'r>(&'r mut self) -> IterMut<'r, V> { pub fn iter_mut<'r>(&'r mut self) -> IterMut<'r, V> {
IterMut { IterMut {
front: 0, front: 0,
@ -282,7 +282,7 @@ impl<V> VecMap<V> {
/// ///
/// assert_eq!(vec, vec![(1, "a"), (2, "b"), (3, "c")]); /// assert_eq!(vec, vec![(1, "a"), (2, "b"), (3, "c")]);
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn into_iter(self) -> IntoIter<V> { pub fn into_iter(self) -> IntoIter<V> {
fn filter<A>((i, v): (uint, Option<A>)) -> Option<(uint, A)> { fn filter<A>((i, v): (uint, Option<A>)) -> Option<(uint, A)> {
v.map(|v| (i, v)) v.map(|v| (i, v))
@ -333,7 +333,7 @@ impl<V> VecMap<V> {
/// a.insert(1, "a"); /// a.insert(1, "a");
/// assert_eq!(a.len(), 1); /// assert_eq!(a.len(), 1);
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn len(&self) -> uint { pub fn len(&self) -> uint {
self.v.iter().filter(|elt| elt.is_some()).count() self.v.iter().filter(|elt| elt.is_some()).count()
} }
@ -350,7 +350,7 @@ impl<V> VecMap<V> {
/// a.insert(1, "a"); /// a.insert(1, "a");
/// assert!(!a.is_empty()); /// assert!(!a.is_empty());
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn is_empty(&self) -> bool { pub fn is_empty(&self) -> bool {
self.v.iter().all(|elt| elt.is_none()) self.v.iter().all(|elt| elt.is_none())
} }
@ -367,7 +367,7 @@ impl<V> VecMap<V> {
/// a.clear(); /// a.clear();
/// assert!(a.is_empty()); /// assert!(a.is_empty());
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn clear(&mut self) { self.v.clear() } pub fn clear(&mut self) { self.v.clear() }
/// Returns a reference to the value corresponding to the key. /// Returns a reference to the value corresponding to the key.
@ -382,7 +382,7 @@ impl<V> VecMap<V> {
/// assert_eq!(map.get(&1), Some(&"a")); /// assert_eq!(map.get(&1), Some(&"a"));
/// assert_eq!(map.get(&2), None); /// assert_eq!(map.get(&2), None);
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn get(&self, key: &uint) -> Option<&V> { pub fn get(&self, key: &uint) -> Option<&V> {
if *key < self.v.len() { if *key < self.v.len() {
match self.v[*key] { match self.v[*key] {
@ -407,7 +407,7 @@ impl<V> VecMap<V> {
/// assert_eq!(map.contains_key(&2), false); /// assert_eq!(map.contains_key(&2), false);
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn contains_key(&self, key: &uint) -> bool { pub fn contains_key(&self, key: &uint) -> bool {
self.get(key).is_some() self.get(key).is_some()
} }
@ -427,7 +427,7 @@ impl<V> VecMap<V> {
/// } /// }
/// assert_eq!(map[1], "b"); /// assert_eq!(map[1], "b");
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn get_mut(&mut self, key: &uint) -> Option<&mut V> { pub fn get_mut(&mut self, key: &uint) -> Option<&mut V> {
if *key < self.v.len() { if *key < self.v.len() {
match *(&mut self.v[*key]) { match *(&mut self.v[*key]) {
@ -455,7 +455,7 @@ impl<V> VecMap<V> {
/// assert_eq!(map.insert(37, "c"), Some("b")); /// assert_eq!(map.insert(37, "c"), Some("b"));
/// assert_eq!(map[37], "c"); /// assert_eq!(map[37], "c");
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn insert(&mut self, key: uint, value: V) -> Option<V> { pub fn insert(&mut self, key: uint, value: V) -> Option<V> {
let len = self.v.len(); let len = self.v.len();
if len <= key { if len <= key {
@ -477,7 +477,7 @@ impl<V> VecMap<V> {
/// assert_eq!(map.remove(&1), Some("a")); /// assert_eq!(map.remove(&1), Some("a"));
/// assert_eq!(map.remove(&1), None); /// assert_eq!(map.remove(&1), None);
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn remove(&mut self, key: &uint) -> Option<V> { pub fn remove(&mut self, key: &uint) -> Option<V> {
if *key >= self.v.len() { if *key >= self.v.len() {
return None; return None;
@ -487,17 +487,17 @@ impl<V> VecMap<V> {
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<V: PartialEq> PartialEq for VecMap<V> { impl<V: PartialEq> PartialEq for VecMap<V> {
fn eq(&self, other: &VecMap<V>) -> bool { fn eq(&self, other: &VecMap<V>) -> bool {
iter::order::eq(self.iter(), other.iter()) iter::order::eq(self.iter(), other.iter())
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<V: Eq> Eq for VecMap<V> {} impl<V: Eq> Eq for VecMap<V> {}
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<V: PartialOrd> PartialOrd for VecMap<V> { impl<V: PartialOrd> PartialOrd for VecMap<V> {
#[inline] #[inline]
fn partial_cmp(&self, other: &VecMap<V>) -> Option<Ordering> { fn partial_cmp(&self, other: &VecMap<V>) -> Option<Ordering> {
@ -505,7 +505,7 @@ impl<V: PartialOrd> PartialOrd for VecMap<V> {
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<V: Ord> Ord for VecMap<V> { impl<V: Ord> Ord for VecMap<V> {
#[inline] #[inline]
fn cmp(&self, other: &VecMap<V>) -> Ordering { fn cmp(&self, other: &VecMap<V>) -> Ordering {
@ -513,7 +513,7 @@ impl<V: Ord> Ord for VecMap<V> {
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<V: fmt::Show> fmt::Show for VecMap<V> { impl<V: fmt::Show> fmt::Show for VecMap<V> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
try!(write!(f, "VecMap {{")); try!(write!(f, "VecMap {{"));
@ -527,7 +527,7 @@ impl<V: fmt::Show> fmt::Show for VecMap<V> {
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<V> FromIterator<(uint, V)> for VecMap<V> { impl<V> FromIterator<(uint, V)> for VecMap<V> {
fn from_iter<Iter: Iterator<Item=(uint, V)>>(iter: Iter) -> VecMap<V> { fn from_iter<Iter: Iterator<Item=(uint, V)>>(iter: Iter) -> VecMap<V> {
let mut map = VecMap::new(); let mut map = VecMap::new();
@ -536,7 +536,7 @@ impl<V> FromIterator<(uint, V)> for VecMap<V> {
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<V> Extend<(uint, V)> for VecMap<V> { impl<V> Extend<(uint, V)> for VecMap<V> {
fn extend<Iter: Iterator<Item=(uint, V)>>(&mut self, mut iter: Iter) { fn extend<Iter: Iterator<Item=(uint, V)>>(&mut self, mut iter: Iter) {
for (k, v) in iter { for (k, v) in iter {
@ -554,7 +554,7 @@ impl<V> Index<uint> for VecMap<V> {
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<V> IndexMut<uint> for VecMap<V> { impl<V> IndexMut<uint> for VecMap<V> {
type Output = V; type Output = V;
@ -566,7 +566,7 @@ impl<V> IndexMut<uint> for VecMap<V> {
macro_rules! iterator { macro_rules! iterator {
(impl $name:ident -> $elem:ty, $($getter:ident),+) => { (impl $name:ident -> $elem:ty, $($getter:ident),+) => {
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a, V> Iterator for $name<'a, V> { impl<'a, V> Iterator for $name<'a, V> {
type Item = $elem; type Item = $elem;
@ -601,7 +601,7 @@ macro_rules! iterator {
macro_rules! double_ended_iterator { macro_rules! double_ended_iterator {
(impl $name:ident -> $elem:ty, $($getter:ident),+) => { (impl $name:ident -> $elem:ty, $($getter:ident),+) => {
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a, V> DoubleEndedIterator for $name<'a, V> { impl<'a, V> DoubleEndedIterator for $name<'a, V> {
#[inline] #[inline]
fn next_back(&mut self) -> Option<$elem> { fn next_back(&mut self) -> Option<$elem> {
@ -627,7 +627,7 @@ macro_rules! double_ended_iterator {
} }
/// An iterator over the key-value pairs of a map. /// An iterator over the key-value pairs of a map.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub struct Iter<'a, V:'a> { pub struct Iter<'a, V:'a> {
front: uint, front: uint,
back: uint, back: uint,
@ -650,7 +650,7 @@ double_ended_iterator! { impl Iter -> (uint, &'a V), as_ref }
/// An iterator over the key-value pairs of a map, with the /// An iterator over the key-value pairs of a map, with the
/// values being mutable. /// values being mutable.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub struct IterMut<'a, V:'a> { pub struct IterMut<'a, V:'a> {
front: uint, front: uint,
back: uint, back: uint,
@ -661,7 +661,7 @@ iterator! { impl IterMut -> (uint, &'a mut V), as_mut }
double_ended_iterator! { impl IterMut -> (uint, &'a mut V), as_mut } double_ended_iterator! { impl IterMut -> (uint, &'a mut V), as_mut }
/// An iterator over the keys of a map. /// An iterator over the keys of a map.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub struct Keys<'a, V: 'a> { pub struct Keys<'a, V: 'a> {
iter: Map<(uint, &'a V), uint, Iter<'a, V>, fn((uint, &'a V)) -> uint> iter: Map<(uint, &'a V), uint, Iter<'a, V>, fn((uint, &'a V)) -> uint>
} }
@ -676,7 +676,7 @@ impl<'a, V> Clone for Keys<'a, V> {
} }
/// An iterator over the values of a map. /// An iterator over the values of a map.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub struct Values<'a, V: 'a> { pub struct Values<'a, V: 'a> {
iter: Map<(uint, &'a V), &'a V, Iter<'a, V>, fn((uint, &'a V)) -> &'a V> iter: Map<(uint, &'a V), &'a V, Iter<'a, V>, fn((uint, &'a V)) -> &'a V>
} }
@ -691,7 +691,7 @@ impl<'a, V> Clone for Values<'a, V> {
} }
/// A consuming iterator over the key-value pairs of a map. /// A consuming iterator over the key-value pairs of a map.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub struct IntoIter<V> { pub struct IntoIter<V> {
iter: FilterMap< iter: FilterMap<
(uint, Option<V>), (uint, Option<V>),
@ -722,38 +722,38 @@ impl<'a, V> DoubleEndedIterator for Drain<'a, V> {
fn next_back(&mut self) -> Option<(uint, V)> { self.iter.next_back() } fn next_back(&mut self) -> Option<(uint, V)> { self.iter.next_back() }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a, V> Iterator for Keys<'a, V> { impl<'a, V> Iterator for Keys<'a, V> {
type Item = uint; type Item = uint;
fn next(&mut self) -> Option<uint> { self.iter.next() } fn next(&mut self) -> Option<uint> { self.iter.next() }
fn size_hint(&self) -> (uint, Option<uint>) { self.iter.size_hint() } fn size_hint(&self) -> (uint, Option<uint>) { self.iter.size_hint() }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a, V> DoubleEndedIterator for Keys<'a, V> { impl<'a, V> DoubleEndedIterator for Keys<'a, V> {
fn next_back(&mut self) -> Option<uint> { self.iter.next_back() } fn next_back(&mut self) -> Option<uint> { self.iter.next_back() }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a, V> Iterator for Values<'a, V> { impl<'a, V> Iterator for Values<'a, V> {
type Item = &'a V; type Item = &'a V;
fn next(&mut self) -> Option<(&'a V)> { self.iter.next() } fn next(&mut self) -> Option<(&'a V)> { self.iter.next() }
fn size_hint(&self) -> (uint, Option<uint>) { self.iter.size_hint() } fn size_hint(&self) -> (uint, Option<uint>) { self.iter.size_hint() }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a, V> DoubleEndedIterator for Values<'a, V> { impl<'a, V> DoubleEndedIterator for Values<'a, V> {
fn next_back(&mut self) -> Option<(&'a V)> { self.iter.next_back() } fn next_back(&mut self) -> Option<(&'a V)> { self.iter.next_back() }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<V> Iterator for IntoIter<V> { impl<V> Iterator for IntoIter<V> {
type Item = (uint, V); type Item = (uint, V);
fn next(&mut self) -> Option<(uint, V)> { self.iter.next() } fn next(&mut self) -> Option<(uint, V)> { self.iter.next() }
fn size_hint(&self) -> (uint, Option<uint>) { self.iter.size_hint() } fn size_hint(&self) -> (uint, Option<uint>) { self.iter.size_hint() }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<V> DoubleEndedIterator for IntoIter<V> { impl<V> DoubleEndedIterator for IntoIter<V> {
fn next_back(&mut self) -> Option<(uint, V)> { self.iter.next_back() } fn next_back(&mut self) -> Option<(uint, V)> { self.iter.next_back() }
} }

View File

@ -69,7 +69,7 @@
//! } //! }
//! ``` //! ```
#![stable(feature = "grandfathered", since = "1.0.0")] #![stable(feature = "rust1", since = "1.0.0")]
use mem::transmute; use mem::transmute;
use option::Option::{self, Some, None}; use option::Option::{self, Some, None};
@ -86,7 +86,7 @@ use intrinsics;
/// ///
/// Every type with no non-`'static` references implements `Any`, so `Any` can /// Every type with no non-`'static` references implements `Any`, so `Any` can
/// be used as a trait object to emulate the effects dynamic typing. /// be used as a trait object to emulate the effects dynamic typing.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub trait Any: 'static { pub trait Any: 'static {
/// Get the `TypeId` of `self` /// Get the `TypeId` of `self`
#[unstable(feature = "core", #[unstable(feature = "core",
@ -104,7 +104,7 @@ impl<T: 'static> Any for T {
impl Any { impl Any {
/// Returns true if the boxed type is the same as `T` /// Returns true if the boxed type is the same as `T`
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[inline] #[inline]
pub fn is<T: 'static>(&self) -> bool { pub fn is<T: 'static>(&self) -> bool {
// Get TypeId of the type this function is instantiated with // Get TypeId of the type this function is instantiated with
@ -119,7 +119,7 @@ impl Any {
/// Returns some reference to the boxed value if it is of type `T`, or /// Returns some reference to the boxed value if it is of type `T`, or
/// `None` if it isn't. /// `None` if it isn't.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[inline] #[inline]
pub fn downcast_ref<T: 'static>(&self) -> Option<&T> { pub fn downcast_ref<T: 'static>(&self) -> Option<&T> {
if self.is::<T>() { if self.is::<T>() {
@ -137,7 +137,7 @@ impl Any {
/// Returns some mutable reference to the boxed value if it is of type `T`, or /// Returns some mutable reference to the boxed value if it is of type `T`, or
/// `None` if it isn't. /// `None` if it isn't.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[inline] #[inline]
pub fn downcast_mut<T: 'static>(&mut self) -> Option<&mut T> { pub fn downcast_mut<T: 'static>(&mut self) -> Option<&mut T> {
if self.is::<T>() { if self.is::<T>() {
@ -168,7 +168,7 @@ impl Any {
/// but this limitation may be removed in the future. /// but this limitation may be removed in the future.
#[cfg_attr(stage0, lang = "type_id")] #[cfg_attr(stage0, lang = "type_id")]
#[derive(Clone, Copy, PartialEq, Eq, Show, Hash)] #[derive(Clone, Copy, PartialEq, Eq, Show, Hash)]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub struct TypeId { pub struct TypeId {
t: u64, t: u64,
} }

View File

@ -26,7 +26,7 @@ use option::Option;
macro_rules! array_impls { macro_rules! array_impls {
($($N:expr)+) => { ($($N:expr)+) => {
$( $(
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<T:Copy> Clone for [T; $N] { impl<T:Copy> Clone for [T; $N] {
fn clone(&self) -> [T; $N] { fn clone(&self) -> [T; $N] {
*self *self
@ -47,7 +47,7 @@ macro_rules! array_impls {
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<A, B> PartialEq<[B; $N]> for [A; $N] where A: PartialEq<B> { impl<A, B> PartialEq<[B; $N]> for [A; $N] where A: PartialEq<B> {
#[inline] #[inline]
fn eq(&self, other: &[B; $N]) -> bool { fn eq(&self, other: &[B; $N]) -> bool {
@ -59,7 +59,7 @@ macro_rules! array_impls {
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a, A, B, Rhs> PartialEq<Rhs> for [A; $N] where impl<'a, A, B, Rhs> PartialEq<Rhs> for [A; $N] where
A: PartialEq<B>, A: PartialEq<B>,
Rhs: Deref<Target=[B]>, Rhs: Deref<Target=[B]>,
@ -74,7 +74,7 @@ macro_rules! array_impls {
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a, A, B, Lhs> PartialEq<[B; $N]> for Lhs where impl<'a, A, B, Lhs> PartialEq<[B; $N]> for Lhs where
A: PartialEq<B>, A: PartialEq<B>,
Lhs: Deref<Target=[A]> Lhs: Deref<Target=[A]>
@ -89,10 +89,10 @@ macro_rules! array_impls {
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<T:Eq> Eq for [T; $N] { } impl<T:Eq> Eq for [T; $N] { }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<T:PartialOrd> PartialOrd for [T; $N] { impl<T:PartialOrd> PartialOrd for [T; $N] {
#[inline] #[inline]
fn partial_cmp(&self, other: &[T; $N]) -> Option<Ordering> { fn partial_cmp(&self, other: &[T; $N]) -> Option<Ordering> {
@ -116,7 +116,7 @@ macro_rules! array_impls {
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<T:Ord> Ord for [T; $N] { impl<T:Ord> Ord for [T; $N] {
#[inline] #[inline]
fn cmp(&self, other: &[T; $N]) -> Ordering { fn cmp(&self, other: &[T; $N]) -> Ordering {

View File

@ -68,7 +68,7 @@
//! println!("live tasks: {}", old_task_count + 1); //! println!("live tasks: {}", old_task_count + 1);
//! ``` //! ```
#![stable(feature = "grandfathered", since = "1.0.0")] #![stable(feature = "rust1", since = "1.0.0")]
use self::Ordering::*; use self::Ordering::*;
@ -78,7 +78,7 @@ use intrinsics;
use cell::UnsafeCell; use cell::UnsafeCell;
/// A boolean type which can be safely shared between threads. /// A boolean type which can be safely shared between threads.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub struct AtomicBool { pub struct AtomicBool {
v: UnsafeCell<usize>, v: UnsafeCell<usize>,
} }
@ -86,7 +86,7 @@ pub struct AtomicBool {
unsafe impl Sync for AtomicBool {} unsafe impl Sync for AtomicBool {}
/// A signed integer type which can be safely shared between threads. /// A signed integer type which can be safely shared between threads.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub struct AtomicIsize { pub struct AtomicIsize {
v: UnsafeCell<isize>, v: UnsafeCell<isize>,
} }
@ -94,7 +94,7 @@ pub struct AtomicIsize {
unsafe impl Sync for AtomicIsize {} unsafe impl Sync for AtomicIsize {}
/// An unsigned integer type which can be safely shared between threads. /// An unsigned integer type which can be safely shared between threads.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub struct AtomicUsize { pub struct AtomicUsize {
v: UnsafeCell<usize>, v: UnsafeCell<usize>,
} }
@ -102,7 +102,7 @@ pub struct AtomicUsize {
unsafe impl Sync for AtomicUsize {} unsafe impl Sync for AtomicUsize {}
/// A raw pointer type which can be safely shared between threads. /// A raw pointer type which can be safely shared between threads.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub struct AtomicPtr<T> { pub struct AtomicPtr<T> {
p: UnsafeCell<usize>, p: UnsafeCell<usize>,
} }
@ -119,42 +119,42 @@ unsafe impl<T> Sync for AtomicPtr<T> {}
/// ///
/// Rust's memory orderings are [the same as /// Rust's memory orderings are [the same as
/// C++'s](http://gcc.gnu.org/wiki/Atomic/GCCMM/AtomicSync). /// C++'s](http://gcc.gnu.org/wiki/Atomic/GCCMM/AtomicSync).
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[derive(Copy)] #[derive(Copy)]
pub enum Ordering { pub enum Ordering {
/// No ordering constraints, only atomic operations. /// No ordering constraints, only atomic operations.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
Relaxed, Relaxed,
/// When coupled with a store, all previous writes become visible /// When coupled with a store, all previous writes become visible
/// to another thread that performs a load with `Acquire` ordering /// to another thread that performs a load with `Acquire` ordering
/// on the same value. /// on the same value.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
Release, Release,
/// When coupled with a load, all subsequent loads will see data /// When coupled with a load, all subsequent loads will see data
/// written before a store with `Release` ordering on the same value /// written before a store with `Release` ordering on the same value
/// in another thread. /// in another thread.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
Acquire, Acquire,
/// When coupled with a load, uses `Acquire` ordering, and with a store /// When coupled with a load, uses `Acquire` ordering, and with a store
/// `Release` ordering. /// `Release` ordering.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
AcqRel, AcqRel,
/// Like `AcqRel` with the additional guarantee that all threads see all /// Like `AcqRel` with the additional guarantee that all threads see all
/// sequentially consistent operations in the same order. /// sequentially consistent operations in the same order.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
SeqCst, SeqCst,
} }
/// An `AtomicBool` initialized to `false`. /// An `AtomicBool` initialized to `false`.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub const ATOMIC_BOOL_INIT: AtomicBool = pub const ATOMIC_BOOL_INIT: AtomicBool =
AtomicBool { v: UnsafeCell { value: 0 } }; AtomicBool { v: UnsafeCell { value: 0 } };
/// An `AtomicIsize` initialized to `0`. /// An `AtomicIsize` initialized to `0`.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub const ATOMIC_ISIZE_INIT: AtomicIsize = pub const ATOMIC_ISIZE_INIT: AtomicIsize =
AtomicIsize { v: UnsafeCell { value: 0 } }; AtomicIsize { v: UnsafeCell { value: 0 } };
/// An `AtomicUsize` initialized to `0`. /// An `AtomicUsize` initialized to `0`.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub const ATOMIC_USIZE_INIT: AtomicUsize = pub const ATOMIC_USIZE_INIT: AtomicUsize =
AtomicUsize { v: UnsafeCell { value: 0, } }; AtomicUsize { v: UnsafeCell { value: 0, } };
@ -173,7 +173,7 @@ impl AtomicBool {
/// let atomic_false = AtomicBool::new(false); /// let atomic_false = AtomicBool::new(false);
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn new(v: bool) -> AtomicBool { pub fn new(v: bool) -> AtomicBool {
let val = if v { UINT_TRUE } else { 0 }; let val = if v { UINT_TRUE } else { 0 };
AtomicBool { v: UnsafeCell::new(val) } AtomicBool { v: UnsafeCell::new(val) }
@ -197,7 +197,7 @@ impl AtomicBool {
/// let value = some_bool.load(Ordering::Relaxed); /// let value = some_bool.load(Ordering::Relaxed);
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn load(&self, order: Ordering) -> bool { pub fn load(&self, order: Ordering) -> bool {
unsafe { atomic_load(self.v.get(), order) > 0 } unsafe { atomic_load(self.v.get(), order) > 0 }
} }
@ -220,7 +220,7 @@ impl AtomicBool {
/// ///
/// Panics if `order` is `Acquire` or `AcqRel`. /// Panics if `order` is `Acquire` or `AcqRel`.
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn store(&self, val: bool, order: Ordering) { pub fn store(&self, val: bool, order: Ordering) {
let val = if val { UINT_TRUE } else { 0 }; let val = if val { UINT_TRUE } else { 0 };
@ -241,7 +241,7 @@ impl AtomicBool {
/// let value = some_bool.swap(false, Ordering::Relaxed); /// let value = some_bool.swap(false, Ordering::Relaxed);
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn swap(&self, val: bool, order: Ordering) -> bool { pub fn swap(&self, val: bool, order: Ordering) -> bool {
let val = if val { UINT_TRUE } else { 0 }; let val = if val { UINT_TRUE } else { 0 };
@ -265,7 +265,7 @@ impl AtomicBool {
/// let value = some_bool.store(false, Ordering::Relaxed); /// let value = some_bool.store(false, Ordering::Relaxed);
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn compare_and_swap(&self, old: bool, new: bool, order: Ordering) -> bool { pub fn compare_and_swap(&self, old: bool, new: bool, order: Ordering) -> bool {
let old = if old { UINT_TRUE } else { 0 }; let old = if old { UINT_TRUE } else { 0 };
let new = if new { UINT_TRUE } else { 0 }; let new = if new { UINT_TRUE } else { 0 };
@ -298,7 +298,7 @@ impl AtomicBool {
/// assert_eq!(false, foo.load(Ordering::SeqCst)); /// assert_eq!(false, foo.load(Ordering::SeqCst));
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn fetch_and(&self, val: bool, order: Ordering) -> bool { pub fn fetch_and(&self, val: bool, order: Ordering) -> bool {
let val = if val { UINT_TRUE } else { 0 }; let val = if val { UINT_TRUE } else { 0 };
@ -331,7 +331,7 @@ impl AtomicBool {
/// assert_eq!(true, foo.load(Ordering::SeqCst)); /// assert_eq!(true, foo.load(Ordering::SeqCst));
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn fetch_nand(&self, val: bool, order: Ordering) -> bool { pub fn fetch_nand(&self, val: bool, order: Ordering) -> bool {
let val = if val { UINT_TRUE } else { 0 }; let val = if val { UINT_TRUE } else { 0 };
@ -363,7 +363,7 @@ impl AtomicBool {
/// assert_eq!(false, foo.load(Ordering::SeqCst)); /// assert_eq!(false, foo.load(Ordering::SeqCst));
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn fetch_or(&self, val: bool, order: Ordering) -> bool { pub fn fetch_or(&self, val: bool, order: Ordering) -> bool {
let val = if val { UINT_TRUE } else { 0 }; let val = if val { UINT_TRUE } else { 0 };
@ -395,7 +395,7 @@ impl AtomicBool {
/// assert_eq!(false, foo.load(Ordering::SeqCst)); /// assert_eq!(false, foo.load(Ordering::SeqCst));
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn fetch_xor(&self, val: bool, order: Ordering) -> bool { pub fn fetch_xor(&self, val: bool, order: Ordering) -> bool {
let val = if val { UINT_TRUE } else { 0 }; let val = if val { UINT_TRUE } else { 0 };
@ -403,7 +403,7 @@ impl AtomicBool {
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl AtomicIsize { impl AtomicIsize {
/// Creates a new `AtomicIsize`. /// Creates a new `AtomicIsize`.
/// ///
@ -580,7 +580,7 @@ impl AtomicIsize {
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl AtomicUsize { impl AtomicUsize {
/// Creates a new `AtomicUsize`. /// Creates a new `AtomicUsize`.
/// ///
@ -769,7 +769,7 @@ impl<T> AtomicPtr<T> {
/// let atomic_ptr = AtomicPtr::new(ptr); /// let atomic_ptr = AtomicPtr::new(ptr);
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn new(p: *mut T) -> AtomicPtr<T> { pub fn new(p: *mut T) -> AtomicPtr<T> {
AtomicPtr { p: UnsafeCell::new(p as usize) } AtomicPtr { p: UnsafeCell::new(p as usize) }
} }
@ -793,7 +793,7 @@ impl<T> AtomicPtr<T> {
/// let value = some_ptr.load(Ordering::Relaxed); /// let value = some_ptr.load(Ordering::Relaxed);
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn load(&self, order: Ordering) -> *mut T { pub fn load(&self, order: Ordering) -> *mut T {
unsafe { unsafe {
atomic_load(self.p.get(), order) as *mut T atomic_load(self.p.get(), order) as *mut T
@ -821,7 +821,7 @@ impl<T> AtomicPtr<T> {
/// ///
/// Panics if `order` is `Acquire` or `AcqRel`. /// Panics if `order` is `Acquire` or `AcqRel`.
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn store(&self, ptr: *mut T, order: Ordering) { pub fn store(&self, ptr: *mut T, order: Ordering) {
unsafe { atomic_store(self.p.get(), ptr as usize, order); } unsafe { atomic_store(self.p.get(), ptr as usize, order); }
} }
@ -843,7 +843,7 @@ impl<T> AtomicPtr<T> {
/// let value = some_ptr.swap(other_ptr, Ordering::Relaxed); /// let value = some_ptr.swap(other_ptr, Ordering::Relaxed);
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn swap(&self, ptr: *mut T, order: Ordering) -> *mut T { pub fn swap(&self, ptr: *mut T, order: Ordering) -> *mut T {
unsafe { atomic_swap(self.p.get(), ptr as usize, order) as *mut T } unsafe { atomic_swap(self.p.get(), ptr as usize, order) as *mut T }
} }
@ -869,7 +869,7 @@ impl<T> AtomicPtr<T> {
/// let value = some_ptr.compare_and_swap(other_ptr, another_ptr, Ordering::Relaxed); /// let value = some_ptr.compare_and_swap(other_ptr, another_ptr, Ordering::Relaxed);
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn compare_and_swap(&self, old: *mut T, new: *mut T, order: Ordering) -> *mut T { pub fn compare_and_swap(&self, old: *mut T, new: *mut T, order: Ordering) -> *mut T {
unsafe { unsafe {
atomic_compare_and_swap(self.p.get(), old as usize, atomic_compare_and_swap(self.p.get(), old as usize,
@ -890,7 +890,7 @@ unsafe fn atomic_store<T>(dst: *mut T, val: T, order:Ordering) {
} }
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
unsafe fn atomic_load<T>(dst: *const T, order:Ordering) -> T { unsafe fn atomic_load<T>(dst: *const T, order:Ordering) -> T {
match order { match order {
Acquire => intrinsics::atomic_load_acq(dst), Acquire => intrinsics::atomic_load_acq(dst),
@ -902,7 +902,7 @@ unsafe fn atomic_load<T>(dst: *const T, order:Ordering) -> T {
} }
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
unsafe fn atomic_swap<T>(dst: *mut T, val: T, order: Ordering) -> T { unsafe fn atomic_swap<T>(dst: *mut T, val: T, order: Ordering) -> T {
match order { match order {
Acquire => intrinsics::atomic_xchg_acq(dst, val), Acquire => intrinsics::atomic_xchg_acq(dst, val),
@ -915,7 +915,7 @@ unsafe fn atomic_swap<T>(dst: *mut T, val: T, order: Ordering) -> T {
/// Returns the old value (like __sync_fetch_and_add). /// Returns the old value (like __sync_fetch_and_add).
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
unsafe fn atomic_add<T>(dst: *mut T, val: T, order: Ordering) -> T { unsafe fn atomic_add<T>(dst: *mut T, val: T, order: Ordering) -> T {
match order { match order {
Acquire => intrinsics::atomic_xadd_acq(dst, val), Acquire => intrinsics::atomic_xadd_acq(dst, val),
@ -928,7 +928,7 @@ unsafe fn atomic_add<T>(dst: *mut T, val: T, order: Ordering) -> T {
/// Returns the old value (like __sync_fetch_and_sub). /// Returns the old value (like __sync_fetch_and_sub).
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
unsafe fn atomic_sub<T>(dst: *mut T, val: T, order: Ordering) -> T { unsafe fn atomic_sub<T>(dst: *mut T, val: T, order: Ordering) -> T {
match order { match order {
Acquire => intrinsics::atomic_xsub_acq(dst, val), Acquire => intrinsics::atomic_xsub_acq(dst, val),
@ -940,7 +940,7 @@ unsafe fn atomic_sub<T>(dst: *mut T, val: T, order: Ordering) -> T {
} }
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
unsafe fn atomic_compare_and_swap<T>(dst: *mut T, old:T, new:T, order: Ordering) -> T { unsafe fn atomic_compare_and_swap<T>(dst: *mut T, old:T, new:T, order: Ordering) -> T {
match order { match order {
Acquire => intrinsics::atomic_cxchg_acq(dst, old, new), Acquire => intrinsics::atomic_cxchg_acq(dst, old, new),
@ -952,7 +952,7 @@ unsafe fn atomic_compare_and_swap<T>(dst: *mut T, old:T, new:T, order: Ordering)
} }
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
unsafe fn atomic_and<T>(dst: *mut T, val: T, order: Ordering) -> T { unsafe fn atomic_and<T>(dst: *mut T, val: T, order: Ordering) -> T {
match order { match order {
Acquire => intrinsics::atomic_and_acq(dst, val), Acquire => intrinsics::atomic_and_acq(dst, val),
@ -964,7 +964,7 @@ unsafe fn atomic_and<T>(dst: *mut T, val: T, order: Ordering) -> T {
} }
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
unsafe fn atomic_nand<T>(dst: *mut T, val: T, order: Ordering) -> T { unsafe fn atomic_nand<T>(dst: *mut T, val: T, order: Ordering) -> T {
match order { match order {
Acquire => intrinsics::atomic_nand_acq(dst, val), Acquire => intrinsics::atomic_nand_acq(dst, val),
@ -977,7 +977,7 @@ unsafe fn atomic_nand<T>(dst: *mut T, val: T, order: Ordering) -> T {
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
unsafe fn atomic_or<T>(dst: *mut T, val: T, order: Ordering) -> T { unsafe fn atomic_or<T>(dst: *mut T, val: T, order: Ordering) -> T {
match order { match order {
Acquire => intrinsics::atomic_or_acq(dst, val), Acquire => intrinsics::atomic_or_acq(dst, val),
@ -990,7 +990,7 @@ unsafe fn atomic_or<T>(dst: *mut T, val: T, order: Ordering) -> T {
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
unsafe fn atomic_xor<T>(dst: *mut T, val: T, order: Ordering) -> T { unsafe fn atomic_xor<T>(dst: *mut T, val: T, order: Ordering) -> T {
match order { match order {
Acquire => intrinsics::atomic_xor_acq(dst, val), Acquire => intrinsics::atomic_xor_acq(dst, val),
@ -1023,7 +1023,7 @@ unsafe fn atomic_xor<T>(dst: *mut T, val: T, order: Ordering) -> T {
/// ///
/// Panics if `order` is `Relaxed`. /// Panics if `order` is `Relaxed`.
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn fence(order: Ordering) { pub fn fence(order: Ordering) {
unsafe { unsafe {
match order { match order {

View File

@ -143,7 +143,7 @@ pub enum Cow<'a, T, B: ?Sized + 'a> where B: ToOwned<T> {
Owned(T) Owned(T)
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a, T, B: ?Sized> Clone for Cow<'a, T, B> where B: ToOwned<T> { impl<'a, T, B: ?Sized> Clone for Cow<'a, T, B> where B: ToOwned<T> {
fn clone(&self) -> Cow<'a, T, B> { fn clone(&self) -> Cow<'a, T, B> {
match *self { match *self {
@ -197,7 +197,7 @@ impl<'a, T, B: ?Sized> Cow<'a, T, B> where B: ToOwned<T> {
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a, T, B: ?Sized> Deref for Cow<'a, T, B> where B: ToOwned<T> { impl<'a, T, B: ?Sized> Deref for Cow<'a, T, B> where B: ToOwned<T> {
type Target = B; type Target = B;
@ -209,10 +209,10 @@ impl<'a, T, B: ?Sized> Deref for Cow<'a, T, B> where B: ToOwned<T> {
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a, T, B: ?Sized> Eq for Cow<'a, T, B> where B: Eq + ToOwned<T> {} impl<'a, T, B: ?Sized> Eq for Cow<'a, T, B> where B: Eq + ToOwned<T> {}
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a, T, B: ?Sized> Ord for Cow<'a, T, B> where B: Ord + ToOwned<T> { impl<'a, T, B: ?Sized> Ord for Cow<'a, T, B> where B: Ord + ToOwned<T> {
#[inline] #[inline]
fn cmp(&self, other: &Cow<'a, T, B>) -> Ordering { fn cmp(&self, other: &Cow<'a, T, B>) -> Ordering {
@ -220,7 +220,7 @@ impl<'a, T, B: ?Sized> Ord for Cow<'a, T, B> where B: Ord + ToOwned<T> {
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a, 'b, T, U, B: ?Sized, C: ?Sized> PartialEq<Cow<'b, U, C>> for Cow<'a, T, B> where impl<'a, 'b, T, U, B: ?Sized, C: ?Sized> PartialEq<Cow<'b, U, C>> for Cow<'a, T, B> where
B: PartialEq<C> + ToOwned<T>, B: PartialEq<C> + ToOwned<T>,
C: ToOwned<U>, C: ToOwned<U>,
@ -231,7 +231,7 @@ impl<'a, 'b, T, U, B: ?Sized, C: ?Sized> PartialEq<Cow<'b, U, C>> for Cow<'a, T,
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a, T, B: ?Sized> PartialOrd for Cow<'a, T, B> where B: PartialOrd + ToOwned<T> { impl<'a, T, B: ?Sized> PartialOrd for Cow<'a, T, B> where B: PartialOrd + ToOwned<T> {
#[inline] #[inline]
fn partial_cmp(&self, other: &Cow<'a, T, B>) -> Option<Ordering> { fn partial_cmp(&self, other: &Cow<'a, T, B>) -> Option<Ordering> {
@ -239,7 +239,7 @@ impl<'a, T, B: ?Sized> PartialOrd for Cow<'a, T, B> where B: PartialOrd + ToOwne
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a, T, B: ?Sized> fmt::String for Cow<'a, T, B> where impl<'a, T, B: ?Sized> fmt::String for Cow<'a, T, B> where
B: fmt::String + ToOwned<T>, B: fmt::String + ToOwned<T>,
T: fmt::String, T: fmt::String,

View File

@ -154,7 +154,7 @@
// FIXME: Can't be shared between threads. Dynamic borrows // FIXME: Can't be shared between threads. Dynamic borrows
// FIXME: Relationship to Atomic types and RWLock // FIXME: Relationship to Atomic types and RWLock
#![stable(feature = "grandfathered", since = "1.0.0")] #![stable(feature = "rust1", since = "1.0.0")]
use clone::Clone; use clone::Clone;
use cmp::PartialEq; use cmp::PartialEq;
@ -165,14 +165,14 @@ use option::Option;
use option::Option::{None, Some}; use option::Option::{None, Some};
/// A mutable memory location that admits only `Copy` data. /// A mutable memory location that admits only `Copy` data.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub struct Cell<T> { pub struct Cell<T> {
value: UnsafeCell<T>, value: UnsafeCell<T>,
} }
impl<T:Copy> Cell<T> { impl<T:Copy> Cell<T> {
/// Creates a new `Cell` containing the given value. /// Creates a new `Cell` containing the given value.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn new(value: T) -> Cell<T> { pub fn new(value: T) -> Cell<T> {
Cell { Cell {
value: UnsafeCell::new(value), value: UnsafeCell::new(value),
@ -181,14 +181,14 @@ impl<T:Copy> Cell<T> {
/// Returns a copy of the contained value. /// Returns a copy of the contained value.
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn get(&self) -> T { pub fn get(&self) -> T {
unsafe{ *self.value.get() } unsafe{ *self.value.get() }
} }
/// Sets the contained value. /// Sets the contained value.
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn set(&self, value: T) { pub fn set(&self, value: T) {
unsafe { unsafe {
*self.value.get() = value; *self.value.get() = value;
@ -207,25 +207,25 @@ impl<T:Copy> Cell<T> {
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
unsafe impl<T> Send for Cell<T> where T: Send {} unsafe impl<T> Send for Cell<T> where T: Send {}
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<T:Copy> Clone for Cell<T> { impl<T:Copy> Clone for Cell<T> {
fn clone(&self) -> Cell<T> { fn clone(&self) -> Cell<T> {
Cell::new(self.get()) Cell::new(self.get())
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<T:Default + Copy> Default for Cell<T> { impl<T:Default + Copy> Default for Cell<T> {
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn default() -> Cell<T> { fn default() -> Cell<T> {
Cell::new(Default::default()) Cell::new(Default::default())
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<T:PartialEq + Copy> PartialEq for Cell<T> { impl<T:PartialEq + Copy> PartialEq for Cell<T> {
fn eq(&self, other: &Cell<T>) -> bool { fn eq(&self, other: &Cell<T>) -> bool {
self.get() == other.get() self.get() == other.get()
@ -233,7 +233,7 @@ impl<T:PartialEq + Copy> PartialEq for Cell<T> {
} }
/// A mutable memory location with dynamically checked borrow rules /// A mutable memory location with dynamically checked borrow rules
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub struct RefCell<T> { pub struct RefCell<T> {
value: UnsafeCell<T>, value: UnsafeCell<T>,
borrow: Cell<BorrowFlag>, borrow: Cell<BorrowFlag>,
@ -247,7 +247,7 @@ const WRITING: BorrowFlag = -1;
impl<T> RefCell<T> { impl<T> RefCell<T> {
/// Create a new `RefCell` containing `value` /// Create a new `RefCell` containing `value`
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn new(value: T) -> RefCell<T> { pub fn new(value: T) -> RefCell<T> {
RefCell { RefCell {
value: UnsafeCell::new(value), value: UnsafeCell::new(value),
@ -256,7 +256,7 @@ impl<T> RefCell<T> {
} }
/// Consumes the `RefCell`, returning the wrapped value. /// Consumes the `RefCell`, returning the wrapped value.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn into_inner(self) -> T { pub fn into_inner(self) -> T {
// Since this function takes `self` (the `RefCell`) by value, the // Since this function takes `self` (the `RefCell`) by value, the
// compiler statically verifies that it is not currently borrowed. // compiler statically verifies that it is not currently borrowed.
@ -287,7 +287,7 @@ impl<T> RefCell<T> {
/// # Panics /// # Panics
/// ///
/// Panics if the value is currently mutably borrowed. /// Panics if the value is currently mutably borrowed.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn borrow<'a>(&'a self) -> Ref<'a, T> { pub fn borrow<'a>(&'a self) -> Ref<'a, T> {
match self.try_borrow() { match self.try_borrow() {
Some(ptr) => ptr, Some(ptr) => ptr,
@ -317,7 +317,7 @@ impl<T> RefCell<T> {
/// # Panics /// # Panics
/// ///
/// Panics if the value is currently borrowed. /// Panics if the value is currently borrowed.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn borrow_mut<'a>(&'a self) -> RefMut<'a, T> { pub fn borrow_mut<'a>(&'a self) -> RefMut<'a, T> {
match self.try_borrow_mut() { match self.try_borrow_mut() {
Some(ptr) => ptr, Some(ptr) => ptr,
@ -337,25 +337,25 @@ impl<T> RefCell<T> {
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
unsafe impl<T> Send for RefCell<T> where T: Send {} unsafe impl<T> Send for RefCell<T> where T: Send {}
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<T: Clone> Clone for RefCell<T> { impl<T: Clone> Clone for RefCell<T> {
fn clone(&self) -> RefCell<T> { fn clone(&self) -> RefCell<T> {
RefCell::new(self.borrow().clone()) RefCell::new(self.borrow().clone())
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<T:Default> Default for RefCell<T> { impl<T:Default> Default for RefCell<T> {
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn default() -> RefCell<T> { fn default() -> RefCell<T> {
RefCell::new(Default::default()) RefCell::new(Default::default())
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<T: PartialEq> PartialEq for RefCell<T> { impl<T: PartialEq> PartialEq for RefCell<T> {
fn eq(&self, other: &RefCell<T>) -> bool { fn eq(&self, other: &RefCell<T>) -> bool {
*self.borrow() == *other.borrow() *self.borrow() == *other.borrow()
@ -399,7 +399,7 @@ impl<'b> Clone for BorrowRef<'b> {
} }
/// Wraps a borrowed reference to a value in a `RefCell` box. /// Wraps a borrowed reference to a value in a `RefCell` box.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub struct Ref<'b, T:'b> { pub struct Ref<'b, T:'b> {
// FIXME #12808: strange name to try to avoid interfering with // FIXME #12808: strange name to try to avoid interfering with
// field accesses of the contained type via Deref // field accesses of the contained type via Deref
@ -407,7 +407,7 @@ pub struct Ref<'b, T:'b> {
_borrow: BorrowRef<'b>, _borrow: BorrowRef<'b>,
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'b, T> Deref for Ref<'b, T> { impl<'b, T> Deref for Ref<'b, T> {
type Target = T; type Target = T;
@ -458,7 +458,7 @@ impl<'b> BorrowRefMut<'b> {
} }
/// Wraps a mutable borrowed reference to a value in a `RefCell` box. /// Wraps a mutable borrowed reference to a value in a `RefCell` box.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub struct RefMut<'b, T:'b> { pub struct RefMut<'b, T:'b> {
// FIXME #12808: strange name to try to avoid interfering with // FIXME #12808: strange name to try to avoid interfering with
// field accesses of the contained type via Deref // field accesses of the contained type via Deref
@ -466,7 +466,7 @@ pub struct RefMut<'b, T:'b> {
_borrow: BorrowRefMut<'b>, _borrow: BorrowRefMut<'b>,
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'b, T> Deref for RefMut<'b, T> { impl<'b, T> Deref for RefMut<'b, T> {
type Target = T; type Target = T;
@ -476,7 +476,7 @@ impl<'b, T> Deref for RefMut<'b, T> {
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'b, T> DerefMut for RefMut<'b, T> { impl<'b, T> DerefMut for RefMut<'b, T> {
#[inline] #[inline]
fn deref_mut<'a>(&'a mut self) -> &'a mut T { fn deref_mut<'a>(&'a mut self) -> &'a mut T {
@ -522,7 +522,7 @@ impl<'b, T> DerefMut for RefMut<'b, T> {
/// is not recommended to access its fields directly, `get` should be used /// is not recommended to access its fields directly, `get` should be used
/// instead. /// instead.
#[lang="unsafe"] #[lang="unsafe"]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub struct UnsafeCell<T> { pub struct UnsafeCell<T> {
/// Wrapped value /// Wrapped value
/// ///
@ -538,14 +538,14 @@ impl<T> UnsafeCell<T> {
/// ///
/// All access to the inner value through methods is `unsafe`, and it is /// All access to the inner value through methods is `unsafe`, and it is
/// highly discouraged to access the fields directly. /// highly discouraged to access the fields directly.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn new(value: T) -> UnsafeCell<T> { pub fn new(value: T) -> UnsafeCell<T> {
UnsafeCell { value: value } UnsafeCell { value: value }
} }
/// Gets a mutable pointer to the wrapped value. /// Gets a mutable pointer to the wrapped value.
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn get(&self) -> *mut T { &self.value as *const T as *mut T } pub fn get(&self) -> *mut T { &self.value as *const T as *mut T }
/// Unwraps the value /// Unwraps the value
@ -553,6 +553,6 @@ impl<T> UnsafeCell<T> {
/// This function is unsafe because there is no guarantee that this or other /// This function is unsafe because there is no guarantee that this or other
/// tasks are currently inspecting the inner value. /// tasks are currently inspecting the inner value.
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub unsafe fn into_inner(self) -> T { self.value } pub unsafe fn into_inner(self) -> T { self.value }
} }

View File

@ -64,12 +64,12 @@ static MAX_THREE_B: u32 = 0x10000u32;
*/ */
/// The highest valid code point /// The highest valid code point
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub const MAX: char = '\u{10ffff}'; pub const MAX: char = '\u{10ffff}';
/// Converts from `u32` to a `char` /// Converts from `u32` to a `char`
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn from_u32(i: u32) -> Option<char> { pub fn from_u32(i: u32) -> Option<char> {
// catch out-of-bounds and surrogates // catch out-of-bounds and surrogates
if (i > MAX as u32) || (i >= 0xD800 && i <= 0xDFFF) { if (i > MAX as u32) || (i >= 0xD800 && i <= 0xDFFF) {
@ -111,7 +111,7 @@ pub fn from_digit(num: uint, radix: uint) -> Option<char> {
} }
/// Basic `char` manipulations. /// Basic `char` manipulations.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub trait CharExt { pub trait CharExt {
/// Checks if a `char` parses as a numeric digit in the given radix. /// Checks if a `char` parses as a numeric digit in the given radix.
/// ///
@ -151,7 +151,7 @@ pub trait CharExt {
/// All characters are escaped with Rust syntax of the form `\\u{NNNN}` /// All characters are escaped with Rust syntax of the form `\\u{NNNN}`
/// where `NNNN` is the shortest hexadecimal representation of the code /// where `NNNN` is the shortest hexadecimal representation of the code
/// point. /// point.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn escape_unicode(self) -> EscapeUnicode; fn escape_unicode(self) -> EscapeUnicode;
/// Returns an iterator that yields the 'default' ASCII and /// Returns an iterator that yields the 'default' ASCII and
@ -166,17 +166,17 @@ pub trait CharExt {
/// escaped. /// escaped.
/// * Any other chars in the range [0x20,0x7e] are not escaped. /// * Any other chars in the range [0x20,0x7e] are not escaped.
/// * Any other chars are given hex Unicode escapes; see `escape_unicode`. /// * Any other chars are given hex Unicode escapes; see `escape_unicode`.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn escape_default(self) -> EscapeDefault; fn escape_default(self) -> EscapeDefault;
/// Returns the amount of bytes this character would need if encoded in /// Returns the amount of bytes this character would need if encoded in
/// UTF-8. /// UTF-8.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn len_utf8(self) -> uint; fn len_utf8(self) -> uint;
/// Returns the amount of bytes this character would need if encoded in /// Returns the amount of bytes this character would need if encoded in
/// UTF-16. /// UTF-16.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn len_utf16(self) -> uint; fn len_utf16(self) -> uint;
/// Encodes this character as UTF-8 into the provided byte buffer, /// Encodes this character as UTF-8 into the provided byte buffer,
@ -184,7 +184,7 @@ pub trait CharExt {
/// ///
/// If the buffer is not large enough, nothing will be written into it /// If the buffer is not large enough, nothing will be written into it
/// and a `None` will be returned. /// and a `None` will be returned.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn encode_utf8(self, dst: &mut [u8]) -> Option<uint>; fn encode_utf8(self, dst: &mut [u8]) -> Option<uint>;
/// Encodes this character as UTF-16 into the provided `u16` buffer, /// Encodes this character as UTF-16 into the provided `u16` buffer,
@ -192,11 +192,11 @@ pub trait CharExt {
/// ///
/// If the buffer is not large enough, nothing will be written into it /// If the buffer is not large enough, nothing will be written into it
/// and a `None` will be returned. /// and a `None` will be returned.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn encode_utf16(self, dst: &mut [u16]) -> Option<uint>; fn encode_utf16(self, dst: &mut [u16]) -> Option<uint>;
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl CharExt for char { impl CharExt for char {
#[unstable(feature = "core", #[unstable(feature = "core",
reason = "pending integer conventions")] reason = "pending integer conventions")]
@ -220,12 +220,12 @@ impl CharExt for char {
else { None } else { None }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn escape_unicode(self) -> EscapeUnicode { fn escape_unicode(self) -> EscapeUnicode {
EscapeUnicode { c: self, state: EscapeUnicodeState::Backslash } EscapeUnicode { c: self, state: EscapeUnicodeState::Backslash }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn escape_default(self) -> EscapeDefault { fn escape_default(self) -> EscapeDefault {
let init_state = match self { let init_state = match self {
'\t' => EscapeDefaultState::Backslash('t'), '\t' => EscapeDefaultState::Backslash('t'),
@ -241,7 +241,7 @@ impl CharExt for char {
} }
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn len_utf8(self) -> uint { fn len_utf8(self) -> uint {
let code = self as u32; let code = self as u32;
match () { match () {
@ -253,7 +253,7 @@ impl CharExt for char {
} }
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn len_utf16(self) -> uint { fn len_utf16(self) -> uint {
let ch = self as u32; let ch = self as u32;
if (ch & 0xFFFF_u32) == ch { 1 } else { 2 } if (ch & 0xFFFF_u32) == ch { 1 } else { 2 }
@ -313,7 +313,7 @@ impl CharExt for char {
/// An iterator over the characters that represent a `char`, as escaped by /// An iterator over the characters that represent a `char`, as escaped by
/// Rust's unicode escaping rules. /// Rust's unicode escaping rules.
#[derive(Clone)] #[derive(Clone)]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub struct EscapeUnicode { pub struct EscapeUnicode {
c: char, c: char,
state: EscapeUnicodeState state: EscapeUnicodeState
@ -330,7 +330,7 @@ enum EscapeUnicodeState {
Done, Done,
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl Iterator for EscapeUnicode { impl Iterator for EscapeUnicode {
type Item = char; type Item = char;
@ -376,7 +376,7 @@ impl Iterator for EscapeUnicode {
/// An iterator over the characters that represent a `char`, escaped /// An iterator over the characters that represent a `char`, escaped
/// for maximum portability. /// for maximum portability.
#[derive(Clone)] #[derive(Clone)]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub struct EscapeDefault { pub struct EscapeDefault {
state: EscapeDefaultState state: EscapeDefaultState
} }
@ -390,7 +390,7 @@ enum EscapeDefaultState {
Unicode(EscapeUnicode), Unicode(EscapeUnicode),
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl Iterator for EscapeDefault { impl Iterator for EscapeDefault {
type Item = char; type Item = char;

View File

@ -19,15 +19,15 @@
//! explicitly, by convention implementing the `Clone` trait and calling //! explicitly, by convention implementing the `Clone` trait and calling
//! the `clone` method. //! the `clone` method.
#![stable(feature = "grandfathered", since = "1.0.0")] #![stable(feature = "rust1", since = "1.0.0")]
use marker::Sized; use marker::Sized;
/// A common trait for cloning an object. /// A common trait for cloning an object.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub trait Clone : Sized { pub trait Clone : Sized {
/// Returns a copy of the value. /// Returns a copy of the value.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn clone(&self) -> Self; fn clone(&self) -> Self;
/// Perform copy-assignment from `source`. /// Perform copy-assignment from `source`.
@ -43,7 +43,7 @@ pub trait Clone : Sized {
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a, T: ?Sized> Clone for &'a T { impl<'a, T: ?Sized> Clone for &'a T {
/// Return a shallow copy of the reference. /// Return a shallow copy of the reference.
#[inline] #[inline]
@ -52,7 +52,7 @@ impl<'a, T: ?Sized> Clone for &'a T {
macro_rules! clone_impl { macro_rules! clone_impl {
($t:ty) => { ($t:ty) => {
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl Clone for $t { impl Clone for $t {
/// Return a deep copy of the value. /// Return a deep copy of the value.
#[inline] #[inline]

View File

@ -39,7 +39,7 @@
//! assert!(SketchyNum {num: 25} != SketchyNum {num: 57}); //! assert!(SketchyNum {num: 25} != SketchyNum {num: 57});
//! ``` //! ```
#![stable(feature = "grandfathered", since = "1.0.0")] #![stable(feature = "rust1", since = "1.0.0")]
use self::Ordering::*; use self::Ordering::*;
@ -68,16 +68,16 @@ use option::Option::{self, Some, None};
/// the rule that `eq` is a strict inverse of `ne`; that is, `!(a == b)` if and /// the rule that `eq` is a strict inverse of `ne`; that is, `!(a == b)` if and
/// only if `a != b`. /// only if `a != b`.
#[lang="eq"] #[lang="eq"]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[old_orphan_check] #[old_orphan_check]
pub trait PartialEq<Rhs: ?Sized = Self> { pub trait PartialEq<Rhs: ?Sized = Self> {
/// This method tests for `self` and `other` values to be equal, and is used by `==`. /// This method tests for `self` and `other` values to be equal, and is used by `==`.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn eq(&self, other: &Rhs) -> bool; fn eq(&self, other: &Rhs) -> bool;
/// This method tests for `!=`. /// This method tests for `!=`.
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn ne(&self, other: &Rhs) -> bool { !self.eq(other) } fn ne(&self, other: &Rhs) -> bool { !self.eq(other) }
} }
@ -90,7 +90,7 @@ pub trait PartialEq<Rhs: ?Sized = Self> {
/// - reflexive: `a == a`; /// - reflexive: `a == a`;
/// - symmetric: `a == b` implies `b == a`; and /// - symmetric: `a == b` implies `b == a`; and
/// - transitive: `a == b` and `b == c` implies `a == c`. /// - transitive: `a == b` and `b == c` implies `a == c`.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub trait Eq: PartialEq<Self> { pub trait Eq: PartialEq<Self> {
// FIXME #13101: this method is used solely by #[deriving] to // FIXME #13101: this method is used solely by #[deriving] to
// assert that every component of a type implements #[deriving] // assert that every component of a type implements #[deriving]
@ -106,16 +106,16 @@ pub trait Eq: PartialEq<Self> {
/// An ordering is, e.g, a result of a comparison between two values. /// An ordering is, e.g, a result of a comparison between two values.
#[derive(Clone, Copy, PartialEq, Show)] #[derive(Clone, Copy, PartialEq, Show)]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub enum Ordering { pub enum Ordering {
/// An ordering where a compared value is less [than another]. /// An ordering where a compared value is less [than another].
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
Less = -1i, Less = -1i,
/// An ordering where a compared value is equal [to another]. /// An ordering where a compared value is equal [to another].
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
Equal = 0i, Equal = 0i,
/// An ordering where a compared value is greater [than another]. /// An ordering where a compared value is greater [than another].
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
Greater = 1i, Greater = 1i,
} }
@ -141,7 +141,7 @@ impl Ordering {
/// assert!(data == b); /// assert!(data == b);
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn reverse(self) -> Ordering { pub fn reverse(self) -> Ordering {
unsafe { unsafe {
// this compiles really nicely (to a single instruction); // this compiles really nicely (to a single instruction);
@ -164,7 +164,7 @@ impl Ordering {
/// true; and /// true; and
/// - transitive, `a < b` and `b < c` implies `a < c`. The same must hold for /// - transitive, `a < b` and `b < c` implies `a < c`. The same must hold for
/// both `==` and `>`. /// both `==` and `>`.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub trait Ord: Eq + PartialOrd<Self> { pub trait Ord: Eq + PartialOrd<Self> {
/// This method returns an ordering between `self` and `other` values. /// This method returns an ordering between `self` and `other` values.
/// ///
@ -178,26 +178,26 @@ pub trait Ord: Eq + PartialOrd<Self> {
/// assert_eq!(10u.cmp(&5), Greater); // because 10 > 5 /// assert_eq!(10u.cmp(&5), Greater); // because 10 > 5
/// assert_eq!( 5u.cmp(&5), Equal); // because 5 == 5 /// assert_eq!( 5u.cmp(&5), Equal); // because 5 == 5
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn cmp(&self, other: &Self) -> Ordering; fn cmp(&self, other: &Self) -> Ordering;
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl Eq for Ordering {} impl Eq for Ordering {}
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl Ord for Ordering { impl Ord for Ordering {
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn cmp(&self, other: &Ordering) -> Ordering { fn cmp(&self, other: &Ordering) -> Ordering {
(*self as int).cmp(&(*other as int)) (*self as int).cmp(&(*other as int))
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl PartialOrd for Ordering { impl PartialOrd for Ordering {
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn partial_cmp(&self, other: &Ordering) -> Option<Ordering> { fn partial_cmp(&self, other: &Ordering) -> Option<Ordering> {
(*self as int).partial_cmp(&(*other as int)) (*self as int).partial_cmp(&(*other as int))
} }
@ -224,16 +224,16 @@ impl PartialOrd for Ordering {
/// `NaN < 0 == false` and `NaN >= 0 == false` (cf. IEEE 754-2008 section /// `NaN < 0 == false` and `NaN >= 0 == false` (cf. IEEE 754-2008 section
/// 5.11). /// 5.11).
#[lang="ord"] #[lang="ord"]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub trait PartialOrd<Rhs: ?Sized = Self>: PartialEq<Rhs> { pub trait PartialOrd<Rhs: ?Sized = Self>: PartialEq<Rhs> {
/// This method returns an ordering between `self` and `other` values /// This method returns an ordering between `self` and `other` values
/// if one exists. /// if one exists.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn partial_cmp(&self, other: &Rhs) -> Option<Ordering>; fn partial_cmp(&self, other: &Rhs) -> Option<Ordering>;
/// This method tests less than (for `self` and `other`) and is used by the `<` operator. /// This method tests less than (for `self` and `other`) and is used by the `<` operator.
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn lt(&self, other: &Rhs) -> bool { fn lt(&self, other: &Rhs) -> bool {
match self.partial_cmp(other) { match self.partial_cmp(other) {
Some(Less) => true, Some(Less) => true,
@ -243,7 +243,7 @@ pub trait PartialOrd<Rhs: ?Sized = Self>: PartialEq<Rhs> {
/// This method tests less than or equal to (`<=`). /// This method tests less than or equal to (`<=`).
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn le(&self, other: &Rhs) -> bool { fn le(&self, other: &Rhs) -> bool {
match self.partial_cmp(other) { match self.partial_cmp(other) {
Some(Less) | Some(Equal) => true, Some(Less) | Some(Equal) => true,
@ -253,7 +253,7 @@ pub trait PartialOrd<Rhs: ?Sized = Self>: PartialEq<Rhs> {
/// This method tests greater than (`>`). /// This method tests greater than (`>`).
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn gt(&self, other: &Rhs) -> bool { fn gt(&self, other: &Rhs) -> bool {
match self.partial_cmp(other) { match self.partial_cmp(other) {
Some(Greater) => true, Some(Greater) => true,
@ -263,7 +263,7 @@ pub trait PartialOrd<Rhs: ?Sized = Self>: PartialEq<Rhs> {
/// This method tests greater than or equal to (`>=`). /// This method tests greater than or equal to (`>=`).
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn ge(&self, other: &Rhs) -> bool { fn ge(&self, other: &Rhs) -> bool {
match self.partial_cmp(other) { match self.partial_cmp(other) {
Some(Greater) | Some(Equal) => true, Some(Greater) | Some(Equal) => true,
@ -274,14 +274,14 @@ pub trait PartialOrd<Rhs: ?Sized = Self>: PartialEq<Rhs> {
/// Compare and return the minimum of two values. /// Compare and return the minimum of two values.
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn min<T: Ord>(v1: T, v2: T) -> T { pub fn min<T: Ord>(v1: T, v2: T) -> T {
if v1 < v2 { v1 } else { v2 } if v1 < v2 { v1 } else { v2 }
} }
/// Compare and return the maximum of two values. /// Compare and return the maximum of two values.
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn max<T: Ord>(v1: T, v2: T) -> T { pub fn max<T: Ord>(v1: T, v2: T) -> T {
if v1 > v2 { v1 } else { v2 } if v1 > v2 { v1 } else { v2 }
} }
@ -322,7 +322,7 @@ mod impls {
macro_rules! partial_eq_impl { macro_rules! partial_eq_impl {
($($t:ty)*) => ($( ($($t:ty)*) => ($(
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl PartialEq for $t { impl PartialEq for $t {
#[inline] #[inline]
fn eq(&self, other: &$t) -> bool { (*self) == (*other) } fn eq(&self, other: &$t) -> bool { (*self) == (*other) }
@ -332,7 +332,7 @@ mod impls {
)*) )*)
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl PartialEq for () { impl PartialEq for () {
#[inline] #[inline]
fn eq(&self, _other: &()) -> bool { true } fn eq(&self, _other: &()) -> bool { true }
@ -346,7 +346,7 @@ mod impls {
macro_rules! eq_impl { macro_rules! eq_impl {
($($t:ty)*) => ($( ($($t:ty)*) => ($(
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl Eq for $t {} impl Eq for $t {}
)*) )*)
} }
@ -355,7 +355,7 @@ mod impls {
macro_rules! partial_ord_impl { macro_rules! partial_ord_impl {
($($t:ty)*) => ($( ($($t:ty)*) => ($(
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl PartialOrd for $t { impl PartialOrd for $t {
#[inline] #[inline]
fn partial_cmp(&self, other: &$t) -> Option<Ordering> { fn partial_cmp(&self, other: &$t) -> Option<Ordering> {
@ -378,7 +378,7 @@ mod impls {
)*) )*)
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl PartialOrd for () { impl PartialOrd for () {
#[inline] #[inline]
fn partial_cmp(&self, _: &()) -> Option<Ordering> { fn partial_cmp(&self, _: &()) -> Option<Ordering> {
@ -386,7 +386,7 @@ mod impls {
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl PartialOrd for bool { impl PartialOrd for bool {
#[inline] #[inline]
fn partial_cmp(&self, other: &bool) -> Option<Ordering> { fn partial_cmp(&self, other: &bool) -> Option<Ordering> {
@ -398,7 +398,7 @@ mod impls {
macro_rules! ord_impl { macro_rules! ord_impl {
($($t:ty)*) => ($( ($($t:ty)*) => ($(
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl Ord for $t { impl Ord for $t {
#[inline] #[inline]
fn cmp(&self, other: &$t) -> Ordering { fn cmp(&self, other: &$t) -> Ordering {
@ -410,13 +410,13 @@ mod impls {
)*) )*)
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl Ord for () { impl Ord for () {
#[inline] #[inline]
fn cmp(&self, _other: &()) -> Ordering { Equal } fn cmp(&self, _other: &()) -> Ordering { Equal }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl Ord for bool { impl Ord for bool {
#[inline] #[inline]
fn cmp(&self, other: &bool) -> Ordering { fn cmp(&self, other: &bool) -> Ordering {
@ -428,14 +428,14 @@ mod impls {
// & pointers // & pointers
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a, 'b, A: ?Sized, B: ?Sized> PartialEq<&'b B> for &'a A where A: PartialEq<B> { impl<'a, 'b, A: ?Sized, B: ?Sized> PartialEq<&'b B> for &'a A where A: PartialEq<B> {
#[inline] #[inline]
fn eq(&self, other: & &'b B) -> bool { PartialEq::eq(*self, *other) } fn eq(&self, other: & &'b B) -> bool { PartialEq::eq(*self, *other) }
#[inline] #[inline]
fn ne(&self, other: & &'b B) -> bool { PartialEq::ne(*self, *other) } fn ne(&self, other: & &'b B) -> bool { PartialEq::ne(*self, *other) }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a, 'b, A: ?Sized, B: ?Sized> PartialOrd<&'b B> for &'a A where A: PartialOrd<B> { impl<'a, 'b, A: ?Sized, B: ?Sized> PartialOrd<&'b B> for &'a A where A: PartialOrd<B> {
#[inline] #[inline]
fn partial_cmp(&self, other: &&'b B) -> Option<Ordering> { fn partial_cmp(&self, other: &&'b B) -> Option<Ordering> {
@ -450,24 +450,24 @@ mod impls {
#[inline] #[inline]
fn gt(&self, other: & &'b B) -> bool { PartialOrd::gt(*self, *other) } fn gt(&self, other: & &'b B) -> bool { PartialOrd::gt(*self, *other) }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a, A: ?Sized> Ord for &'a A where A: Ord { impl<'a, A: ?Sized> Ord for &'a A where A: Ord {
#[inline] #[inline]
fn cmp(&self, other: & &'a A) -> Ordering { Ord::cmp(*self, *other) } fn cmp(&self, other: & &'a A) -> Ordering { Ord::cmp(*self, *other) }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a, A: ?Sized> Eq for &'a A where A: Eq {} impl<'a, A: ?Sized> Eq for &'a A where A: Eq {}
// &mut pointers // &mut pointers
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a, 'b, A: ?Sized, B: ?Sized> PartialEq<&'b mut B> for &'a mut A where A: PartialEq<B> { impl<'a, 'b, A: ?Sized, B: ?Sized> PartialEq<&'b mut B> for &'a mut A where A: PartialEq<B> {
#[inline] #[inline]
fn eq(&self, other: &&'b mut B) -> bool { PartialEq::eq(*self, *other) } fn eq(&self, other: &&'b mut B) -> bool { PartialEq::eq(*self, *other) }
#[inline] #[inline]
fn ne(&self, other: &&'b mut B) -> bool { PartialEq::ne(*self, *other) } fn ne(&self, other: &&'b mut B) -> bool { PartialEq::ne(*self, *other) }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a, 'b, A: ?Sized, B: ?Sized> PartialOrd<&'b mut B> for &'a mut A where A: PartialOrd<B> { impl<'a, 'b, A: ?Sized, B: ?Sized> PartialOrd<&'b mut B> for &'a mut A where A: PartialOrd<B> {
#[inline] #[inline]
fn partial_cmp(&self, other: &&'b mut B) -> Option<Ordering> { fn partial_cmp(&self, other: &&'b mut B) -> Option<Ordering> {
@ -482,15 +482,15 @@ mod impls {
#[inline] #[inline]
fn gt(&self, other: &&'b mut B) -> bool { PartialOrd::gt(*self, *other) } fn gt(&self, other: &&'b mut B) -> bool { PartialOrd::gt(*self, *other) }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a, A: ?Sized> Ord for &'a mut A where A: Ord { impl<'a, A: ?Sized> Ord for &'a mut A where A: Ord {
#[inline] #[inline]
fn cmp(&self, other: &&'a mut A) -> Ordering { Ord::cmp(*self, *other) } fn cmp(&self, other: &&'a mut A) -> Ordering { Ord::cmp(*self, *other) }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a, A: ?Sized> Eq for &'a mut A where A: Eq {} impl<'a, A: ?Sized> Eq for &'a mut A where A: Eq {}
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a, 'b, A: ?Sized, B: ?Sized> PartialEq<&'b mut B> for &'a A where A: PartialEq<B> { impl<'a, 'b, A: ?Sized, B: ?Sized> PartialEq<&'b mut B> for &'a A where A: PartialEq<B> {
#[inline] #[inline]
fn eq(&self, other: &&'b mut B) -> bool { PartialEq::eq(*self, *other) } fn eq(&self, other: &&'b mut B) -> bool { PartialEq::eq(*self, *other) }
@ -498,7 +498,7 @@ mod impls {
fn ne(&self, other: &&'b mut B) -> bool { PartialEq::ne(*self, *other) } fn ne(&self, other: &&'b mut B) -> bool { PartialEq::ne(*self, *other) }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a, 'b, A: ?Sized, B: ?Sized> PartialEq<&'b B> for &'a mut A where A: PartialEq<B> { impl<'a, 'b, A: ?Sized, B: ?Sized> PartialEq<&'b B> for &'a mut A where A: PartialEq<B> {
#[inline] #[inline]
fn eq(&self, other: &&'b B) -> bool { PartialEq::eq(*self, *other) } fn eq(&self, other: &&'b B) -> bool { PartialEq::eq(*self, *other) }

View File

@ -81,7 +81,7 @@
//! } //! }
//! ``` //! ```
#![stable(feature = "grandfathered", since = "1.0.0")] #![stable(feature = "rust1", since = "1.0.0")]
/// A trait that types which have a useful default value should implement. /// A trait that types which have a useful default value should implement.
/// ///
@ -97,7 +97,7 @@
/// bar: f32, /// bar: f32,
/// } /// }
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub trait Default { pub trait Default {
/// Returns the "default value" for a type. /// Returns the "default value" for a type.
/// ///
@ -131,16 +131,16 @@ pub trait Default {
/// fn default() -> Kind { Kind::A } /// fn default() -> Kind { Kind::A }
/// } /// }
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn default() -> Self; fn default() -> Self;
} }
macro_rules! default_impl { macro_rules! default_impl {
($t:ty, $v:expr) => { ($t:ty, $v:expr) => {
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl Default for $t { impl Default for $t {
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn default() -> $t { $v } fn default() -> $t { $v }
} }
} }

View File

@ -11,7 +11,7 @@
//! Utilities for formatting and printing strings //! Utilities for formatting and printing strings
#![allow(unused_variables)] #![allow(unused_variables)]
#![stable(feature = "grandfathered", since = "1.0.0")] #![stable(feature = "rust1", since = "1.0.0")]
use any; use any;
use cell::{Cell, RefCell, Ref, RefMut}; use cell::{Cell, RefCell, Ref, RefMut};
@ -207,7 +207,7 @@ impl<'a> Arguments<'a> {
/// and pass it to a function or closure, passed as the first argument. The /// and pass it to a function or closure, passed as the first argument. The
/// macro validates the format string at compile-time so usage of the `write` /// macro validates the format string at compile-time so usage of the `write`
/// and `format` functions can be safely performed. /// and `format` functions can be safely performed.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[derive(Copy)] #[derive(Copy)]
pub struct Arguments<'a> { pub struct Arguments<'a> {
// Format string pieces to print. // Format string pieces to print.
@ -227,7 +227,7 @@ impl<'a> Show for Arguments<'a> {
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a> String for Arguments<'a> { impl<'a> String for Arguments<'a> {
fn fmt(&self, fmt: &mut Formatter) -> Result { fn fmt(&self, fmt: &mut Formatter) -> Result {
write(fmt.buf, *self) write(fmt.buf, *self)
@ -653,7 +653,7 @@ impl Show for bool {
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl String for bool { impl String for bool {
fn fmt(&self, f: &mut Formatter) -> Result { fn fmt(&self, f: &mut Formatter) -> Result {
String::fmt(if *self { "true" } else { "false" }, f) String::fmt(if *self { "true" } else { "false" }, f)
@ -670,7 +670,7 @@ impl Show for str {
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl String for str { impl String for str {
fn fmt(&self, f: &mut Formatter) -> Result { fn fmt(&self, f: &mut Formatter) -> Result {
f.pad(self) f.pad(self)
@ -688,7 +688,7 @@ impl Show for char {
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl String for char { impl String for char {
fn fmt(&self, f: &mut Formatter) -> Result { fn fmt(&self, f: &mut Formatter) -> Result {
let mut utf8 = [0u8; 4]; let mut utf8 = [0u8; 4];
@ -734,7 +734,7 @@ macro_rules! floating { ($ty:ident) => {
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl String for $ty { impl String for $ty {
fn fmt(&self, fmt: &mut Formatter) -> Result { fn fmt(&self, fmt: &mut Formatter) -> Result {
use num::Float; use num::Float;
@ -901,7 +901,7 @@ impl<'b, T: Show> Show for RefMut<'b, T> {
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl String for Utf8Error { impl String for Utf8Error {
fn fmt(&self, f: &mut Formatter) -> Result { fn fmt(&self, f: &mut Formatter) -> Result {
match *self { match *self {

View File

@ -227,7 +227,7 @@ extern "rust-intrinsic" {
/// ///
/// `forget` is unsafe because the caller is responsible for /// `forget` is unsafe because the caller is responsible for
/// ensuring the argument is deallocated already. /// ensuring the argument is deallocated already.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn forget<T>(_: T) -> (); pub fn forget<T>(_: T) -> ();
/// Unsafely transforms a value of one type into a value of another type. /// Unsafely transforms a value of one type into a value of another type.
@ -243,7 +243,7 @@ extern "rust-intrinsic" {
/// let v: &[u8] = unsafe { mem::transmute("L") }; /// let v: &[u8] = unsafe { mem::transmute("L") };
/// assert!(v == [76u8]); /// assert!(v == [76u8]);
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn transmute<T,U>(e: T) -> U; pub fn transmute<T,U>(e: T) -> U;
/// Gives the address for the return value of the enclosing function. /// Gives the address for the return value of the enclosing function.

View File

@ -54,7 +54,7 @@
//! //!
//! This `for` loop syntax can be applied to any iterator over any type. //! This `for` loop syntax can be applied to any iterator over any type.
#![stable(feature = "grandfathered", since = "1.0.0")] #![stable(feature = "rust1", since = "1.0.0")]
use self::MinMaxResult::*; use self::MinMaxResult::*;
@ -81,13 +81,13 @@ use uint;
/// it wishes, either by returning `None` infinitely, or by doing something /// it wishes, either by returning `None` infinitely, or by doing something
/// else. /// else.
#[lang="iterator"] #[lang="iterator"]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub trait Iterator { pub trait Iterator {
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
type Item; type Item;
/// Advance the iterator and return the next value. Return `None` when the end is reached. /// Advance the iterator and return the next value. Return `None` when the end is reached.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn next(&mut self) -> Option<Self::Item>; fn next(&mut self) -> Option<Self::Item>;
/// Returns a lower and upper bound on the remaining length of the iterator. /// Returns a lower and upper bound on the remaining length of the iterator.
@ -95,12 +95,12 @@ pub trait Iterator {
/// An upper bound of `None` means either there is no known upper bound, or the upper bound /// An upper bound of `None` means either there is no known upper bound, or the upper bound
/// does not fit within a `uint`. /// does not fit within a `uint`.
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn size_hint(&self) -> (uint, Option<uint>) { (0, None) } fn size_hint(&self) -> (uint, Option<uint>) { (0, None) }
} }
/// Conversion from an `Iterator` /// Conversion from an `Iterator`
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[rustc_on_unimplemented="a collection of type `{Self}` cannot be \ #[rustc_on_unimplemented="a collection of type `{Self}` cannot be \
built from an iterator over elements of type `{A}`"] built from an iterator over elements of type `{A}`"]
pub trait FromIterator<A> { pub trait FromIterator<A> {
@ -109,15 +109,15 @@ pub trait FromIterator<A> {
} }
/// A type growable from an `Iterator` implementation /// A type growable from an `Iterator` implementation
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub trait Extend<A> { pub trait Extend<A> {
/// Extend a container with the elements yielded by an arbitrary iterator /// Extend a container with the elements yielded by an arbitrary iterator
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn extend<T: Iterator<Item=A>>(&mut self, iterator: T); fn extend<T: Iterator<Item=A>>(&mut self, iterator: T);
} }
/// An extension trait providing numerous methods applicable to all iterators. /// An extension trait providing numerous methods applicable to all iterators.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub trait IteratorExt: Iterator + Sized { pub trait IteratorExt: Iterator + Sized {
/// Counts the number of elements in this iterator. /// Counts the number of elements in this iterator.
/// ///
@ -129,7 +129,7 @@ pub trait IteratorExt: Iterator + Sized {
/// assert!(it.count() == 5); /// assert!(it.count() == 5);
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn count(self) -> uint { fn count(self) -> uint {
self.fold(0, |cnt, _x| cnt + 1) self.fold(0, |cnt, _x| cnt + 1)
} }
@ -144,7 +144,7 @@ pub trait IteratorExt: Iterator + Sized {
/// assert!(a.iter().last().unwrap() == &5); /// assert!(a.iter().last().unwrap() == &5);
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn last(mut self) -> Option<Self::Item> { fn last(mut self) -> Option<Self::Item> {
let mut last = None; let mut last = None;
for x in self { last = Some(x); } for x in self { last = Some(x); }
@ -163,7 +163,7 @@ pub trait IteratorExt: Iterator + Sized {
/// assert!(it.nth(2) == None); /// assert!(it.nth(2) == None);
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn nth(&mut self, mut n: uint) -> Option<Self::Item> { fn nth(&mut self, mut n: uint) -> Option<Self::Item> {
for x in *self { for x in *self {
if n == 0 { return Some(x) } if n == 0 { return Some(x) }
@ -187,7 +187,7 @@ pub trait IteratorExt: Iterator + Sized {
/// assert!(it.next().is_none()); /// assert!(it.next().is_none());
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn chain<U>(self, other: U) -> Chain<Self, U> where fn chain<U>(self, other: U) -> Chain<Self, U> where
U: Iterator<Item=Self::Item>, U: Iterator<Item=Self::Item>,
{ {
@ -210,7 +210,7 @@ pub trait IteratorExt: Iterator + Sized {
/// assert!(it.next().is_none()); /// assert!(it.next().is_none());
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn zip<B, U>(self, other: U) -> Zip<Self, U> where fn zip<B, U>(self, other: U) -> Zip<Self, U> where
U: Iterator<Item=B>, U: Iterator<Item=B>,
{ {
@ -230,7 +230,7 @@ pub trait IteratorExt: Iterator + Sized {
/// assert!(it.next().is_none()); /// assert!(it.next().is_none());
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn map<B, F>(self, f: F) -> Map<Self::Item, B, Self, F> where fn map<B, F>(self, f: F) -> Map<Self::Item, B, Self, F> where
F: FnMut(Self::Item) -> B, F: FnMut(Self::Item) -> B,
{ {
@ -250,7 +250,7 @@ pub trait IteratorExt: Iterator + Sized {
/// assert!(it.next().is_none()); /// assert!(it.next().is_none());
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn filter<P>(self, predicate: P) -> Filter<Self::Item, Self, P> where fn filter<P>(self, predicate: P) -> Filter<Self::Item, Self, P> where
P: FnMut(&Self::Item) -> bool, P: FnMut(&Self::Item) -> bool,
{ {
@ -270,7 +270,7 @@ pub trait IteratorExt: Iterator + Sized {
/// assert!(it.next().is_none()); /// assert!(it.next().is_none());
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn filter_map<B, F>(self, f: F) -> FilterMap<Self::Item, B, Self, F> where fn filter_map<B, F>(self, f: F) -> FilterMap<Self::Item, B, Self, F> where
F: FnMut(Self::Item) -> Option<B>, F: FnMut(Self::Item) -> Option<B>,
{ {
@ -291,7 +291,7 @@ pub trait IteratorExt: Iterator + Sized {
/// assert!(it.next().is_none()); /// assert!(it.next().is_none());
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn enumerate(self) -> Enumerate<Self> { fn enumerate(self) -> Enumerate<Self> {
Enumerate{iter: self, count: 0} Enumerate{iter: self, count: 0}
} }
@ -314,7 +314,7 @@ pub trait IteratorExt: Iterator + Sized {
/// assert!(it.next().is_none()); /// assert!(it.next().is_none());
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn peekable(self) -> Peekable<Self::Item, Self> { fn peekable(self) -> Peekable<Self::Item, Self> {
Peekable{iter: self, peeked: None} Peekable{iter: self, peeked: None}
} }
@ -334,7 +334,7 @@ pub trait IteratorExt: Iterator + Sized {
/// assert!(it.next().is_none()); /// assert!(it.next().is_none());
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn skip_while<P>(self, predicate: P) -> SkipWhile<Self::Item, Self, P> where fn skip_while<P>(self, predicate: P) -> SkipWhile<Self::Item, Self, P> where
P: FnMut(&Self::Item) -> bool, P: FnMut(&Self::Item) -> bool,
{ {
@ -355,7 +355,7 @@ pub trait IteratorExt: Iterator + Sized {
/// assert!(it.next().is_none()); /// assert!(it.next().is_none());
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn take_while<P>(self, predicate: P) -> TakeWhile<Self::Item, Self, P> where fn take_while<P>(self, predicate: P) -> TakeWhile<Self::Item, Self, P> where
P: FnMut(&Self::Item) -> bool, P: FnMut(&Self::Item) -> bool,
{ {
@ -375,7 +375,7 @@ pub trait IteratorExt: Iterator + Sized {
/// assert!(it.next().is_none()); /// assert!(it.next().is_none());
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn skip(self, n: uint) -> Skip<Self> { fn skip(self, n: uint) -> Skip<Self> {
Skip{iter: self, n: n} Skip{iter: self, n: n}
} }
@ -394,7 +394,7 @@ pub trait IteratorExt: Iterator + Sized {
/// assert!(it.next().is_none()); /// assert!(it.next().is_none());
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn take(self, n: uint) -> Take<Self> { fn take(self, n: uint) -> Take<Self> {
Take{iter: self, n: n} Take{iter: self, n: n}
} }
@ -420,7 +420,7 @@ pub trait IteratorExt: Iterator + Sized {
/// assert!(it.next().is_none()); /// assert!(it.next().is_none());
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn scan<St, B, F>( fn scan<St, B, F>(
self, self,
initial_state: St, initial_state: St,
@ -450,7 +450,7 @@ pub trait IteratorExt: Iterator + Sized {
/// } /// }
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn flat_map<B, U, F>(self, f: F) -> FlatMap<Self::Item, B, Self, U, F> where fn flat_map<B, U, F>(self, f: F) -> FlatMap<Self::Item, B, Self, U, F> where
U: Iterator<Item=B>, U: Iterator<Item=B>,
F: FnMut(Self::Item) -> U, F: FnMut(Self::Item) -> U,
@ -486,7 +486,7 @@ pub trait IteratorExt: Iterator + Sized {
/// assert_eq!(process(x.into_iter()), 1006); /// assert_eq!(process(x.into_iter()), 1006);
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn fuse(self) -> Fuse<Self> { fn fuse(self) -> Fuse<Self> {
Fuse{iter: self, done: false} Fuse{iter: self, done: false}
} }
@ -510,7 +510,7 @@ pub trait IteratorExt: Iterator + Sized {
/// println!("{}", sum); /// println!("{}", sum);
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn inspect<F>(self, f: F) -> Inspect<Self::Item, Self, F> where fn inspect<F>(self, f: F) -> Inspect<Self::Item, Self, F> where
F: FnMut(&Self::Item), F: FnMut(&Self::Item),
{ {
@ -532,7 +532,7 @@ pub trait IteratorExt: Iterator + Sized {
/// // xs.next() is now `5` /// // xs.next() is now `5`
/// assert!(xs.next() == Some(5)); /// assert!(xs.next() == Some(5));
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn by_ref<'r>(&'r mut self) -> ByRef<'r, Self> { fn by_ref<'r>(&'r mut self) -> ByRef<'r, Self> {
ByRef{iter: self} ByRef{iter: self}
} }
@ -548,7 +548,7 @@ pub trait IteratorExt: Iterator + Sized {
/// assert!(a.as_slice() == b.as_slice()); /// assert!(a.as_slice() == b.as_slice());
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn collect<B: FromIterator<Self::Item>>(self) -> B { fn collect<B: FromIterator<Self::Item>>(self) -> B {
FromIterator::from_iter(self) FromIterator::from_iter(self)
} }
@ -594,7 +594,7 @@ pub trait IteratorExt: Iterator + Sized {
/// assert!(a.iter().fold(0, |a, &b| a + b) == 15); /// assert!(a.iter().fold(0, |a, &b| a + b) == 15);
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn fold<B, F>(mut self, init: B, mut f: F) -> B where fn fold<B, F>(mut self, init: B, mut f: F) -> B where
F: FnMut(B, Self::Item) -> B, F: FnMut(B, Self::Item) -> B,
{ {
@ -615,7 +615,7 @@ pub trait IteratorExt: Iterator + Sized {
/// assert!(!a.iter().all(|x| *x > 2)); /// assert!(!a.iter().all(|x| *x > 2));
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn all<F>(mut self, mut f: F) -> bool where F: FnMut(Self::Item) -> bool { fn all<F>(mut self, mut f: F) -> bool where F: FnMut(Self::Item) -> bool {
for x in self { if !f(x) { return false; } } for x in self { if !f(x) { return false; } }
true true
@ -633,7 +633,7 @@ pub trait IteratorExt: Iterator + Sized {
/// assert!(!it.any(|x| *x == 3)); /// assert!(!it.any(|x| *x == 3));
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn any<F>(&mut self, mut f: F) -> bool where F: FnMut(Self::Item) -> bool { fn any<F>(&mut self, mut f: F) -> bool where F: FnMut(Self::Item) -> bool {
for x in *self { if f(x) { return true; } } for x in *self { if f(x) { return true; } }
false false
@ -643,7 +643,7 @@ pub trait IteratorExt: Iterator + Sized {
/// ///
/// Does not consume the iterator past the first found element. /// Does not consume the iterator past the first found element.
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn find<P>(&mut self, mut predicate: P) -> Option<Self::Item> where fn find<P>(&mut self, mut predicate: P) -> Option<Self::Item> where
P: FnMut(&Self::Item) -> bool, P: FnMut(&Self::Item) -> bool,
{ {
@ -655,7 +655,7 @@ pub trait IteratorExt: Iterator + Sized {
/// Return the index of the first element satisfying the specified predicate /// Return the index of the first element satisfying the specified predicate
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn position<P>(&mut self, mut predicate: P) -> Option<uint> where fn position<P>(&mut self, mut predicate: P) -> Option<uint> where
P: FnMut(Self::Item) -> bool, P: FnMut(Self::Item) -> bool,
{ {
@ -673,7 +673,7 @@ pub trait IteratorExt: Iterator + Sized {
/// ///
/// If no element matches, None is returned. /// If no element matches, None is returned.
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn rposition<P>(&mut self, mut predicate: P) -> Option<uint> where fn rposition<P>(&mut self, mut predicate: P) -> Option<uint> where
P: FnMut(Self::Item) -> bool, P: FnMut(Self::Item) -> bool,
Self: ExactSizeIterator + DoubleEndedIterator Self: ExactSizeIterator + DoubleEndedIterator
@ -696,7 +696,7 @@ pub trait IteratorExt: Iterator + Sized {
/// assert!(a.iter().max().unwrap() == &5); /// assert!(a.iter().max().unwrap() == &5);
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn max(self) -> Option<Self::Item> where Self::Item: Ord fn max(self) -> Option<Self::Item> where Self::Item: Ord
{ {
self.fold(None, |max, x| { self.fold(None, |max, x| {
@ -716,7 +716,7 @@ pub trait IteratorExt: Iterator + Sized {
/// assert!(a.iter().min().unwrap() == &1); /// assert!(a.iter().min().unwrap() == &1);
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn min(self) -> Option<Self::Item> where Self::Item: Ord fn min(self) -> Option<Self::Item> where Self::Item: Ord
{ {
self.fold(None, |min, x| { self.fold(None, |min, x| {
@ -878,7 +878,7 @@ pub trait IteratorExt: Iterator + Sized {
/// Note: Random access with flipped indices still only applies to the first /// Note: Random access with flipped indices still only applies to the first
/// `uint::MAX` elements of the original iterator. /// `uint::MAX` elements of the original iterator.
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn rev(self) -> Rev<Self> { fn rev(self) -> Rev<Self> {
Rev{iter: self} Rev{iter: self}
} }
@ -941,7 +941,7 @@ pub trait IteratorExt: Iterator + Sized {
/// assert_eq!(cy.next(), Some(1)); /// assert_eq!(cy.next(), Some(1));
/// assert_eq!(cy.next(), Some(1)); /// assert_eq!(cy.next(), Some(1));
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[inline] #[inline]
fn cycle(self) -> Cycle<Self> where Self: Clone { fn cycle(self) -> Cycle<Self> where Self: Clone {
Cycle{orig: self.clone(), iter: self} Cycle{orig: self.clone(), iter: self}
@ -962,17 +962,17 @@ pub trait IteratorExt: Iterator + Sized {
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<I> IteratorExt for I where I: Iterator {} impl<I> IteratorExt for I where I: Iterator {}
/// A range iterator able to yield elements from both ends /// A range iterator able to yield elements from both ends
/// ///
/// A `DoubleEndedIterator` can be thought of as a deque in that `next()` and `next_back()` exhaust /// A `DoubleEndedIterator` can be thought of as a deque in that `next()` and `next_back()` exhaust
/// elements from the *same* range, and do not work independently of each other. /// elements from the *same* range, and do not work independently of each other.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub trait DoubleEndedIterator: Iterator { pub trait DoubleEndedIterator: Iterator {
/// Yield an element from the end of the range, returning `None` if the range is empty. /// Yield an element from the end of the range, returning `None` if the range is empty.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn next_back(&mut self) -> Option<Self::Item>; fn next_back(&mut self) -> Option<Self::Item>;
} }
@ -1000,7 +1000,7 @@ pub trait RandomAccessIterator: Iterator {
/// ///
/// `Iterator::size_hint` *must* return the exact size of the iterator. /// `Iterator::size_hint` *must* return the exact size of the iterator.
/// Note that the size must fit in `uint`. /// Note that the size must fit in `uint`.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub trait ExactSizeIterator: Iterator { pub trait ExactSizeIterator: Iterator {
#[inline] #[inline]
/// Return the exact length of the iterator. /// Return the exact length of the iterator.
@ -1017,32 +1017,32 @@ pub trait ExactSizeIterator: Iterator {
// All adaptors that preserve the size of the wrapped iterator are fine // All adaptors that preserve the size of the wrapped iterator are fine
// Adaptors that may overflow in `size_hint` are not, i.e. `Chain`. // Adaptors that may overflow in `size_hint` are not, i.e. `Chain`.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<I> ExactSizeIterator for Enumerate<I> where I: ExactSizeIterator {} impl<I> ExactSizeIterator for Enumerate<I> where I: ExactSizeIterator {}
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<A, I, F> ExactSizeIterator for Inspect<A, I, F> where impl<A, I, F> ExactSizeIterator for Inspect<A, I, F> where
I: ExactSizeIterator<Item=A>, I: ExactSizeIterator<Item=A>,
F: FnMut(&A), F: FnMut(&A),
{} {}
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<I> ExactSizeIterator for Rev<I> where I: ExactSizeIterator + DoubleEndedIterator {} impl<I> ExactSizeIterator for Rev<I> where I: ExactSizeIterator + DoubleEndedIterator {}
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<A, B, I, F> ExactSizeIterator for Map<A, B, I, F> where impl<A, B, I, F> ExactSizeIterator for Map<A, B, I, F> where
I: ExactSizeIterator<Item=A>, I: ExactSizeIterator<Item=A>,
F: FnMut(A) -> B, F: FnMut(A) -> B,
{} {}
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<A, B> ExactSizeIterator for Zip<A, B> where A: ExactSizeIterator, B: ExactSizeIterator {} impl<A, B> ExactSizeIterator for Zip<A, B> where A: ExactSizeIterator, B: ExactSizeIterator {}
/// An double-ended iterator with the direction inverted /// An double-ended iterator with the direction inverted
#[derive(Clone)] #[derive(Clone)]
#[must_use = "iterator adaptors are lazy and do nothing unless consumed"] #[must_use = "iterator adaptors are lazy and do nothing unless consumed"]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub struct Rev<T> { pub struct Rev<T> {
iter: T iter: T
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<I> Iterator for Rev<I> where I: DoubleEndedIterator { impl<I> Iterator for Rev<I> where I: DoubleEndedIterator {
type Item = <I as Iterator>::Item; type Item = <I as Iterator>::Item;
@ -1052,7 +1052,7 @@ impl<I> Iterator for Rev<I> where I: DoubleEndedIterator {
fn size_hint(&self) -> (uint, Option<uint>) { self.iter.size_hint() } fn size_hint(&self) -> (uint, Option<uint>) { self.iter.size_hint() }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<I> DoubleEndedIterator for Rev<I> where I: DoubleEndedIterator { impl<I> DoubleEndedIterator for Rev<I> where I: DoubleEndedIterator {
#[inline] #[inline]
fn next_back(&mut self) -> Option<<I as Iterator>::Item> { self.iter.next() } fn next_back(&mut self) -> Option<<I as Iterator>::Item> { self.iter.next() }
@ -1071,12 +1071,12 @@ impl<I> RandomAccessIterator for Rev<I> where I: DoubleEndedIterator + RandomAcc
/// A mutable reference to an iterator /// A mutable reference to an iterator
#[must_use = "iterator adaptors are lazy and do nothing unless consumed"] #[must_use = "iterator adaptors are lazy and do nothing unless consumed"]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub struct ByRef<'a, I:'a> { pub struct ByRef<'a, I:'a> {
iter: &'a mut I, iter: &'a mut I,
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a, I> Iterator for ByRef<'a, I> where I: 'a + Iterator { impl<'a, I> Iterator for ByRef<'a, I> where I: 'a + Iterator {
type Item = <I as Iterator>::Item; type Item = <I as Iterator>::Item;
@ -1086,7 +1086,7 @@ impl<'a, I> Iterator for ByRef<'a, I> where I: 'a + Iterator {
fn size_hint(&self) -> (uint, Option<uint>) { self.iter.size_hint() } fn size_hint(&self) -> (uint, Option<uint>) { self.iter.size_hint() }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a, I> DoubleEndedIterator for ByRef<'a, I> where I: 'a + DoubleEndedIterator { impl<'a, I> DoubleEndedIterator for ByRef<'a, I> where I: 'a + DoubleEndedIterator {
#[inline] #[inline]
fn next_back(&mut self) -> Option<<I as Iterator>::Item> { self.iter.next_back() } fn next_back(&mut self) -> Option<<I as Iterator>::Item> { self.iter.next_back() }
@ -1232,7 +1232,7 @@ pub struct Cloned<I> {
it: I, it: I,
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<T, D, I> Iterator for Cloned<I> where impl<T, D, I> Iterator for Cloned<I> where
T: Clone, T: Clone,
D: Deref<Target=T>, D: Deref<Target=T>,
@ -1249,7 +1249,7 @@ impl<T, D, I> Iterator for Cloned<I> where
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<T, D, I> DoubleEndedIterator for Cloned<I> where impl<T, D, I> DoubleEndedIterator for Cloned<I> where
T: Clone, T: Clone,
D: Deref<Target=T>, D: Deref<Target=T>,
@ -1260,7 +1260,7 @@ impl<T, D, I> DoubleEndedIterator for Cloned<I> where
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<T, D, I> ExactSizeIterator for Cloned<I> where impl<T, D, I> ExactSizeIterator for Cloned<I> where
T: Clone, T: Clone,
D: Deref<Target=T>, D: Deref<Target=T>,
@ -1270,13 +1270,13 @@ impl<T, D, I> ExactSizeIterator for Cloned<I> where
/// An iterator that repeats endlessly /// An iterator that repeats endlessly
#[derive(Clone, Copy)] #[derive(Clone, Copy)]
#[must_use = "iterator adaptors are lazy and do nothing unless consumed"] #[must_use = "iterator adaptors are lazy and do nothing unless consumed"]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub struct Cycle<I> { pub struct Cycle<I> {
orig: I, orig: I,
iter: I, iter: I,
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<I> Iterator for Cycle<I> where I: Clone + Iterator { impl<I> Iterator for Cycle<I> where I: Clone + Iterator {
type Item = <I as Iterator>::Item; type Item = <I as Iterator>::Item;
@ -1329,14 +1329,14 @@ impl<I> RandomAccessIterator for Cycle<I> where
/// An iterator that strings two iterators together /// An iterator that strings two iterators together
#[derive(Clone)] #[derive(Clone)]
#[must_use = "iterator adaptors are lazy and do nothing unless consumed"] #[must_use = "iterator adaptors are lazy and do nothing unless consumed"]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub struct Chain<A, B> { pub struct Chain<A, B> {
a: A, a: A,
b: B, b: B,
flag: bool, flag: bool,
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<T, A, B> Iterator for Chain<A, B> where A: Iterator<Item=T>, B: Iterator<Item=T> { impl<T, A, B> Iterator for Chain<A, B> where A: Iterator<Item=T>, B: Iterator<Item=T> {
type Item = T; type Item = T;
@ -1370,7 +1370,7 @@ impl<T, A, B> Iterator for Chain<A, B> where A: Iterator<Item=T>, B: Iterator<It
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<T, A, B> DoubleEndedIterator for Chain<A, B> where impl<T, A, B> DoubleEndedIterator for Chain<A, B> where
A: DoubleEndedIterator<Item=T>, A: DoubleEndedIterator<Item=T>,
B: DoubleEndedIterator<Item=T>, B: DoubleEndedIterator<Item=T>,
@ -1409,13 +1409,13 @@ impl<T, A, B> RandomAccessIterator for Chain<A, B> where
/// An iterator that iterates two other iterators simultaneously /// An iterator that iterates two other iterators simultaneously
#[derive(Clone)] #[derive(Clone)]
#[must_use = "iterator adaptors are lazy and do nothing unless consumed"] #[must_use = "iterator adaptors are lazy and do nothing unless consumed"]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub struct Zip<A, B> { pub struct Zip<A, B> {
a: A, a: A,
b: B b: B
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<T, U, A, B> Iterator for Zip<A, B> where impl<T, U, A, B> Iterator for Zip<A, B> where
A: Iterator<Item = T>, A: Iterator<Item = T>,
B: Iterator<Item = U>, B: Iterator<Item = U>,
@ -1451,7 +1451,7 @@ impl<T, U, A, B> Iterator for Zip<A, B> where
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<T, U, A, B> DoubleEndedIterator for Zip<A, B> where impl<T, U, A, B> DoubleEndedIterator for Zip<A, B> where
A: DoubleEndedIterator + ExactSizeIterator<Item=T>, A: DoubleEndedIterator + ExactSizeIterator<Item=T>,
B: DoubleEndedIterator + ExactSizeIterator<Item=U>, B: DoubleEndedIterator + ExactSizeIterator<Item=U>,
@ -1500,14 +1500,14 @@ impl<T, U, A, B> RandomAccessIterator for Zip<A, B> where
/// An iterator that maps the values of `iter` with `f` /// An iterator that maps the values of `iter` with `f`
#[must_use = "iterator adaptors are lazy and do nothing unless consumed"] #[must_use = "iterator adaptors are lazy and do nothing unless consumed"]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub struct Map<A, B, I: Iterator<Item=A>, F: FnMut(A) -> B> { pub struct Map<A, B, I: Iterator<Item=A>, F: FnMut(A) -> B> {
iter: I, iter: I,
f: F, f: F,
} }
// FIXME(#19839) Remove in favor of `#[derive(Clone)]` // FIXME(#19839) Remove in favor of `#[derive(Clone)]`
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<A, B, I, F> Clone for Map<A, B, I, F> where impl<A, B, I, F> Clone for Map<A, B, I, F> where
I: Clone + Iterator<Item=A>, I: Clone + Iterator<Item=A>,
F: Clone + FnMut(A) -> B, F: Clone + FnMut(A) -> B,
@ -1530,7 +1530,7 @@ impl<A, B, I, F> Map<A, B, I, F> where I: Iterator<Item=A>, F: FnMut(A) -> B {
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<A, B, I, F> Iterator for Map<A, B, I, F> where I: Iterator<Item=A>, F: FnMut(A) -> B { impl<A, B, I, F> Iterator for Map<A, B, I, F> where I: Iterator<Item=A>, F: FnMut(A) -> B {
type Item = B; type Item = B;
@ -1546,7 +1546,7 @@ impl<A, B, I, F> Iterator for Map<A, B, I, F> where I: Iterator<Item=A>, F: FnMu
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<A, B, I, F> DoubleEndedIterator for Map<A, B, I, F> where impl<A, B, I, F> DoubleEndedIterator for Map<A, B, I, F> where
I: DoubleEndedIterator<Item=A>, I: DoubleEndedIterator<Item=A>,
F: FnMut(A) -> B, F: FnMut(A) -> B,
@ -1577,14 +1577,14 @@ impl<A, B, I, F> RandomAccessIterator for Map<A, B, I, F> where
/// An iterator that filters the elements of `iter` with `predicate` /// An iterator that filters the elements of `iter` with `predicate`
#[must_use = "iterator adaptors are lazy and do nothing unless consumed"] #[must_use = "iterator adaptors are lazy and do nothing unless consumed"]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub struct Filter<A, I, P> where I: Iterator<Item=A>, P: FnMut(&A) -> bool { pub struct Filter<A, I, P> where I: Iterator<Item=A>, P: FnMut(&A) -> bool {
iter: I, iter: I,
predicate: P, predicate: P,
} }
// FIXME(#19839) Remove in favor of `#[derive(Clone)]` // FIXME(#19839) Remove in favor of `#[derive(Clone)]`
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<A, I, P> Clone for Filter<A, I, P> where impl<A, I, P> Clone for Filter<A, I, P> where
I: Clone + Iterator<Item=A>, I: Clone + Iterator<Item=A>,
P: Clone + FnMut(&A) -> bool, P: Clone + FnMut(&A) -> bool,
@ -1597,7 +1597,7 @@ impl<A, I, P> Clone for Filter<A, I, P> where
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<A, I, P> Iterator for Filter<A, I, P> where I: Iterator<Item=A>, P: FnMut(&A) -> bool { impl<A, I, P> Iterator for Filter<A, I, P> where I: Iterator<Item=A>, P: FnMut(&A) -> bool {
type Item = A; type Item = A;
@ -1620,7 +1620,7 @@ impl<A, I, P> Iterator for Filter<A, I, P> where I: Iterator<Item=A>, P: FnMut(&
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<A, I, P> DoubleEndedIterator for Filter<A, I, P> where impl<A, I, P> DoubleEndedIterator for Filter<A, I, P> where
I: DoubleEndedIterator<Item=A>, I: DoubleEndedIterator<Item=A>,
P: FnMut(&A) -> bool, P: FnMut(&A) -> bool,
@ -1638,14 +1638,14 @@ impl<A, I, P> DoubleEndedIterator for Filter<A, I, P> where
/// An iterator that uses `f` to both filter and map elements from `iter` /// An iterator that uses `f` to both filter and map elements from `iter`
#[must_use = "iterator adaptors are lazy and do nothing unless consumed"] #[must_use = "iterator adaptors are lazy and do nothing unless consumed"]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub struct FilterMap<A, B, I, F> where I: Iterator<Item=A>, F: FnMut(A) -> Option<B> { pub struct FilterMap<A, B, I, F> where I: Iterator<Item=A>, F: FnMut(A) -> Option<B> {
iter: I, iter: I,
f: F, f: F,
} }
// FIXME(#19839) Remove in favor of `#[derive(Clone)]` // FIXME(#19839) Remove in favor of `#[derive(Clone)]`
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<A, B, I, F> Clone for FilterMap<A, B, I, F> where impl<A, B, I, F> Clone for FilterMap<A, B, I, F> where
I: Clone + Iterator<Item=A>, I: Clone + Iterator<Item=A>,
F: Clone + FnMut(A) -> Option<B>, F: Clone + FnMut(A) -> Option<B>,
@ -1658,7 +1658,7 @@ impl<A, B, I, F> Clone for FilterMap<A, B, I, F> where
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<A, B, I, F> Iterator for FilterMap<A, B, I, F> where impl<A, B, I, F> Iterator for FilterMap<A, B, I, F> where
I: Iterator<Item=A>, I: Iterator<Item=A>,
F: FnMut(A) -> Option<B>, F: FnMut(A) -> Option<B>,
@ -1683,7 +1683,7 @@ impl<A, B, I, F> Iterator for FilterMap<A, B, I, F> where
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<A, B, I, F> DoubleEndedIterator for FilterMap<A, B, I, F> where impl<A, B, I, F> DoubleEndedIterator for FilterMap<A, B, I, F> where
I: DoubleEndedIterator<Item=A>, I: DoubleEndedIterator<Item=A>,
F: FnMut(A) -> Option<B>, F: FnMut(A) -> Option<B>,
@ -1703,13 +1703,13 @@ impl<A, B, I, F> DoubleEndedIterator for FilterMap<A, B, I, F> where
/// An iterator that yields the current count and the element during iteration /// An iterator that yields the current count and the element during iteration
#[derive(Clone)] #[derive(Clone)]
#[must_use = "iterator adaptors are lazy and do nothing unless consumed"] #[must_use = "iterator adaptors are lazy and do nothing unless consumed"]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub struct Enumerate<I> { pub struct Enumerate<I> {
iter: I, iter: I,
count: uint count: uint
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<I> Iterator for Enumerate<I> where I: Iterator { impl<I> Iterator for Enumerate<I> where I: Iterator {
type Item = (uint, <I as Iterator>::Item); type Item = (uint, <I as Iterator>::Item);
@ -1731,7 +1731,7 @@ impl<I> Iterator for Enumerate<I> where I: Iterator {
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<I> DoubleEndedIterator for Enumerate<I> where impl<I> DoubleEndedIterator for Enumerate<I> where
I: ExactSizeIterator + DoubleEndedIterator I: ExactSizeIterator + DoubleEndedIterator
{ {
@ -1765,14 +1765,14 @@ impl<I> RandomAccessIterator for Enumerate<I> where I: RandomAccessIterator {
/// An iterator with a `peek()` that returns an optional reference to the next element. /// An iterator with a `peek()` that returns an optional reference to the next element.
#[must_use = "iterator adaptors are lazy and do nothing unless consumed"] #[must_use = "iterator adaptors are lazy and do nothing unless consumed"]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[derive(Copy)] #[derive(Copy)]
pub struct Peekable<T, I> where I: Iterator<Item=T> { pub struct Peekable<T, I> where I: Iterator<Item=T> {
iter: I, iter: I,
peeked: Option<T>, peeked: Option<T>,
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<T, I> Iterator for Peekable<T, I> where I: Iterator<Item=T> { impl<T, I> Iterator for Peekable<T, I> where I: Iterator<Item=T> {
type Item = T; type Item = T;
@ -1798,7 +1798,7 @@ impl<T, I> Iterator for Peekable<T, I> where I: Iterator<Item=T> {
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<T, I> Peekable<T, I> where I: Iterator<Item=T> { impl<T, I> Peekable<T, I> where I: Iterator<Item=T> {
/// Return a reference to the next element of the iterator with out advancing it, /// Return a reference to the next element of the iterator with out advancing it,
/// or None if the iterator is exhausted. /// or None if the iterator is exhausted.
@ -1822,7 +1822,7 @@ impl<T, I> Peekable<T, I> where I: Iterator<Item=T> {
/// An iterator that rejects elements while `predicate` is true /// An iterator that rejects elements while `predicate` is true
#[must_use = "iterator adaptors are lazy and do nothing unless consumed"] #[must_use = "iterator adaptors are lazy and do nothing unless consumed"]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub struct SkipWhile<A, I, P> where I: Iterator<Item=A>, P: FnMut(&A) -> bool { pub struct SkipWhile<A, I, P> where I: Iterator<Item=A>, P: FnMut(&A) -> bool {
iter: I, iter: I,
flag: bool, flag: bool,
@ -1830,7 +1830,7 @@ pub struct SkipWhile<A, I, P> where I: Iterator<Item=A>, P: FnMut(&A) -> bool {
} }
// FIXME(#19839) Remove in favor of `#[derive(Clone)]` // FIXME(#19839) Remove in favor of `#[derive(Clone)]`
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<A, I, P> Clone for SkipWhile<A, I, P> where impl<A, I, P> Clone for SkipWhile<A, I, P> where
I: Clone + Iterator<Item=A>, I: Clone + Iterator<Item=A>,
P: Clone + FnMut(&A) -> bool, P: Clone + FnMut(&A) -> bool,
@ -1844,7 +1844,7 @@ impl<A, I, P> Clone for SkipWhile<A, I, P> where
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<A, I, P> Iterator for SkipWhile<A, I, P> where I: Iterator<Item=A>, P: FnMut(&A) -> bool { impl<A, I, P> Iterator for SkipWhile<A, I, P> where I: Iterator<Item=A>, P: FnMut(&A) -> bool {
type Item = A; type Item = A;
@ -1868,7 +1868,7 @@ impl<A, I, P> Iterator for SkipWhile<A, I, P> where I: Iterator<Item=A>, P: FnMu
/// An iterator that only accepts elements while `predicate` is true /// An iterator that only accepts elements while `predicate` is true
#[must_use = "iterator adaptors are lazy and do nothing unless consumed"] #[must_use = "iterator adaptors are lazy and do nothing unless consumed"]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub struct TakeWhile<A, I, P> where I: Iterator<Item=A>, P: FnMut(&A) -> bool { pub struct TakeWhile<A, I, P> where I: Iterator<Item=A>, P: FnMut(&A) -> bool {
iter: I, iter: I,
flag: bool, flag: bool,
@ -1876,7 +1876,7 @@ pub struct TakeWhile<A, I, P> where I: Iterator<Item=A>, P: FnMut(&A) -> bool {
} }
// FIXME(#19839) Remove in favor of `#[derive(Clone)]` // FIXME(#19839) Remove in favor of `#[derive(Clone)]`
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<A, I, P> Clone for TakeWhile<A, I, P> where impl<A, I, P> Clone for TakeWhile<A, I, P> where
I: Clone + Iterator<Item=A>, I: Clone + Iterator<Item=A>,
P: Clone + FnMut(&A) -> bool, P: Clone + FnMut(&A) -> bool,
@ -1890,7 +1890,7 @@ impl<A, I, P> Clone for TakeWhile<A, I, P> where
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<A, I, P> Iterator for TakeWhile<A, I, P> where I: Iterator<Item=A>, P: FnMut(&A) -> bool { impl<A, I, P> Iterator for TakeWhile<A, I, P> where I: Iterator<Item=A>, P: FnMut(&A) -> bool {
type Item = A; type Item = A;
@ -1923,13 +1923,13 @@ impl<A, I, P> Iterator for TakeWhile<A, I, P> where I: Iterator<Item=A>, P: FnMu
/// An iterator that skips over `n` elements of `iter`. /// An iterator that skips over `n` elements of `iter`.
#[derive(Clone)] #[derive(Clone)]
#[must_use = "iterator adaptors are lazy and do nothing unless consumed"] #[must_use = "iterator adaptors are lazy and do nothing unless consumed"]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub struct Skip<I> { pub struct Skip<I> {
iter: I, iter: I,
n: uint n: uint
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<I> Iterator for Skip<I> where I: Iterator { impl<I> Iterator for Skip<I> where I: Iterator {
type Item = <I as Iterator>::Item; type Item = <I as Iterator>::Item;
@ -1993,13 +1993,13 @@ impl<I> RandomAccessIterator for Skip<I> where I: RandomAccessIterator{
/// An iterator that only iterates over the first `n` iterations of `iter`. /// An iterator that only iterates over the first `n` iterations of `iter`.
#[derive(Clone)] #[derive(Clone)]
#[must_use = "iterator adaptors are lazy and do nothing unless consumed"] #[must_use = "iterator adaptors are lazy and do nothing unless consumed"]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub struct Take<I> { pub struct Take<I> {
iter: I, iter: I,
n: uint n: uint
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<I> Iterator for Take<I> where I: Iterator{ impl<I> Iterator for Take<I> where I: Iterator{
type Item = <I as Iterator>::Item; type Item = <I as Iterator>::Item;
@ -2048,7 +2048,7 @@ impl<I> RandomAccessIterator for Take<I> where I: RandomAccessIterator{
/// An iterator to maintain state while iterating another iterator /// An iterator to maintain state while iterating another iterator
#[must_use = "iterator adaptors are lazy and do nothing unless consumed"] #[must_use = "iterator adaptors are lazy and do nothing unless consumed"]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub struct Scan<A, B, I, St, F> where I: Iterator, F: FnMut(&mut St, A) -> Option<B> { pub struct Scan<A, B, I, St, F> where I: Iterator, F: FnMut(&mut St, A) -> Option<B> {
iter: I, iter: I,
f: F, f: F,
@ -2058,7 +2058,7 @@ pub struct Scan<A, B, I, St, F> where I: Iterator, F: FnMut(&mut St, A) -> Optio
} }
// FIXME(#19839) Remove in favor of `#[derive(Clone)]` // FIXME(#19839) Remove in favor of `#[derive(Clone)]`
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<A, B, I, St, F> Clone for Scan<A, B, I, St, F> where impl<A, B, I, St, F> Clone for Scan<A, B, I, St, F> where
I: Clone + Iterator<Item=A>, I: Clone + Iterator<Item=A>,
St: Clone, St: Clone,
@ -2073,7 +2073,7 @@ impl<A, B, I, St, F> Clone for Scan<A, B, I, St, F> where
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<A, B, I, St, F> Iterator for Scan<A, B, I, St, F> where impl<A, B, I, St, F> Iterator for Scan<A, B, I, St, F> where
I: Iterator<Item=A>, I: Iterator<Item=A>,
F: FnMut(&mut St, A) -> Option<B>, F: FnMut(&mut St, A) -> Option<B>,
@ -2096,7 +2096,7 @@ impl<A, B, I, St, F> Iterator for Scan<A, B, I, St, F> where
/// and yields the elements of the produced iterators /// and yields the elements of the produced iterators
/// ///
#[must_use = "iterator adaptors are lazy and do nothing unless consumed"] #[must_use = "iterator adaptors are lazy and do nothing unless consumed"]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub struct FlatMap<A, B, I, U, F> where pub struct FlatMap<A, B, I, U, F> where
I: Iterator<Item=A>, I: Iterator<Item=A>,
U: Iterator<Item=B>, U: Iterator<Item=B>,
@ -2109,7 +2109,7 @@ pub struct FlatMap<A, B, I, U, F> where
} }
// FIXME(#19839) Remove in favor of `#[derive(Clone)]` // FIXME(#19839) Remove in favor of `#[derive(Clone)]`
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<A, B, I, U, F> Clone for FlatMap<A, B, I, U, F> where impl<A, B, I, U, F> Clone for FlatMap<A, B, I, U, F> where
I: Clone + Iterator<Item=A>, I: Clone + Iterator<Item=A>,
U: Clone + Iterator<Item=B>, U: Clone + Iterator<Item=B>,
@ -2125,7 +2125,7 @@ impl<A, B, I, U, F> Clone for FlatMap<A, B, I, U, F> where
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<A, B, I, U, F> Iterator for FlatMap<A, B, I, U, F> where impl<A, B, I, U, F> Iterator for FlatMap<A, B, I, U, F> where
I: Iterator<Item=A>, I: Iterator<Item=A>,
U: Iterator<Item=B>, U: Iterator<Item=B>,
@ -2160,7 +2160,7 @@ impl<A, B, I, U, F> Iterator for FlatMap<A, B, I, U, F> where
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<A, B, I, U, F> DoubleEndedIterator for FlatMap<A, B, I, U, F> where impl<A, B, I, U, F> DoubleEndedIterator for FlatMap<A, B, I, U, F> where
I: DoubleEndedIterator<Item=A>, I: DoubleEndedIterator<Item=A>,
U: DoubleEndedIterator<Item=B>, U: DoubleEndedIterator<Item=B>,
@ -2187,13 +2187,13 @@ impl<A, B, I, U, F> DoubleEndedIterator for FlatMap<A, B, I, U, F> where
/// yields `None` once. /// yields `None` once.
#[derive(Clone)] #[derive(Clone)]
#[must_use = "iterator adaptors are lazy and do nothing unless consumed"] #[must_use = "iterator adaptors are lazy and do nothing unless consumed"]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub struct Fuse<I> { pub struct Fuse<I> {
iter: I, iter: I,
done: bool done: bool
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<I> Iterator for Fuse<I> where I: Iterator { impl<I> Iterator for Fuse<I> where I: Iterator {
type Item = <I as Iterator>::Item; type Item = <I as Iterator>::Item;
@ -2222,7 +2222,7 @@ impl<I> Iterator for Fuse<I> where I: Iterator {
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<I> DoubleEndedIterator for Fuse<I> where I: DoubleEndedIterator { impl<I> DoubleEndedIterator for Fuse<I> where I: DoubleEndedIterator {
#[inline] #[inline]
fn next_back(&mut self) -> Option<<I as Iterator>::Item> { fn next_back(&mut self) -> Option<<I as Iterator>::Item> {
@ -2267,14 +2267,14 @@ impl<I> Fuse<I> {
/// An iterator that calls a function with a reference to each /// An iterator that calls a function with a reference to each
/// element before yielding it. /// element before yielding it.
#[must_use = "iterator adaptors are lazy and do nothing unless consumed"] #[must_use = "iterator adaptors are lazy and do nothing unless consumed"]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub struct Inspect<A, I, F> where I: Iterator<Item=A>, F: FnMut(&A) { pub struct Inspect<A, I, F> where I: Iterator<Item=A>, F: FnMut(&A) {
iter: I, iter: I,
f: F, f: F,
} }
// FIXME(#19839) Remove in favor of `#[derive(Clone)]` // FIXME(#19839) Remove in favor of `#[derive(Clone)]`
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<A, I, F> Clone for Inspect<A, I, F> where impl<A, I, F> Clone for Inspect<A, I, F> where
I: Clone + Iterator<Item=A>, I: Clone + Iterator<Item=A>,
F: Clone + FnMut(&A), F: Clone + FnMut(&A),
@ -2299,7 +2299,7 @@ impl<A, I, F> Inspect<A, I, F> where I: Iterator<Item=A>, F: FnMut(&A) {
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<A, I, F> Iterator for Inspect<A, I, F> where I: Iterator<Item=A>, F: FnMut(&A) { impl<A, I, F> Iterator for Inspect<A, I, F> where I: Iterator<Item=A>, F: FnMut(&A) {
type Item = A; type Item = A;
@ -2315,7 +2315,7 @@ impl<A, I, F> Iterator for Inspect<A, I, F> where I: Iterator<Item=A>, F: FnMut(
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<A, I, F> DoubleEndedIterator for Inspect<A, I, F> where impl<A, I, F> DoubleEndedIterator for Inspect<A, I, F> where
I: DoubleEndedIterator<Item=A>, I: DoubleEndedIterator<Item=A>,
F: FnMut(&A), F: FnMut(&A),
@ -2384,7 +2384,7 @@ pub struct Unfold<A, St, F> where F: FnMut(&mut St) -> Option<A> {
} }
// FIXME(#19839) Remove in favor of `#[derive(Clone)]` // FIXME(#19839) Remove in favor of `#[derive(Clone)]`
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<A, St, F> Clone for Unfold<A, St, F> where impl<A, St, F> Clone for Unfold<A, St, F> where
F: Clone + FnMut(&mut St) -> Option<A>, F: Clone + FnMut(&mut St) -> Option<A>,
St: Clone, St: Clone,
@ -2410,7 +2410,7 @@ impl<A, St, F> Unfold<A, St, F> where F: FnMut(&mut St) -> Option<A> {
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<A, St, F> Iterator for Unfold<A, St, F> where F: FnMut(&mut St) -> Option<A> { impl<A, St, F> Iterator for Unfold<A, St, F> where F: FnMut(&mut St) -> Option<A> {
type Item = A; type Item = A;
@ -2446,7 +2446,7 @@ pub fn count<A>(start: A, step: A) -> Counter<A> {
Counter{state: start, step: step} Counter{state: start, step: step}
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<A: Add<Output=A> + Clone> Iterator for Counter<A> { impl<A: Add<Output=A> + Clone> Iterator for Counter<A> {
type Item = A; type Item = A;
@ -2786,12 +2786,12 @@ step_impl_no_between!(u64 i64);
/// An iterator that repeats an element endlessly /// An iterator that repeats an element endlessly
#[derive(Clone)] #[derive(Clone)]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub struct Repeat<A> { pub struct Repeat<A> {
element: A element: A
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<A: Clone> Iterator for Repeat<A> { impl<A: Clone> Iterator for Repeat<A> {
type Item = A; type Item = A;
@ -2801,7 +2801,7 @@ impl<A: Clone> Iterator for Repeat<A> {
fn size_hint(&self) -> (uint, Option<uint>) { (uint::MAX, None) } fn size_hint(&self) -> (uint, Option<uint>) { (uint::MAX, None) }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<A: Clone> DoubleEndedIterator for Repeat<A> { impl<A: Clone> DoubleEndedIterator for Repeat<A> {
#[inline] #[inline]
fn next_back(&mut self) -> Option<A> { self.idx(0) } fn next_back(&mut self) -> Option<A> { self.idx(0) }
@ -2855,7 +2855,7 @@ pub fn iterate<T, F>(seed: T, f: F) -> Iterate<T, F> where
/// Create a new iterator that endlessly repeats the element `elt`. /// Create a new iterator that endlessly repeats the element `elt`.
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn repeat<T: Clone>(elt: T) -> Repeat<T> { pub fn repeat<T: Clone>(elt: T) -> Repeat<T> {
Repeat{element: elt} Repeat{element: elt}
} }

View File

@ -52,7 +52,7 @@ macro_rules! panic {
/// assert!(a + b == 30, "a = {}, b = {}", a, b); /// assert!(a + b == 30, "a = {}, b = {}", a, b);
/// ``` /// ```
#[macro_export] #[macro_export]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
macro_rules! assert { macro_rules! assert {
($cond:expr) => ( ($cond:expr) => (
if !$cond { if !$cond {
@ -79,7 +79,7 @@ macro_rules! assert {
/// assert_eq!(a, b); /// assert_eq!(a, b);
/// ``` /// ```
#[macro_export] #[macro_export]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
macro_rules! assert_eq { macro_rules! assert_eq {
($left:expr , $right:expr) => ({ ($left:expr , $right:expr) => ({
match (&($left), &($right)) { match (&($left), &($right)) {
@ -123,7 +123,7 @@ macro_rules! assert_eq {
/// debug_assert!(a + b == 30, "a = {}, b = {}", a, b); /// debug_assert!(a + b == 30, "a = {}, b = {}", a, b);
/// ``` /// ```
#[macro_export] #[macro_export]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
macro_rules! debug_assert { macro_rules! debug_assert {
($($arg:tt)*) => (if cfg!(not(ndebug)) { assert!($($arg)*); }) ($($arg:tt)*) => (if cfg!(not(ndebug)) { assert!($($arg)*); })
} }
@ -185,7 +185,7 @@ macro_rules! write {
/// Equivalent to the `write!` macro, except that a newline is appended after /// Equivalent to the `write!` macro, except that a newline is appended after
/// the message is written. /// the message is written.
#[macro_export] #[macro_export]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
macro_rules! writeln { macro_rules! writeln {
($dst:expr, $fmt:expr) => ( ($dst:expr, $fmt:expr) => (
write!($dst, concat!($fmt, "\n")) write!($dst, concat!($fmt, "\n"))

View File

@ -23,7 +23,7 @@
//! implemented using unsafe code. In that case, you may want to embed //! implemented using unsafe code. In that case, you may want to embed
//! some of the marker types below into your type. //! some of the marker types below into your type.
#![stable(feature = "grandfathered", since = "1.0.0")] #![stable(feature = "rust1", since = "1.0.0")]
use clone::Clone; use clone::Clone;
@ -36,7 +36,7 @@ pub unsafe trait Send: 'static {
} }
/// Types with a constant size known at compile-time. /// Types with a constant size known at compile-time.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[lang="sized"] #[lang="sized"]
pub trait Sized { pub trait Sized {
// Empty. // Empty.
@ -141,7 +141,7 @@ pub trait Sized {
/// to consider though: if you think your type may _not_ be able to implement `Copy` in the future, /// to consider though: if you think your type may _not_ be able to implement `Copy` in the future,
/// then it might be prudent to not implement `Copy`. This is because removing `Copy` is a breaking /// then it might be prudent to not implement `Copy`. This is because removing `Copy` is a breaking
/// change: that second example would fail to compile if we made `Foo` non-`Copy`. /// change: that second example would fail to compile if we made `Foo` non-`Copy`.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[lang="copy"] #[lang="copy"]
pub trait Copy { pub trait Copy {
// Empty. // Empty.

View File

@ -13,13 +13,13 @@
//! This module contains functions for querying the size and alignment of //! This module contains functions for querying the size and alignment of
//! types, initializing and manipulating memory. //! types, initializing and manipulating memory.
#![stable(feature = "grandfathered", since = "1.0.0")] #![stable(feature = "rust1", since = "1.0.0")]
use marker::Sized; use marker::Sized;
use intrinsics; use intrinsics;
use ptr; use ptr;
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub use intrinsics::transmute; pub use intrinsics::transmute;
/// Moves a thing into the void. /// Moves a thing into the void.
@ -29,7 +29,7 @@ pub use intrinsics::transmute;
/// ///
/// This function is the unsafe version of the `drop` function because it does /// This function is the unsafe version of the `drop` function because it does
/// not run any destructors. /// not run any destructors.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub use intrinsics::forget; pub use intrinsics::forget;
/// Returns the size of a type in bytes. /// Returns the size of a type in bytes.
@ -42,7 +42,7 @@ pub use intrinsics::forget;
/// assert_eq!(4, mem::size_of::<i32>()); /// assert_eq!(4, mem::size_of::<i32>());
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn size_of<T>() -> uint { pub fn size_of<T>() -> uint {
unsafe { intrinsics::size_of::<T>() } unsafe { intrinsics::size_of::<T>() }
} }
@ -57,7 +57,7 @@ pub fn size_of<T>() -> uint {
/// assert_eq!(4, mem::size_of_val(&5i32)); /// assert_eq!(4, mem::size_of_val(&5i32));
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn size_of_val<T>(_val: &T) -> uint { pub fn size_of_val<T>(_val: &T) -> uint {
size_of::<T>() size_of::<T>()
} }
@ -74,7 +74,7 @@ pub fn size_of_val<T>(_val: &T) -> uint {
/// assert_eq!(4, mem::min_align_of::<i32>()); /// assert_eq!(4, mem::min_align_of::<i32>());
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn min_align_of<T>() -> uint { pub fn min_align_of<T>() -> uint {
unsafe { intrinsics::min_align_of::<T>() } unsafe { intrinsics::min_align_of::<T>() }
} }
@ -89,7 +89,7 @@ pub fn min_align_of<T>() -> uint {
/// assert_eq!(4, mem::min_align_of_val(&5i32)); /// assert_eq!(4, mem::min_align_of_val(&5i32));
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn min_align_of_val<T>(_val: &T) -> uint { pub fn min_align_of_val<T>(_val: &T) -> uint {
min_align_of::<T>() min_align_of::<T>()
} }
@ -107,7 +107,7 @@ pub fn min_align_of_val<T>(_val: &T) -> uint {
/// assert_eq!(4, mem::align_of::<i32>()); /// assert_eq!(4, mem::align_of::<i32>());
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn align_of<T>() -> uint { pub fn align_of<T>() -> uint {
// We use the preferred alignment as the default alignment for a type. This // We use the preferred alignment as the default alignment for a type. This
// appears to be what clang migrated towards as well: // appears to be what clang migrated towards as well:
@ -129,7 +129,7 @@ pub fn align_of<T>() -> uint {
/// assert_eq!(4, mem::align_of_val(&5i32)); /// assert_eq!(4, mem::align_of_val(&5i32));
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn align_of_val<T>(_val: &T) -> uint { pub fn align_of_val<T>(_val: &T) -> uint {
align_of::<T>() align_of::<T>()
} }
@ -153,7 +153,7 @@ pub fn align_of_val<T>(_val: &T) -> uint {
/// let x: int = unsafe { mem::zeroed() }; /// let x: int = unsafe { mem::zeroed() };
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub unsafe fn zeroed<T>() -> T { pub unsafe fn zeroed<T>() -> T {
intrinsics::init() intrinsics::init()
} }
@ -174,7 +174,7 @@ pub unsafe fn zeroed<T>() -> T {
/// let x: int = unsafe { mem::uninitialized() }; /// let x: int = unsafe { mem::uninitialized() };
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub unsafe fn uninitialized<T>() -> T { pub unsafe fn uninitialized<T>() -> T {
intrinsics::uninit() intrinsics::uninit()
} }
@ -196,7 +196,7 @@ pub unsafe fn uninitialized<T>() -> T {
/// assert_eq!(5i, *y); /// assert_eq!(5i, *y);
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn swap<T>(x: &mut T, y: &mut T) { pub fn swap<T>(x: &mut T, y: &mut T) {
unsafe { unsafe {
// Give ourselves some scratch space to work with // Give ourselves some scratch space to work with
@ -261,7 +261,7 @@ pub fn swap<T>(x: &mut T, y: &mut T) {
/// } /// }
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn replace<T>(dest: &mut T, mut src: T) -> T { pub fn replace<T>(dest: &mut T, mut src: T) -> T {
swap(dest, &mut src); swap(dest, &mut src);
src src
@ -288,7 +288,7 @@ pub fn replace<T>(dest: &mut T, mut src: T) -> T {
/// println!("{}", *borrow); /// println!("{}", *borrow);
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn drop<T>(_x: T) { } pub fn drop<T>(_x: T) { }
/// Interprets `src` as `&U`, and then reads `src` without moving the contained value. /// Interprets `src` as `&U`, and then reads `src` without moving the contained value.
@ -311,7 +311,7 @@ pub fn drop<T>(_x: T) { }
/// assert_eq!(1u, one); /// assert_eq!(1u, one);
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub unsafe fn transmute_copy<T, U>(src: &T) -> U { pub unsafe fn transmute_copy<T, U>(src: &T) -> U {
ptr::read(src as *const T as *const U) ptr::read(src as *const T as *const U)
} }

View File

@ -14,7 +14,7 @@
// FIXME: MIN_VALUE and MAX_VALUE literals are parsed as -inf and inf #14353 // FIXME: MIN_VALUE and MAX_VALUE literals are parsed as -inf and inf #14353
#![allow(overflowing_literals)] #![allow(overflowing_literals)]
#![stable(feature = "grandfathered", since = "1.0.0")] #![stable(feature = "rust1", since = "1.0.0")]
use intrinsics; use intrinsics;
use mem; use mem;
@ -30,17 +30,17 @@ pub const MANTISSA_DIGITS: uint = 24u;
#[unstable(feature = "core", reason = "pending integer conventions")] #[unstable(feature = "core", reason = "pending integer conventions")]
pub const DIGITS: uint = 6u; pub const DIGITS: uint = 6u;
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub const EPSILON: f32 = 1.19209290e-07_f32; pub const EPSILON: f32 = 1.19209290e-07_f32;
/// Smallest finite f32 value /// Smallest finite f32 value
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub const MIN_VALUE: f32 = -3.40282347e+38_f32; pub const MIN_VALUE: f32 = -3.40282347e+38_f32;
/// Smallest positive, normalized f32 value /// Smallest positive, normalized f32 value
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub const MIN_POS_VALUE: f32 = 1.17549435e-38_f32; pub const MIN_POS_VALUE: f32 = 1.17549435e-38_f32;
/// Largest finite f32 value /// Largest finite f32 value
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub const MAX_VALUE: f32 = 3.40282347e+38_f32; pub const MAX_VALUE: f32 = 3.40282347e+38_f32;
#[unstable(feature = "core", reason = "pending integer conventions")] #[unstable(feature = "core", reason = "pending integer conventions")]
@ -53,11 +53,11 @@ pub const MIN_10_EXP: int = -37;
#[unstable(feature = "core", reason = "pending integer conventions")] #[unstable(feature = "core", reason = "pending integer conventions")]
pub const MAX_10_EXP: int = 38; pub const MAX_10_EXP: int = 38;
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub const NAN: f32 = 0.0_f32/0.0_f32; pub const NAN: f32 = 0.0_f32/0.0_f32;
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub const INFINITY: f32 = 1.0_f32/0.0_f32; pub const INFINITY: f32 = 1.0_f32/0.0_f32;
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub const NEG_INFINITY: f32 = -1.0_f32/0.0_f32; pub const NEG_INFINITY: f32 = -1.0_f32/0.0_f32;
/// Various useful constants. /// Various useful constants.

View File

@ -14,7 +14,7 @@
// FIXME: MIN_VALUE and MAX_VALUE literals are parsed as -inf and inf #14353 // FIXME: MIN_VALUE and MAX_VALUE literals are parsed as -inf and inf #14353
#![allow(overflowing_literals)] #![allow(overflowing_literals)]
#![stable(feature = "grandfathered", since = "1.0.0")] #![stable(feature = "rust1", since = "1.0.0")]
use intrinsics; use intrinsics;
use mem; use mem;
@ -33,17 +33,17 @@ pub const MANTISSA_DIGITS: uint = 53u;
#[unstable(feature = "core", reason = "pending integer conventions")] #[unstable(feature = "core", reason = "pending integer conventions")]
pub const DIGITS: uint = 15u; pub const DIGITS: uint = 15u;
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub const EPSILON: f64 = 2.2204460492503131e-16_f64; pub const EPSILON: f64 = 2.2204460492503131e-16_f64;
/// Smallest finite f64 value /// Smallest finite f64 value
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub const MIN_VALUE: f64 = -1.7976931348623157e+308_f64; pub const MIN_VALUE: f64 = -1.7976931348623157e+308_f64;
/// Smallest positive, normalized f64 value /// Smallest positive, normalized f64 value
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub const MIN_POS_VALUE: f64 = 2.2250738585072014e-308_f64; pub const MIN_POS_VALUE: f64 = 2.2250738585072014e-308_f64;
/// Largest finite f64 value /// Largest finite f64 value
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub const MAX_VALUE: f64 = 1.7976931348623157e+308_f64; pub const MAX_VALUE: f64 = 1.7976931348623157e+308_f64;
#[unstable(feature = "core", reason = "pending integer conventions")] #[unstable(feature = "core", reason = "pending integer conventions")]
@ -56,11 +56,11 @@ pub const MIN_10_EXP: int = -307;
#[unstable(feature = "core", reason = "pending integer conventions")] #[unstable(feature = "core", reason = "pending integer conventions")]
pub const MAX_10_EXP: int = 308; pub const MAX_10_EXP: int = 308;
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub const NAN: f64 = 0.0_f64/0.0_f64; pub const NAN: f64 = 0.0_f64/0.0_f64;
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub const INFINITY: f64 = 1.0_f64/0.0_f64; pub const INFINITY: f64 = 1.0_f64/0.0_f64;
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub const NEG_INFINITY: f64 = -1.0_f64/0.0_f64; pub const NEG_INFINITY: f64 = -1.0_f64/0.0_f64;
/// Various useful constants. /// Various useful constants.

View File

@ -10,7 +10,7 @@
//! Operations and constants for signed 16-bits integers (`i16` type) //! Operations and constants for signed 16-bits integers (`i16` type)
#![stable(feature = "grandfathered", since = "1.0.0")] #![stable(feature = "rust1", since = "1.0.0")]
#![doc(primitive = "i16")] #![doc(primitive = "i16")]
int_module! { i16, 16 } int_module! { i16, 16 }

View File

@ -10,7 +10,7 @@
//! Operations and constants for signed 32-bits integers (`i32` type) //! Operations and constants for signed 32-bits integers (`i32` type)
#![stable(feature = "grandfathered", since = "1.0.0")] #![stable(feature = "rust1", since = "1.0.0")]
#![doc(primitive = "i32")] #![doc(primitive = "i32")]
int_module! { i32, 32 } int_module! { i32, 32 }

View File

@ -10,7 +10,7 @@
//! Operations and constants for signed 64-bits integers (`i64` type) //! Operations and constants for signed 64-bits integers (`i64` type)
#![stable(feature = "grandfathered", since = "1.0.0")] #![stable(feature = "rust1", since = "1.0.0")]
#![doc(primitive = "i64")] #![doc(primitive = "i64")]
int_module! { i64, 64 } int_module! { i64, 64 }

View File

@ -10,7 +10,7 @@
//! Operations and constants for signed 8-bits integers (`i8` type) //! Operations and constants for signed 8-bits integers (`i8` type)
#![stable(feature = "grandfathered", since = "1.0.0")] #![stable(feature = "rust1", since = "1.0.0")]
#![doc(primitive = "i8")] #![doc(primitive = "i8")]
int_module! { i8, 8 } int_module! { i8, 8 }

View File

@ -23,12 +23,12 @@ pub const BYTES : uint = ($bits / 8);
// FIXME(#11621): Should be deprecated once CTFE is implemented in favour of // FIXME(#11621): Should be deprecated once CTFE is implemented in favour of
// calling the `Bounded::min_value` function. // calling the `Bounded::min_value` function.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub const MIN: $T = (-1 as $T) << (BITS - 1); pub const MIN: $T = (-1 as $T) << (BITS - 1);
// FIXME(#9837): Compute MIN like this so the high bits that shouldn't exist are 0. // FIXME(#9837): Compute MIN like this so the high bits that shouldn't exist are 0.
// FIXME(#11621): Should be deprecated once CTFE is implemented in favour of // FIXME(#11621): Should be deprecated once CTFE is implemented in favour of
// calling the `Bounded::max_value` function. // calling the `Bounded::max_value` function.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub const MAX: $T = !MIN; pub const MAX: $T = !MIN;
) } ) }

View File

@ -14,7 +14,7 @@
//! new type will gradually take place over the alpha cycle along with //! new type will gradually take place over the alpha cycle along with
//! the development of clearer conventions around integer types. //! the development of clearer conventions around integer types.
#![stable(feature = "grandfathered", since = "1.0.0")] #![stable(feature = "rust1", since = "1.0.0")]
#![doc(primitive = "isize")] #![doc(primitive = "isize")]
#[cfg(target_pointer_width = "32")] #[cfg(target_pointer_width = "32")]

View File

@ -12,7 +12,7 @@
//! Numeric traits and functions for the built-in numeric types. //! Numeric traits and functions for the built-in numeric types.
#![stable(feature = "grandfathered", since = "1.0.0")] #![stable(feature = "rust1", since = "1.0.0")]
#![allow(missing_docs)] #![allow(missing_docs)]
use char::CharExt; use char::CharExt;
@ -30,7 +30,7 @@ use option::Option::{Some, None};
use str::{FromStr, StrExt}; use str::{FromStr, StrExt};
/// A built-in signed or unsigned integer. /// A built-in signed or unsigned integer.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub trait Int pub trait Int
: Copy + Clone : Copy + Clone
+ NumCast + NumCast
@ -183,7 +183,7 @@ pub trait Int
/// ///
/// assert_eq!(n.swap_bytes(), m); /// assert_eq!(n.swap_bytes(), m);
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn swap_bytes(self) -> Self; fn swap_bytes(self) -> Self;
/// Convert an integer from big endian to the target's endianness. /// Convert an integer from big endian to the target's endianness.
@ -203,7 +203,7 @@ pub trait Int
/// assert_eq!(Int::from_be(n), n.swap_bytes()) /// assert_eq!(Int::from_be(n), n.swap_bytes())
/// } /// }
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[inline] #[inline]
fn from_be(x: Self) -> Self { fn from_be(x: Self) -> Self {
if cfg!(target_endian = "big") { x } else { x.swap_bytes() } if cfg!(target_endian = "big") { x } else { x.swap_bytes() }
@ -226,7 +226,7 @@ pub trait Int
/// assert_eq!(Int::from_le(n), n.swap_bytes()) /// assert_eq!(Int::from_le(n), n.swap_bytes())
/// } /// }
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[inline] #[inline]
fn from_le(x: Self) -> Self { fn from_le(x: Self) -> Self {
if cfg!(target_endian = "little") { x } else { x.swap_bytes() } if cfg!(target_endian = "little") { x } else { x.swap_bytes() }
@ -249,7 +249,7 @@ pub trait Int
/// assert_eq!(n.to_be(), n.swap_bytes()) /// assert_eq!(n.to_be(), n.swap_bytes())
/// } /// }
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[inline] #[inline]
fn to_be(self) -> Self { // or not to be? fn to_be(self) -> Self { // or not to be?
if cfg!(target_endian = "big") { self } else { self.swap_bytes() } if cfg!(target_endian = "big") { self } else { self.swap_bytes() }
@ -272,7 +272,7 @@ pub trait Int
/// assert_eq!(n.to_le(), n.swap_bytes()) /// assert_eq!(n.to_le(), n.swap_bytes())
/// } /// }
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[inline] #[inline]
fn to_le(self) -> Self { fn to_le(self) -> Self {
if cfg!(target_endian = "little") { self } else { self.swap_bytes() } if cfg!(target_endian = "little") { self } else { self.swap_bytes() }
@ -289,7 +289,7 @@ pub trait Int
/// assert_eq!(5u16.checked_add(65530), Some(65535)); /// assert_eq!(5u16.checked_add(65530), Some(65535));
/// assert_eq!(6u16.checked_add(65530), None); /// assert_eq!(6u16.checked_add(65530), None);
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn checked_add(self, other: Self) -> Option<Self>; fn checked_add(self, other: Self) -> Option<Self>;
/// Checked integer subtraction. Computes `self - other`, returning `None` /// Checked integer subtraction. Computes `self - other`, returning `None`
@ -303,7 +303,7 @@ pub trait Int
/// assert_eq!((-127i8).checked_sub(1), Some(-128)); /// assert_eq!((-127i8).checked_sub(1), Some(-128));
/// assert_eq!((-128i8).checked_sub(1), None); /// assert_eq!((-128i8).checked_sub(1), None);
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn checked_sub(self, other: Self) -> Option<Self>; fn checked_sub(self, other: Self) -> Option<Self>;
/// Checked integer multiplication. Computes `self * other`, returning /// Checked integer multiplication. Computes `self * other`, returning
@ -317,7 +317,7 @@ pub trait Int
/// assert_eq!(5u8.checked_mul(51), Some(255)); /// assert_eq!(5u8.checked_mul(51), Some(255));
/// assert_eq!(5u8.checked_mul(52), None); /// assert_eq!(5u8.checked_mul(52), None);
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn checked_mul(self, other: Self) -> Option<Self>; fn checked_mul(self, other: Self) -> Option<Self>;
/// Checked integer division. Computes `self / other`, returning `None` if /// Checked integer division. Computes `self / other`, returning `None` if
@ -332,12 +332,12 @@ pub trait Int
/// assert_eq!((-128i8).checked_div(-1), None); /// assert_eq!((-128i8).checked_div(-1), None);
/// assert_eq!((1i8).checked_div(0), None); /// assert_eq!((1i8).checked_div(0), None);
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn checked_div(self, other: Self) -> Option<Self>; fn checked_div(self, other: Self) -> Option<Self>;
/// Saturating integer addition. Computes `self + other`, saturating at /// Saturating integer addition. Computes `self + other`, saturating at
/// the numeric bounds instead of overflowing. /// the numeric bounds instead of overflowing.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[inline] #[inline]
fn saturating_add(self, other: Self) -> Self { fn saturating_add(self, other: Self) -> Self {
match self.checked_add(other) { match self.checked_add(other) {
@ -349,7 +349,7 @@ pub trait Int
/// Saturating integer subtraction. Computes `self - other`, saturating at /// Saturating integer subtraction. Computes `self - other`, saturating at
/// the numeric bounds instead of overflowing. /// the numeric bounds instead of overflowing.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[inline] #[inline]
fn saturating_sub(self, other: Self) -> Self { fn saturating_sub(self, other: Self) -> Self {
match self.checked_sub(other) { match self.checked_sub(other) {
@ -401,7 +401,7 @@ macro_rules! uint_impl {
$add_with_overflow:path, $add_with_overflow:path,
$sub_with_overflow:path, $sub_with_overflow:path,
$mul_with_overflow:path) => { $mul_with_overflow:path) => {
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl Int for $T { impl Int for $T {
#[inline] #[inline]
fn zero() -> $T { 0 } fn zero() -> $T { 0 }
@ -532,7 +532,7 @@ macro_rules! int_impl {
$add_with_overflow:path, $add_with_overflow:path,
$sub_with_overflow:path, $sub_with_overflow:path,
$mul_with_overflow:path) => { $mul_with_overflow:path) => {
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl Int for $T { impl Int for $T {
#[inline] #[inline]
fn zero() -> $T { 0 } fn zero() -> $T { 0 }
@ -625,7 +625,7 @@ int_impl! { int = i64, u64, 64,
intrinsics::i64_mul_with_overflow } intrinsics::i64_mul_with_overflow }
/// A built-in two's complement integer. /// A built-in two's complement integer.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub trait SignedInt pub trait SignedInt
: Int : Int
+ Neg<Output=Self> + Neg<Output=Self>
@ -640,23 +640,23 @@ pub trait SignedInt
/// - `0` if the number is zero /// - `0` if the number is zero
/// - `1` if the number is positive /// - `1` if the number is positive
/// - `-1` if the number is negative /// - `-1` if the number is negative
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn signum(self) -> Self; fn signum(self) -> Self;
/// Returns `true` if `self` is positive and `false` if the number /// Returns `true` if `self` is positive and `false` if the number
/// is zero or negative. /// is zero or negative.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn is_positive(self) -> bool; fn is_positive(self) -> bool;
/// Returns `true` if `self` is negative and `false` if the number /// Returns `true` if `self` is negative and `false` if the number
/// is zero or positive. /// is zero or positive.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn is_negative(self) -> bool; fn is_negative(self) -> bool;
} }
macro_rules! signed_int_impl { macro_rules! signed_int_impl {
($T:ty) => { ($T:ty) => {
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl SignedInt for $T { impl SignedInt for $T {
#[inline] #[inline]
fn abs(self) -> $T { fn abs(self) -> $T {
@ -688,10 +688,10 @@ signed_int_impl! { i64 }
signed_int_impl! { int } signed_int_impl! { int }
/// A built-in unsigned integer. /// A built-in unsigned integer.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub trait UnsignedInt: Int { pub trait UnsignedInt: Int {
/// Returns `true` iff `self == 2^k` for some `k`. /// Returns `true` iff `self == 2^k` for some `k`.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[inline] #[inline]
fn is_power_of_two(self) -> bool { fn is_power_of_two(self) -> bool {
(self - Int::one()) & self == Int::zero() && !(self == Int::zero()) (self - Int::one()) & self == Int::zero() && !(self == Int::zero())
@ -699,7 +699,7 @@ pub trait UnsignedInt: Int {
/// Returns the smallest power of two greater than or equal to `self`. /// Returns the smallest power of two greater than or equal to `self`.
/// Unspecified behavior on overflow. /// Unspecified behavior on overflow.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[inline] #[inline]
fn next_power_of_two(self) -> Self { fn next_power_of_two(self) -> Self {
let bits = size_of::<Self>() * 8; let bits = size_of::<Self>() * 8;
@ -710,7 +710,7 @@ pub trait UnsignedInt: Int {
/// Returns the smallest power of two greater than or equal to `n`. If the /// Returns the smallest power of two greater than or equal to `n`. If the
/// next power of two is greater than the type's maximum value, `None` is /// next power of two is greater than the type's maximum value, `None` is
/// returned, otherwise the power of two is wrapped in `Some`. /// returned, otherwise the power of two is wrapped in `Some`.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn checked_next_power_of_two(self) -> Option<Self> { fn checked_next_power_of_two(self) -> Option<Self> {
let npot = self.next_power_of_two(); let npot = self.next_power_of_two();
if npot >= self { if npot >= self {
@ -721,19 +721,19 @@ pub trait UnsignedInt: Int {
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl UnsignedInt for uint {} impl UnsignedInt for uint {}
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl UnsignedInt for u8 {} impl UnsignedInt for u8 {}
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl UnsignedInt for u16 {} impl UnsignedInt for u16 {}
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl UnsignedInt for u32 {} impl UnsignedInt for u32 {}
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl UnsignedInt for u64 {} impl UnsignedInt for u64 {}
/// A generic trait for converting a value to a number. /// A generic trait for converting a value to a number.

View File

@ -10,7 +10,7 @@
//! Operations and constants for unsigned 16-bits integers (`u16` type) //! Operations and constants for unsigned 16-bits integers (`u16` type)
#![stable(feature = "grandfathered", since = "1.0.0")] #![stable(feature = "rust1", since = "1.0.0")]
#![doc(primitive = "u16")] #![doc(primitive = "u16")]
uint_module! { u16, i16, 16 } uint_module! { u16, i16, 16 }

View File

@ -10,7 +10,7 @@
//! Operations and constants for unsigned 32-bits integers (`u32` type) //! Operations and constants for unsigned 32-bits integers (`u32` type)
#![stable(feature = "grandfathered", since = "1.0.0")] #![stable(feature = "rust1", since = "1.0.0")]
#![doc(primitive = "u32")] #![doc(primitive = "u32")]
uint_module! { u32, i32, 32 } uint_module! { u32, i32, 32 }

View File

@ -10,7 +10,7 @@
//! Operations and constants for unsigned 64-bits integer (`u64` type) //! Operations and constants for unsigned 64-bits integer (`u64` type)
#![stable(feature = "grandfathered", since = "1.0.0")] #![stable(feature = "rust1", since = "1.0.0")]
#![doc(primitive = "u64")] #![doc(primitive = "u64")]
uint_module! { u64, i64, 64 } uint_module! { u64, i64, 64 }

View File

@ -10,7 +10,7 @@
//! Operations and constants for unsigned 8-bits integers (`u8` type) //! Operations and constants for unsigned 8-bits integers (`u8` type)
#![stable(feature = "grandfathered", since = "1.0.0")] #![stable(feature = "rust1", since = "1.0.0")]
#![doc(primitive = "u8")] #![doc(primitive = "u8")]
uint_module! { u8, i8, 8 } uint_module! { u8, i8, 8 }

View File

@ -17,9 +17,9 @@ pub const BITS : uint = $bits;
#[unstable(feature = "core")] #[unstable(feature = "core")]
pub const BYTES : uint = ($bits / 8); pub const BYTES : uint = ($bits / 8);
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub const MIN: $T = 0 as $T; pub const MIN: $T = 0 as $T;
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub const MAX: $T = 0 as $T - 1 as $T; pub const MAX: $T = 0 as $T - 1 as $T;
) } ) }

View File

@ -14,7 +14,7 @@
//! new type will gradually take place over the alpha cycle along with //! new type will gradually take place over the alpha cycle along with
//! the development of clearer conventions around integer types. //! the development of clearer conventions around integer types.
#![stable(feature = "grandfathered", since = "1.0.0")] #![stable(feature = "rust1", since = "1.0.0")]
#![doc(primitive = "usize")] #![doc(primitive = "usize")]
uint_module! { usize, isize, ::isize::BITS } uint_module! { usize, isize, ::isize::BITS }

View File

@ -67,7 +67,7 @@
//! See the documentation for each trait for a minimum implementation that prints //! See the documentation for each trait for a minimum implementation that prints
//! something to the screen. //! something to the screen.
#![stable(feature = "grandfathered", since = "1.0.0")] #![stable(feature = "rust1", since = "1.0.0")]
use clone::Clone; use clone::Clone;
use iter::{Step, Iterator,DoubleEndedIterator,ExactSizeIterator}; use iter::{Step, Iterator,DoubleEndedIterator,ExactSizeIterator};
@ -97,10 +97,10 @@ use fmt;
/// } /// }
/// ``` /// ```
#[lang="drop"] #[lang="drop"]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub trait Drop { pub trait Drop {
/// The `drop` method, called when the value goes out of scope. /// The `drop` method, called when the value goes out of scope.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn drop(&mut self); fn drop(&mut self);
} }
@ -189,19 +189,19 @@ macro_rules! forward_ref_binop {
/// } /// }
/// ``` /// ```
#[lang="add"] #[lang="add"]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub trait Add<RHS=Self> { pub trait Add<RHS=Self> {
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
type Output; type Output;
/// The method for the `+` operator /// The method for the `+` operator
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn add(self, rhs: RHS) -> Self::Output; fn add(self, rhs: RHS) -> Self::Output;
} }
macro_rules! add_impl { macro_rules! add_impl {
($($t:ty)*) => ($( ($($t:ty)*) => ($(
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl Add for $t { impl Add for $t {
type Output = $t; type Output = $t;
@ -244,19 +244,19 @@ add_impl! { uint u8 u16 u32 u64 int i8 i16 i32 i64 f32 f64 }
/// } /// }
/// ``` /// ```
#[lang="sub"] #[lang="sub"]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub trait Sub<RHS=Self> { pub trait Sub<RHS=Self> {
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
type Output; type Output;
/// The method for the `-` operator /// The method for the `-` operator
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn sub(self, rhs: RHS) -> Self::Output; fn sub(self, rhs: RHS) -> Self::Output;
} }
macro_rules! sub_impl { macro_rules! sub_impl {
($($t:ty)*) => ($( ($($t:ty)*) => ($(
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl Sub for $t { impl Sub for $t {
type Output = $t; type Output = $t;
@ -299,19 +299,19 @@ sub_impl! { uint u8 u16 u32 u64 int i8 i16 i32 i64 f32 f64 }
/// } /// }
/// ``` /// ```
#[lang="mul"] #[lang="mul"]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub trait Mul<RHS=Self> { pub trait Mul<RHS=Self> {
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
type Output; type Output;
/// The method for the `*` operator /// The method for the `*` operator
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn mul(self, rhs: RHS) -> Self::Output; fn mul(self, rhs: RHS) -> Self::Output;
} }
macro_rules! mul_impl { macro_rules! mul_impl {
($($t:ty)*) => ($( ($($t:ty)*) => ($(
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl Mul for $t { impl Mul for $t {
type Output = $t; type Output = $t;
@ -354,19 +354,19 @@ mul_impl! { uint u8 u16 u32 u64 int i8 i16 i32 i64 f32 f64 }
/// } /// }
/// ``` /// ```
#[lang="div"] #[lang="div"]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub trait Div<RHS=Self> { pub trait Div<RHS=Self> {
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
type Output; type Output;
/// The method for the `/` operator /// The method for the `/` operator
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn div(self, rhs: RHS) -> Self::Output; fn div(self, rhs: RHS) -> Self::Output;
} }
macro_rules! div_impl { macro_rules! div_impl {
($($t:ty)*) => ($( ($($t:ty)*) => ($(
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl Div for $t { impl Div for $t {
type Output = $t; type Output = $t;
@ -409,19 +409,19 @@ div_impl! { uint u8 u16 u32 u64 int i8 i16 i32 i64 f32 f64 }
/// } /// }
/// ``` /// ```
#[lang="rem"] #[lang="rem"]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub trait Rem<RHS=Self> { pub trait Rem<RHS=Self> {
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
type Output = Self; type Output = Self;
/// The method for the `%` operator /// The method for the `%` operator
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn rem(self, rhs: RHS) -> Self::Output; fn rem(self, rhs: RHS) -> Self::Output;
} }
macro_rules! rem_impl { macro_rules! rem_impl {
($($t:ty)*) => ($( ($($t:ty)*) => ($(
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl Rem for $t { impl Rem for $t {
type Output = $t; type Output = $t;
@ -435,7 +435,7 @@ macro_rules! rem_impl {
macro_rules! rem_float_impl { macro_rules! rem_float_impl {
($t:ty, $fmod:ident) => { ($t:ty, $fmod:ident) => {
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl Rem for $t { impl Rem for $t {
type Output = $t; type Output = $t;
@ -484,25 +484,25 @@ rem_float_impl! { f64, fmod }
/// } /// }
/// ``` /// ```
#[lang="neg"] #[lang="neg"]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub trait Neg { pub trait Neg {
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
type Output; type Output;
/// The method for the unary `-` operator /// The method for the unary `-` operator
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn neg(self) -> Self::Output; fn neg(self) -> Self::Output;
} }
macro_rules! neg_impl { macro_rules! neg_impl {
($($t:ty)*) => ($( ($($t:ty)*) => ($(
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl Neg for $t { impl Neg for $t {
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
type Output = $t; type Output = $t;
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn neg(self) -> $t { -self } fn neg(self) -> $t { -self }
} }
@ -512,7 +512,7 @@ macro_rules! neg_impl {
macro_rules! neg_uint_impl { macro_rules! neg_uint_impl {
($t:ty, $t_signed:ty) => { ($t:ty, $t_signed:ty) => {
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl Neg for $t { impl Neg for $t {
type Output = $t; type Output = $t;
@ -563,19 +563,19 @@ neg_uint_impl! { u64, i64 }
/// } /// }
/// ``` /// ```
#[lang="not"] #[lang="not"]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub trait Not { pub trait Not {
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
type Output; type Output;
/// The method for the unary `!` operator /// The method for the unary `!` operator
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn not(self) -> Self::Output; fn not(self) -> Self::Output;
} }
macro_rules! not_impl { macro_rules! not_impl {
($($t:ty)*) => ($( ($($t:ty)*) => ($(
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl Not for $t { impl Not for $t {
type Output = $t; type Output = $t;
@ -618,19 +618,19 @@ not_impl! { bool uint u8 u16 u32 u64 int i8 i16 i32 i64 }
/// } /// }
/// ``` /// ```
#[lang="bitand"] #[lang="bitand"]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub trait BitAnd<RHS=Self> { pub trait BitAnd<RHS=Self> {
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
type Output; type Output;
/// The method for the `&` operator /// The method for the `&` operator
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn bitand(self, rhs: RHS) -> Self::Output; fn bitand(self, rhs: RHS) -> Self::Output;
} }
macro_rules! bitand_impl { macro_rules! bitand_impl {
($($t:ty)*) => ($( ($($t:ty)*) => ($(
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl BitAnd for $t { impl BitAnd for $t {
type Output = $t; type Output = $t;
@ -673,19 +673,19 @@ bitand_impl! { bool uint u8 u16 u32 u64 int i8 i16 i32 i64 }
/// } /// }
/// ``` /// ```
#[lang="bitor"] #[lang="bitor"]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub trait BitOr<RHS=Self> { pub trait BitOr<RHS=Self> {
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
type Output; type Output;
/// The method for the `|` operator /// The method for the `|` operator
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn bitor(self, rhs: RHS) -> Self::Output; fn bitor(self, rhs: RHS) -> Self::Output;
} }
macro_rules! bitor_impl { macro_rules! bitor_impl {
($($t:ty)*) => ($( ($($t:ty)*) => ($(
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl BitOr for $t { impl BitOr for $t {
type Output = $t; type Output = $t;
@ -728,19 +728,19 @@ bitor_impl! { bool uint u8 u16 u32 u64 int i8 i16 i32 i64 }
/// } /// }
/// ``` /// ```
#[lang="bitxor"] #[lang="bitxor"]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub trait BitXor<RHS=Self> { pub trait BitXor<RHS=Self> {
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
type Output; type Output;
/// The method for the `^` operator /// The method for the `^` operator
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn bitxor(self, rhs: RHS) -> Self::Output; fn bitxor(self, rhs: RHS) -> Self::Output;
} }
macro_rules! bitxor_impl { macro_rules! bitxor_impl {
($($t:ty)*) => ($( ($($t:ty)*) => ($(
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl BitXor for $t { impl BitXor for $t {
type Output = $t; type Output = $t;
@ -783,19 +783,19 @@ bitxor_impl! { bool uint u8 u16 u32 u64 int i8 i16 i32 i64 }
/// } /// }
/// ``` /// ```
#[lang="shl"] #[lang="shl"]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub trait Shl<RHS> { pub trait Shl<RHS> {
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
type Output; type Output;
/// The method for the `<<` operator /// The method for the `<<` operator
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn shl(self, rhs: RHS) -> Self::Output; fn shl(self, rhs: RHS) -> Self::Output;
} }
macro_rules! shl_impl { macro_rules! shl_impl {
($t:ty, $f:ty) => ( ($t:ty, $f:ty) => (
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl Shl<$f> for $t { impl Shl<$f> for $t {
type Output = $t; type Output = $t;
@ -856,13 +856,13 @@ shl_impl_all! { u8 u16 u32 u64 usize i8 i16 i32 i64 isize }
/// } /// }
/// ``` /// ```
#[lang="shr"] #[lang="shr"]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub trait Shr<RHS> { pub trait Shr<RHS> {
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
type Output; type Output;
/// The method for the `>>` operator /// The method for the `>>` operator
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn shr(self, rhs: RHS) -> Self::Output; fn shr(self, rhs: RHS) -> Self::Output;
} }
@ -1120,24 +1120,24 @@ impl<Idx: fmt::Show> fmt::Show for RangeTo<Idx> {
/// } /// }
/// ``` /// ```
#[lang="deref"] #[lang="deref"]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub trait Deref { pub trait Deref {
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
type Target: ?Sized; type Target: ?Sized;
/// The method called to dereference a value /// The method called to dereference a value
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn deref<'a>(&'a self) -> &'a Self::Target; fn deref<'a>(&'a self) -> &'a Self::Target;
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a, T: ?Sized> Deref for &'a T { impl<'a, T: ?Sized> Deref for &'a T {
type Target = T; type Target = T;
fn deref(&self) -> &T { *self } fn deref(&self) -> &T { *self }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a, T: ?Sized> Deref for &'a mut T { impl<'a, T: ?Sized> Deref for &'a mut T {
type Target = T; type Target = T;
@ -1182,14 +1182,14 @@ impl<'a, T: ?Sized> Deref for &'a mut T {
/// } /// }
/// ``` /// ```
#[lang="deref_mut"] #[lang="deref_mut"]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub trait DerefMut: Deref { pub trait DerefMut: Deref {
/// The method called to mutably dereference a value /// The method called to mutably dereference a value
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn deref_mut<'a>(&'a mut self) -> &'a mut Self::Target; fn deref_mut<'a>(&'a mut self) -> &'a mut Self::Target;
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a, T: ?Sized> DerefMut for &'a mut T { impl<'a, T: ?Sized> DerefMut for &'a mut T {
fn deref_mut(&mut self) -> &mut T { *self } fn deref_mut(&mut self) -> &mut T { *self }
} }

View File

@ -141,7 +141,7 @@
//! } //! }
//! ``` //! ```
#![stable(feature = "grandfathered", since = "1.0.0")] #![stable(feature = "rust1", since = "1.0.0")]
use self::Option::*; use self::Option::*;
@ -164,13 +164,13 @@ use slice;
/// The `Option` type. /// The `Option` type.
#[derive(Clone, Copy, PartialEq, PartialOrd, Eq, Ord, Show, Hash)] #[derive(Clone, Copy, PartialEq, PartialOrd, Eq, Ord, Show, Hash)]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub enum Option<T> { pub enum Option<T> {
/// No value /// No value
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
None, None,
/// Some value `T` /// Some value `T`
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
Some(T) Some(T)
} }
@ -195,7 +195,7 @@ impl<T> Option<T> {
/// assert_eq!(x.is_some(), false); /// assert_eq!(x.is_some(), false);
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn is_some(&self) -> bool { pub fn is_some(&self) -> bool {
match *self { match *self {
Some(_) => true, Some(_) => true,
@ -215,7 +215,7 @@ impl<T> Option<T> {
/// assert_eq!(x.is_none(), true); /// assert_eq!(x.is_none(), true);
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn is_none(&self) -> bool { pub fn is_none(&self) -> bool {
!self.is_some() !self.is_some()
} }
@ -241,7 +241,7 @@ impl<T> Option<T> {
/// println!("still can print num_as_str: {:?}", num_as_str); /// println!("still can print num_as_str: {:?}", num_as_str);
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn as_ref<'r>(&'r self) -> Option<&'r T> { pub fn as_ref<'r>(&'r self) -> Option<&'r T> {
match *self { match *self {
Some(ref x) => Some(x), Some(ref x) => Some(x),
@ -262,7 +262,7 @@ impl<T> Option<T> {
/// assert_eq!(x, Some(42u)); /// assert_eq!(x, Some(42u));
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn as_mut<'r>(&'r mut self) -> Option<&'r mut T> { pub fn as_mut<'r>(&'r mut self) -> Option<&'r mut T> {
match *self { match *self {
Some(ref mut x) => Some(x), Some(ref mut x) => Some(x),
@ -323,7 +323,7 @@ impl<T> Option<T> {
/// x.expect("the world is ending"); // panics with `world is ending` /// x.expect("the world is ending"); // panics with `world is ending`
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn expect(self, msg: &str) -> T { pub fn expect(self, msg: &str) -> T {
match self { match self {
Some(val) => val, Some(val) => val,
@ -355,7 +355,7 @@ impl<T> Option<T> {
/// assert_eq!(x.unwrap(), "air"); // fails /// assert_eq!(x.unwrap(), "air"); // fails
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn unwrap(self) -> T { pub fn unwrap(self) -> T {
match self { match self {
Some(val) => val, Some(val) => val,
@ -372,7 +372,7 @@ impl<T> Option<T> {
/// assert_eq!(None.unwrap_or("bike"), "bike"); /// assert_eq!(None.unwrap_or("bike"), "bike");
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn unwrap_or(self, def: T) -> T { pub fn unwrap_or(self, def: T) -> T {
match self { match self {
Some(x) => x, Some(x) => x,
@ -390,7 +390,7 @@ impl<T> Option<T> {
/// assert_eq!(None.unwrap_or_else(|| 2 * k), 20u); /// assert_eq!(None.unwrap_or_else(|| 2 * k), 20u);
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn unwrap_or_else<F: FnOnce() -> T>(self, f: F) -> T { pub fn unwrap_or_else<F: FnOnce() -> T>(self, f: F) -> T {
match self { match self {
Some(x) => x, Some(x) => x,
@ -414,7 +414,7 @@ impl<T> Option<T> {
/// let num_as_int: Option<uint> = num_as_str.map(|n| n.len()); /// let num_as_int: Option<uint> = num_as_str.map(|n| n.len());
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn map<U, F: FnOnce(T) -> U>(self, f: F) -> Option<U> { pub fn map<U, F: FnOnce(T) -> U>(self, f: F) -> Option<U> {
match self { match self {
Some(x) => Some(f(x)), Some(x) => Some(f(x)),
@ -434,7 +434,7 @@ impl<T> Option<T> {
/// assert_eq!(x.map_or(42u, |v| v.len()), 42u); /// assert_eq!(x.map_or(42u, |v| v.len()), 42u);
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn map_or<U, F: FnOnce(T) -> U>(self, def: U, f: F) -> U { pub fn map_or<U, F: FnOnce(T) -> U>(self, def: U, f: F) -> U {
match self { match self {
Some(t) => f(t), Some(t) => f(t),
@ -456,7 +456,7 @@ impl<T> Option<T> {
/// assert_eq!(x.map_or_else(|| 2 * k, |v| v.len()), 42u); /// assert_eq!(x.map_or_else(|| 2 * k, |v| v.len()), 42u);
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn map_or_else<U, D: FnOnce() -> U, F: FnOnce(T) -> U>(self, def: D, f: F) -> U { pub fn map_or_else<U, D: FnOnce() -> U, F: FnOnce(T) -> U>(self, def: D, f: F) -> U {
match self { match self {
Some(t) => f(t), Some(t) => f(t),
@ -522,7 +522,7 @@ impl<T> Option<T> {
/// assert_eq!(x.iter().next(), None); /// assert_eq!(x.iter().next(), None);
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn iter(&self) -> Iter<T> { pub fn iter(&self) -> Iter<T> {
Iter { inner: Item { opt: self.as_ref() } } Iter { inner: Item { opt: self.as_ref() } }
} }
@ -563,7 +563,7 @@ impl<T> Option<T> {
/// assert!(v.is_empty()); /// assert!(v.is_empty());
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn into_iter(self) -> IntoIter<T> { pub fn into_iter(self) -> IntoIter<T> {
IntoIter { inner: Item { opt: self } } IntoIter { inner: Item { opt: self } }
} }
@ -594,7 +594,7 @@ impl<T> Option<T> {
/// assert_eq!(x.and(y), None); /// assert_eq!(x.and(y), None);
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn and<U>(self, optb: Option<U>) -> Option<U> { pub fn and<U>(self, optb: Option<U>) -> Option<U> {
match self { match self {
Some(_) => optb, Some(_) => optb,
@ -617,7 +617,7 @@ impl<T> Option<T> {
/// assert_eq!(None.and_then(sq).and_then(sq), None); /// assert_eq!(None.and_then(sq).and_then(sq), None);
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn and_then<U, F: FnOnce(T) -> Option<U>>(self, f: F) -> Option<U> { pub fn and_then<U, F: FnOnce(T) -> Option<U>>(self, f: F) -> Option<U> {
match self { match self {
Some(x) => f(x), Some(x) => f(x),
@ -647,7 +647,7 @@ impl<T> Option<T> {
/// assert_eq!(x.or(y), None); /// assert_eq!(x.or(y), None);
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn or(self, optb: Option<T>) -> Option<T> { pub fn or(self, optb: Option<T>) -> Option<T> {
match self { match self {
Some(_) => self, Some(_) => self,
@ -669,7 +669,7 @@ impl<T> Option<T> {
/// assert_eq!(None.or_else(nobody), None); /// assert_eq!(None.or_else(nobody), None);
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn or_else<F: FnOnce() -> Option<T>>(self, f: F) -> Option<T> { pub fn or_else<F: FnOnce() -> Option<T>>(self, f: F) -> Option<T> {
match self { match self {
Some(_) => self, Some(_) => self,
@ -695,7 +695,7 @@ impl<T> Option<T> {
/// assert_eq!(x, None); /// assert_eq!(x, None);
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn take(&mut self) -> Option<T> { pub fn take(&mut self) -> Option<T> {
mem::replace(self, None) mem::replace(self, None)
} }
@ -735,7 +735,7 @@ impl<T: Default> Option<T> {
/// assert_eq!(0i, bad_year); /// assert_eq!(0i, bad_year);
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn unwrap_or_default(self) -> T { pub fn unwrap_or_default(self) -> T {
match self { match self {
Some(x) => x, Some(x) => x,
@ -764,10 +764,10 @@ impl<T> AsSlice<T> for Option<T> {
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<T> Default for Option<T> { impl<T> Default for Option<T> {
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn default() -> Option<T> { None } fn default() -> Option<T> { None }
} }
@ -807,10 +807,10 @@ impl<A> DoubleEndedIterator for Item<A> {
impl<A> ExactSizeIterator for Item<A> {} impl<A> ExactSizeIterator for Item<A> {}
/// An iterator over a reference of the contained item in an Option. /// An iterator over a reference of the contained item in an Option.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub struct Iter<'a, A: 'a> { inner: Item<&'a A> } pub struct Iter<'a, A: 'a> { inner: Item<&'a A> }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a, A> Iterator for Iter<'a, A> { impl<'a, A> Iterator for Iter<'a, A> {
type Item = &'a A; type Item = &'a A;
@ -820,16 +820,16 @@ impl<'a, A> Iterator for Iter<'a, A> {
fn size_hint(&self) -> (uint, Option<uint>) { self.inner.size_hint() } fn size_hint(&self) -> (uint, Option<uint>) { self.inner.size_hint() }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a, A> DoubleEndedIterator for Iter<'a, A> { impl<'a, A> DoubleEndedIterator for Iter<'a, A> {
#[inline] #[inline]
fn next_back(&mut self) -> Option<&'a A> { self.inner.next_back() } fn next_back(&mut self) -> Option<&'a A> { self.inner.next_back() }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a, A> ExactSizeIterator for Iter<'a, A> {} impl<'a, A> ExactSizeIterator for Iter<'a, A> {}
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a, A> Clone for Iter<'a, A> { impl<'a, A> Clone for Iter<'a, A> {
fn clone(&self) -> Iter<'a, A> { fn clone(&self) -> Iter<'a, A> {
Iter { inner: self.inner.clone() } Iter { inner: self.inner.clone() }
@ -837,10 +837,10 @@ impl<'a, A> Clone for Iter<'a, A> {
} }
/// An iterator over a mutable reference of the contained item in an Option. /// An iterator over a mutable reference of the contained item in an Option.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub struct IterMut<'a, A: 'a> { inner: Item<&'a mut A> } pub struct IterMut<'a, A: 'a> { inner: Item<&'a mut A> }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a, A> Iterator for IterMut<'a, A> { impl<'a, A> Iterator for IterMut<'a, A> {
type Item = &'a mut A; type Item = &'a mut A;
@ -850,20 +850,20 @@ impl<'a, A> Iterator for IterMut<'a, A> {
fn size_hint(&self) -> (uint, Option<uint>) { self.inner.size_hint() } fn size_hint(&self) -> (uint, Option<uint>) { self.inner.size_hint() }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a, A> DoubleEndedIterator for IterMut<'a, A> { impl<'a, A> DoubleEndedIterator for IterMut<'a, A> {
#[inline] #[inline]
fn next_back(&mut self) -> Option<&'a mut A> { self.inner.next_back() } fn next_back(&mut self) -> Option<&'a mut A> { self.inner.next_back() }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a, A> ExactSizeIterator for IterMut<'a, A> {} impl<'a, A> ExactSizeIterator for IterMut<'a, A> {}
/// An iterator over the item contained inside an Option. /// An iterator over the item contained inside an Option.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub struct IntoIter<A> { inner: Item<A> } pub struct IntoIter<A> { inner: Item<A> }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<A> Iterator for IntoIter<A> { impl<A> Iterator for IntoIter<A> {
type Item = A; type Item = A;
@ -873,20 +873,20 @@ impl<A> Iterator for IntoIter<A> {
fn size_hint(&self) -> (uint, Option<uint>) { self.inner.size_hint() } fn size_hint(&self) -> (uint, Option<uint>) { self.inner.size_hint() }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<A> DoubleEndedIterator for IntoIter<A> { impl<A> DoubleEndedIterator for IntoIter<A> {
#[inline] #[inline]
fn next_back(&mut self) -> Option<A> { self.inner.next_back() } fn next_back(&mut self) -> Option<A> { self.inner.next_back() }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<A> ExactSizeIterator for IntoIter<A> {} impl<A> ExactSizeIterator for IntoIter<A> {}
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// FromIterator // FromIterator
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<A, V: FromIterator<A>> FromIterator<Option<A>> for Option<V> { impl<A, V: FromIterator<A>> FromIterator<Option<A>> for Option<V> {
/// Takes each element in the `Iterator`: if it is `None`, no further /// Takes each element in the `Iterator`: if it is `None`, no further
/// elements are taken, and the `None` is returned. Should no `None` occur, a /// elements are taken, and the `None` is returned. Should no `None` occur, a
@ -906,7 +906,7 @@ impl<A, V: FromIterator<A>> FromIterator<Option<A>> for Option<V> {
/// assert!(res == Some(vec!(2u, 3u))); /// assert!(res == Some(vec!(2u, 3u)));
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn from_iter<I: Iterator<Item=Option<A>>>(iter: I) -> Option<V> { fn from_iter<I: Iterator<Item=Option<A>>>(iter: I) -> Option<V> {
// FIXME(#11084): This could be replaced with Iterator::scan when this // FIXME(#11084): This could be replaced with Iterator::scan when this
// performance bug is closed. // performance bug is closed.

View File

@ -86,7 +86,7 @@
//! but C APIs hand out a lot of pointers generally, so are a common source //! but C APIs hand out a lot of pointers generally, so are a common source
//! of unsafe pointers in Rust. //! of unsafe pointers in Rust.
#![stable(feature = "grandfathered", since = "1.0.0")] #![stable(feature = "rust1", since = "1.0.0")]
use mem; use mem;
use clone::Clone; use clone::Clone;
@ -121,7 +121,7 @@ pub use intrinsics::set_memory;
/// assert!(p.is_null()); /// assert!(p.is_null());
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn null<T>() -> *const T { 0 as *const T } pub fn null<T>() -> *const T { 0 as *const T }
/// Creates a null mutable raw pointer. /// Creates a null mutable raw pointer.
@ -135,7 +135,7 @@ pub fn null<T>() -> *const T { 0 as *const T }
/// assert!(p.is_null()); /// assert!(p.is_null());
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn null_mut<T>() -> *mut T { 0 as *mut T } pub fn null_mut<T>() -> *mut T { 0 as *mut T }
/// Zeroes out `count * size_of::<T>` bytes of memory at `dst`. `count` may be /// Zeroes out `count * size_of::<T>` bytes of memory at `dst`. `count` may be
@ -160,7 +160,7 @@ pub unsafe fn zero_memory<T>(dst: *mut T, count: uint) {
/// ///
/// This is only unsafe because it accepts a raw pointer. /// This is only unsafe because it accepts a raw pointer.
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub unsafe fn swap<T>(x: *mut T, y: *mut T) { pub unsafe fn swap<T>(x: *mut T, y: *mut T) {
// Give ourselves some scratch space to work with // Give ourselves some scratch space to work with
let mut tmp: T = mem::uninitialized(); let mut tmp: T = mem::uninitialized();
@ -184,7 +184,7 @@ pub unsafe fn swap<T>(x: *mut T, y: *mut T) {
/// This is only unsafe because it accepts a raw pointer. /// This is only unsafe because it accepts a raw pointer.
/// Otherwise, this operation is identical to `mem::replace`. /// Otherwise, this operation is identical to `mem::replace`.
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub unsafe fn replace<T>(dest: *mut T, mut src: T) -> T { pub unsafe fn replace<T>(dest: *mut T, mut src: T) -> T {
mem::swap(mem::transmute(dest), &mut src); // cannot overlap mem::swap(mem::transmute(dest), &mut src); // cannot overlap
src src
@ -202,7 +202,7 @@ pub unsafe fn replace<T>(dest: *mut T, mut src: T) -> T {
/// `zero_memory`, or `copy_memory`). Note that `*src = foo` counts as a use /// `zero_memory`, or `copy_memory`). Note that `*src = foo` counts as a use
/// because it will attempt to drop the value previously at `*src`. /// because it will attempt to drop the value previously at `*src`.
#[inline(always)] #[inline(always)]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub unsafe fn read<T>(src: *const T) -> T { pub unsafe fn read<T>(src: *const T) -> T {
let mut tmp: T = mem::uninitialized(); let mut tmp: T = mem::uninitialized();
copy_nonoverlapping_memory(&mut tmp, src, 1); copy_nonoverlapping_memory(&mut tmp, src, 1);
@ -239,18 +239,18 @@ pub unsafe fn read_and_zero<T>(dest: *mut T) -> T {
/// This is appropriate for initializing uninitialized memory, or overwriting /// This is appropriate for initializing uninitialized memory, or overwriting
/// memory that has previously been `read` from. /// memory that has previously been `read` from.
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub unsafe fn write<T>(dst: *mut T, src: T) { pub unsafe fn write<T>(dst: *mut T, src: T) {
intrinsics::move_val_init(&mut *dst, src) intrinsics::move_val_init(&mut *dst, src)
} }
/// Methods on raw pointers /// Methods on raw pointers
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub trait PtrExt: Sized { pub trait PtrExt: Sized {
type Target; type Target;
/// Returns true if the pointer is null. /// Returns true if the pointer is null.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn is_null(self) -> bool; fn is_null(self) -> bool;
/// Returns `None` if the pointer is null, or else returns a reference to /// Returns `None` if the pointer is null, or else returns a reference to
@ -275,12 +275,12 @@ pub trait PtrExt: Sized {
/// The offset must be in-bounds of the object, or one-byte-past-the-end. /// The offset must be in-bounds of the object, or one-byte-past-the-end.
/// Otherwise `offset` invokes Undefined Behaviour, regardless of whether /// Otherwise `offset` invokes Undefined Behaviour, regardless of whether
/// the pointer is used. /// the pointer is used.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
unsafe fn offset(self, count: int) -> Self; unsafe fn offset(self, count: int) -> Self;
} }
/// Methods on mutable raw pointers /// Methods on mutable raw pointers
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub trait MutPtrExt { pub trait MutPtrExt {
type Target; type Target;
@ -297,16 +297,16 @@ pub trait MutPtrExt {
unsafe fn as_mut<'a>(&self) -> Option<&'a mut Self::Target>; unsafe fn as_mut<'a>(&self) -> Option<&'a mut Self::Target>;
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<T> PtrExt for *const T { impl<T> PtrExt for *const T {
type Target = T; type Target = T;
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn is_null(self) -> bool { self as uint == 0 } fn is_null(self) -> bool { self as uint == 0 }
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
unsafe fn offset(self, count: int) -> *const T { unsafe fn offset(self, count: int) -> *const T {
intrinsics::offset(self, count) intrinsics::offset(self, count)
} }
@ -324,16 +324,16 @@ impl<T> PtrExt for *const T {
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<T> PtrExt for *mut T { impl<T> PtrExt for *mut T {
type Target = T; type Target = T;
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn is_null(self) -> bool { self as uint == 0 } fn is_null(self) -> bool { self as uint == 0 }
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
unsafe fn offset(self, count: int) -> *mut T { unsafe fn offset(self, count: int) -> *mut T {
intrinsics::offset(self, count) as *mut T intrinsics::offset(self, count) as *mut T
} }
@ -351,7 +351,7 @@ impl<T> PtrExt for *mut T {
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<T> MutPtrExt for *mut T { impl<T> MutPtrExt for *mut T {
type Target = T; type Target = T;
@ -369,7 +369,7 @@ impl<T> MutPtrExt for *mut T {
} }
// Equality for pointers // Equality for pointers
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<T> PartialEq for *const T { impl<T> PartialEq for *const T {
#[inline] #[inline]
fn eq(&self, other: &*const T) -> bool { fn eq(&self, other: &*const T) -> bool {
@ -379,10 +379,10 @@ impl<T> PartialEq for *const T {
fn ne(&self, other: &*const T) -> bool { !self.eq(other) } fn ne(&self, other: &*const T) -> bool { !self.eq(other) }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<T> Eq for *const T {} impl<T> Eq for *const T {}
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<T> PartialEq for *mut T { impl<T> PartialEq for *mut T {
#[inline] #[inline]
fn eq(&self, other: &*mut T) -> bool { fn eq(&self, other: &*mut T) -> bool {
@ -392,10 +392,10 @@ impl<T> PartialEq for *mut T {
fn ne(&self, other: &*mut T) -> bool { !self.eq(other) } fn ne(&self, other: &*mut T) -> bool { !self.eq(other) }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<T> Eq for *mut T {} impl<T> Eq for *mut T {}
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<T> Clone for *const T { impl<T> Clone for *const T {
#[inline] #[inline]
fn clone(&self) -> *const T { fn clone(&self) -> *const T {
@ -403,7 +403,7 @@ impl<T> Clone for *const T {
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<T> Clone for *mut T { impl<T> Clone for *mut T {
#[inline] #[inline]
fn clone(&self) -> *mut T { fn clone(&self) -> *mut T {
@ -416,7 +416,7 @@ mod externfnpointers {
use mem; use mem;
use cmp::PartialEq; use cmp::PartialEq;
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<_R> PartialEq for extern "C" fn() -> _R { impl<_R> PartialEq for extern "C" fn() -> _R {
#[inline] #[inline]
fn eq(&self, other: &extern "C" fn() -> _R) -> bool { fn eq(&self, other: &extern "C" fn() -> _R) -> bool {
@ -427,7 +427,7 @@ mod externfnpointers {
} }
macro_rules! fnptreq { macro_rules! fnptreq {
($($p:ident),*) => { ($($p:ident),*) => {
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<_R,$($p),*> PartialEq for extern "C" fn($($p),*) -> _R { impl<_R,$($p),*> PartialEq for extern "C" fn($($p),*) -> _R {
#[inline] #[inline]
fn eq(&self, other: &extern "C" fn($($p),*) -> _R) -> bool { fn eq(&self, other: &extern "C" fn($($p),*) -> _R) -> bool {
@ -447,7 +447,7 @@ mod externfnpointers {
} }
// Comparison for pointers // Comparison for pointers
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<T> Ord for *const T { impl<T> Ord for *const T {
#[inline] #[inline]
fn cmp(&self, other: &*const T) -> Ordering { fn cmp(&self, other: &*const T) -> Ordering {
@ -461,7 +461,7 @@ impl<T> Ord for *const T {
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<T> PartialOrd for *const T { impl<T> PartialOrd for *const T {
#[inline] #[inline]
fn partial_cmp(&self, other: &*const T) -> Option<Ordering> { fn partial_cmp(&self, other: &*const T) -> Option<Ordering> {
@ -481,7 +481,7 @@ impl<T> PartialOrd for *const T {
fn ge(&self, other: &*const T) -> bool { *self >= *other } fn ge(&self, other: &*const T) -> bool { *self >= *other }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<T> Ord for *mut T { impl<T> Ord for *mut T {
#[inline] #[inline]
fn cmp(&self, other: &*mut T) -> Ordering { fn cmp(&self, other: &*mut T) -> Ordering {
@ -495,7 +495,7 @@ impl<T> Ord for *mut T {
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<T> PartialOrd for *mut T { impl<T> PartialOrd for *mut T {
#[inline] #[inline]
fn partial_cmp(&self, other: &*mut T) -> Option<Ordering> { fn partial_cmp(&self, other: &*mut T) -> Option<Ordering> {

View File

@ -224,7 +224,7 @@
//! //!
//! `try!` is imported by the prelude, and is available everywhere. //! `try!` is imported by the prelude, and is available everywhere.
#![stable(feature = "grandfathered", since = "1.0.0")] #![stable(feature = "rust1", since = "1.0.0")]
use self::Result::{Ok, Err}; use self::Result::{Ok, Err};
@ -241,14 +241,14 @@ use slice;
/// See the [`std::result`](index.html) module documentation for details. /// See the [`std::result`](index.html) module documentation for details.
#[derive(Clone, Copy, PartialEq, PartialOrd, Eq, Ord, Show, Hash)] #[derive(Clone, Copy, PartialEq, PartialOrd, Eq, Ord, Show, Hash)]
#[must_use] #[must_use]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub enum Result<T, E> { pub enum Result<T, E> {
/// Contains the success value /// Contains the success value
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
Ok(T), Ok(T),
/// Contains the error value /// Contains the error value
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
Err(E) Err(E)
} }
@ -256,7 +256,7 @@ pub enum Result<T, E> {
// Type implementation // Type implementation
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<T, E> Result<T, E> { impl<T, E> Result<T, E> {
///////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////
// Querying the contained values // Querying the contained values
@ -274,7 +274,7 @@ impl<T, E> Result<T, E> {
/// assert_eq!(x.is_ok(), false); /// assert_eq!(x.is_ok(), false);
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn is_ok(&self) -> bool { pub fn is_ok(&self) -> bool {
match *self { match *self {
Ok(_) => true, Ok(_) => true,
@ -294,7 +294,7 @@ impl<T, E> Result<T, E> {
/// assert_eq!(x.is_err(), true); /// assert_eq!(x.is_err(), true);
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn is_err(&self) -> bool { pub fn is_err(&self) -> bool {
!self.is_ok() !self.is_ok()
} }
@ -318,7 +318,7 @@ impl<T, E> Result<T, E> {
/// assert_eq!(x.ok(), None); /// assert_eq!(x.ok(), None);
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn ok(self) -> Option<T> { pub fn ok(self) -> Option<T> {
match self { match self {
Ok(x) => Some(x), Ok(x) => Some(x),
@ -341,7 +341,7 @@ impl<T, E> Result<T, E> {
/// assert_eq!(x.err(), Some("Nothing here")); /// assert_eq!(x.err(), Some("Nothing here"));
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn err(self) -> Option<E> { pub fn err(self) -> Option<E> {
match self { match self {
Ok(_) => None, Ok(_) => None,
@ -366,7 +366,7 @@ impl<T, E> Result<T, E> {
/// assert_eq!(x.as_ref(), Err(&"Error")); /// assert_eq!(x.as_ref(), Err(&"Error"));
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn as_ref(&self) -> Result<&T, &E> { pub fn as_ref(&self) -> Result<&T, &E> {
match *self { match *self {
Ok(ref x) => Ok(x), Ok(ref x) => Ok(x),
@ -393,7 +393,7 @@ impl<T, E> Result<T, E> {
/// assert_eq!(x.unwrap_err(), 0); /// assert_eq!(x.unwrap_err(), 0);
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn as_mut(&mut self) -> Result<&mut T, &mut E> { pub fn as_mut(&mut self) -> Result<&mut T, &mut E> {
match *self { match *self {
Ok(ref mut x) => Ok(x), Ok(ref mut x) => Ok(x),
@ -464,7 +464,7 @@ impl<T, E> Result<T, E> {
/// assert!(sum == 10); /// assert!(sum == 10);
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn map<U, F: FnOnce(T) -> U>(self, op: F) -> Result<U,E> { pub fn map<U, F: FnOnce(T) -> U>(self, op: F) -> Result<U,E> {
match self { match self {
Ok(t) => Ok(op(t)), Ok(t) => Ok(op(t)),
@ -490,7 +490,7 @@ impl<T, E> Result<T, E> {
/// assert_eq!(x.map_err(stringify), Err("error code: 13".to_string())); /// assert_eq!(x.map_err(stringify), Err("error code: 13".to_string()));
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn map_err<F, O: FnOnce(E) -> F>(self, op: O) -> Result<T,F> { pub fn map_err<F, O: FnOnce(E) -> F>(self, op: O) -> Result<T,F> {
match self { match self {
Ok(t) => Ok(t), Ok(t) => Ok(t),
@ -514,7 +514,7 @@ impl<T, E> Result<T, E> {
/// assert_eq!(x.iter().next(), None); /// assert_eq!(x.iter().next(), None);
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn iter(&self) -> Iter<T> { pub fn iter(&self) -> Iter<T> {
Iter { inner: self.as_ref().ok() } Iter { inner: self.as_ref().ok() }
} }
@ -535,7 +535,7 @@ impl<T, E> Result<T, E> {
/// assert_eq!(x.iter_mut().next(), None); /// assert_eq!(x.iter_mut().next(), None);
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn iter_mut(&mut self) -> IterMut<T> { pub fn iter_mut(&mut self) -> IterMut<T> {
IterMut { inner: self.as_mut().ok() } IterMut { inner: self.as_mut().ok() }
} }
@ -554,7 +554,7 @@ impl<T, E> Result<T, E> {
/// assert_eq!(v, vec![]); /// assert_eq!(v, vec![]);
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn into_iter(self) -> IntoIter<T> { pub fn into_iter(self) -> IntoIter<T> {
IntoIter { inner: self.ok() } IntoIter { inner: self.ok() }
} }
@ -585,7 +585,7 @@ impl<T, E> Result<T, E> {
/// assert_eq!(x.and(y), Ok("different result type")); /// assert_eq!(x.and(y), Ok("different result type"));
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn and<U>(self, res: Result<U, E>) -> Result<U, E> { pub fn and<U>(self, res: Result<U, E>) -> Result<U, E> {
match self { match self {
Ok(_) => res, Ok(_) => res,
@ -609,7 +609,7 @@ impl<T, E> Result<T, E> {
/// assert_eq!(Err(3).and_then(sq).and_then(sq), Err(3)); /// assert_eq!(Err(3).and_then(sq).and_then(sq), Err(3));
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn and_then<U, F: FnOnce(T) -> Result<U, E>>(self, op: F) -> Result<U, E> { pub fn and_then<U, F: FnOnce(T) -> Result<U, E>>(self, op: F) -> Result<U, E> {
match self { match self {
Ok(t) => op(t), Ok(t) => op(t),
@ -639,7 +639,7 @@ impl<T, E> Result<T, E> {
/// assert_eq!(x.or(y), Ok(2)); /// assert_eq!(x.or(y), Ok(2));
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn or(self, res: Result<T, E>) -> Result<T, E> { pub fn or(self, res: Result<T, E>) -> Result<T, E> {
match self { match self {
Ok(_) => self, Ok(_) => self,
@ -663,7 +663,7 @@ impl<T, E> Result<T, E> {
/// assert_eq!(Err(3).or_else(err).or_else(err), Err(3)); /// assert_eq!(Err(3).or_else(err).or_else(err), Err(3));
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn or_else<F, O: FnOnce(E) -> Result<T, F>>(self, op: O) -> Result<T, F> { pub fn or_else<F, O: FnOnce(E) -> Result<T, F>>(self, op: O) -> Result<T, F> {
match self { match self {
Ok(t) => Ok(t), Ok(t) => Ok(t),
@ -685,7 +685,7 @@ impl<T, E> Result<T, E> {
/// assert_eq!(x.unwrap_or(optb), optb); /// assert_eq!(x.unwrap_or(optb), optb);
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn unwrap_or(self, optb: T) -> T { pub fn unwrap_or(self, optb: T) -> T {
match self { match self {
Ok(t) => t, Ok(t) => t,
@ -705,7 +705,7 @@ impl<T, E> Result<T, E> {
/// assert_eq!(Err("foo").unwrap_or_else(count), 3u); /// assert_eq!(Err("foo").unwrap_or_else(count), 3u);
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn unwrap_or_else<F: FnOnce(E) -> T>(self, op: F) -> T { pub fn unwrap_or_else<F: FnOnce(E) -> T>(self, op: F) -> T {
match self { match self {
Ok(t) => t, Ok(t) => t,
@ -714,7 +714,7 @@ impl<T, E> Result<T, E> {
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<T, E: Show> Result<T, E> { impl<T, E: Show> Result<T, E> {
/// Unwraps a result, yielding the content of an `Ok`. /// Unwraps a result, yielding the content of an `Ok`.
/// ///
@ -735,7 +735,7 @@ impl<T, E: Show> Result<T, E> {
/// x.unwrap(); // panics with `emergency failure` /// x.unwrap(); // panics with `emergency failure`
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn unwrap(self) -> T { pub fn unwrap(self) -> T {
match self { match self {
Ok(t) => t, Ok(t) => t,
@ -745,7 +745,7 @@ impl<T, E: Show> Result<T, E> {
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<T: Show, E> Result<T, E> { impl<T: Show, E> Result<T, E> {
/// Unwraps a result, yielding the content of an `Err`. /// Unwraps a result, yielding the content of an `Err`.
/// ///
@ -766,7 +766,7 @@ impl<T: Show, E> Result<T, E> {
/// assert_eq!(x.unwrap_err(), "emergency failure"); /// assert_eq!(x.unwrap_err(), "emergency failure");
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn unwrap_err(self) -> E { pub fn unwrap_err(self) -> E {
match self { match self {
Ok(t) => Ok(t) =>
@ -783,7 +783,7 @@ impl<T: Show, E> Result<T, E> {
impl<T, E> AsSlice<T> for Result<T, E> { impl<T, E> AsSlice<T> for Result<T, E> {
/// Convert from `Result<T, E>` to `&[T]` (without copying) /// Convert from `Result<T, E>` to `&[T]` (without copying)
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn as_slice<'a>(&'a self) -> &'a [T] { fn as_slice<'a>(&'a self) -> &'a [T] {
match *self { match *self {
Ok(ref x) => slice::ref_slice(x), Ok(ref x) => slice::ref_slice(x),
@ -801,10 +801,10 @@ impl<T, E> AsSlice<T> for Result<T, E> {
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
/// An iterator over a reference to the `Ok` variant of a `Result`. /// An iterator over a reference to the `Ok` variant of a `Result`.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub struct Iter<'a, T: 'a> { inner: Option<&'a T> } pub struct Iter<'a, T: 'a> { inner: Option<&'a T> }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a, T> Iterator for Iter<'a, T> { impl<'a, T> Iterator for Iter<'a, T> {
type Item = &'a T; type Item = &'a T;
@ -817,13 +817,13 @@ impl<'a, T> Iterator for Iter<'a, T> {
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a, T> DoubleEndedIterator for Iter<'a, T> { impl<'a, T> DoubleEndedIterator for Iter<'a, T> {
#[inline] #[inline]
fn next_back(&mut self) -> Option<&'a T> { self.inner.take() } fn next_back(&mut self) -> Option<&'a T> { self.inner.take() }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a, T> ExactSizeIterator for Iter<'a, T> {} impl<'a, T> ExactSizeIterator for Iter<'a, T> {}
impl<'a, T> Clone for Iter<'a, T> { impl<'a, T> Clone for Iter<'a, T> {
@ -831,10 +831,10 @@ impl<'a, T> Clone for Iter<'a, T> {
} }
/// An iterator over a mutable reference to the `Ok` variant of a `Result`. /// An iterator over a mutable reference to the `Ok` variant of a `Result`.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub struct IterMut<'a, T: 'a> { inner: Option<&'a mut T> } pub struct IterMut<'a, T: 'a> { inner: Option<&'a mut T> }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a, T> Iterator for IterMut<'a, T> { impl<'a, T> Iterator for IterMut<'a, T> {
type Item = &'a mut T; type Item = &'a mut T;
@ -847,20 +847,20 @@ impl<'a, T> Iterator for IterMut<'a, T> {
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a, T> DoubleEndedIterator for IterMut<'a, T> { impl<'a, T> DoubleEndedIterator for IterMut<'a, T> {
#[inline] #[inline]
fn next_back(&mut self) -> Option<&'a mut T> { self.inner.take() } fn next_back(&mut self) -> Option<&'a mut T> { self.inner.take() }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a, T> ExactSizeIterator for IterMut<'a, T> {} impl<'a, T> ExactSizeIterator for IterMut<'a, T> {}
/// An iterator over the value in a `Ok` variant of a `Result`. /// An iterator over the value in a `Ok` variant of a `Result`.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub struct IntoIter<T> { inner: Option<T> } pub struct IntoIter<T> { inner: Option<T> }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<T> Iterator for IntoIter<T> { impl<T> Iterator for IntoIter<T> {
type Item = T; type Item = T;
@ -873,20 +873,20 @@ impl<T> Iterator for IntoIter<T> {
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<T> DoubleEndedIterator for IntoIter<T> { impl<T> DoubleEndedIterator for IntoIter<T> {
#[inline] #[inline]
fn next_back(&mut self) -> Option<T> { self.inner.take() } fn next_back(&mut self) -> Option<T> { self.inner.take() }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<T> ExactSizeIterator for IntoIter<T> {} impl<T> ExactSizeIterator for IntoIter<T> {}
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// FromIterator // FromIterator
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<A, E, V: FromIterator<A>> FromIterator<Result<A, E>> for Result<V, E> { impl<A, E, V: FromIterator<A>> FromIterator<Result<A, E>> for Result<V, E> {
/// Takes each element in the `Iterator`: if it is an `Err`, no further /// Takes each element in the `Iterator`: if it is an `Err`, no further
/// elements are taken, and the `Err` is returned. Should no `Err` occur, a /// elements are taken, and the `Err` is returned. Should no `Err` occur, a

View File

@ -12,7 +12,7 @@
//! //!
//! For more details `std::slice`. //! For more details `std::slice`.
#![stable(feature = "grandfathered", since = "1.0.0")] #![stable(feature = "rust1", since = "1.0.0")]
#![doc(primitive = "slice")] #![doc(primitive = "slice")]
// How this module is organized. // How this module is organized.
@ -655,9 +655,9 @@ impl<'a, T, U: ?Sized + AsSlice<T>> AsSlice<T> for &'a mut U {
fn as_slice(&self) -> &[T] { AsSlice::as_slice(*self) } fn as_slice(&self) -> &[T] { AsSlice::as_slice(*self) }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a, T> Default for &'a [T] { impl<'a, T> Default for &'a [T] {
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn default() -> &'a [T] { &[] } fn default() -> &'a [T] { &[] }
} }
@ -668,7 +668,7 @@ impl<'a, T> Default for &'a [T] {
// The shared definition of the `Iter` and `IterMut` iterators // The shared definition of the `Iter` and `IterMut` iterators
macro_rules! iterator { macro_rules! iterator {
(struct $name:ident -> $ptr:ty, $elem:ty) => { (struct $name:ident -> $ptr:ty, $elem:ty) => {
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a, T> Iterator for $name<'a, T> { impl<'a, T> Iterator for $name<'a, T> {
type Item = $elem; type Item = $elem;
@ -706,7 +706,7 @@ macro_rules! iterator {
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a, T> DoubleEndedIterator for $name<'a, T> { impl<'a, T> DoubleEndedIterator for $name<'a, T> {
#[inline] #[inline]
fn next_back(&mut self) -> Option<$elem> { fn next_back(&mut self) -> Option<$elem> {
@ -748,7 +748,7 @@ macro_rules! make_slice {
} }
/// Immutable slice iterator /// Immutable slice iterator
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub struct Iter<'a, T: 'a> { pub struct Iter<'a, T: 'a> {
ptr: *const T, ptr: *const T,
end: *const T, end: *const T,
@ -806,10 +806,10 @@ impl<'a,T> Copy for Iter<'a,T> {}
iterator!{struct Iter -> *const T, &'a T} iterator!{struct Iter -> *const T, &'a T}
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a, T> ExactSizeIterator for Iter<'a, T> {} impl<'a, T> ExactSizeIterator for Iter<'a, T> {}
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a, T> Clone for Iter<'a, T> { impl<'a, T> Clone for Iter<'a, T> {
fn clone(&self) -> Iter<'a, T> { *self } fn clone(&self) -> Iter<'a, T> { *self }
} }
@ -840,7 +840,7 @@ impl<'a, T> RandomAccessIterator for Iter<'a, T> {
} }
/// Mutable slice iterator. /// Mutable slice iterator.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub struct IterMut<'a, T: 'a> { pub struct IterMut<'a, T: 'a> {
ptr: *mut T, ptr: *mut T,
end: *mut T, end: *mut T,
@ -930,7 +930,7 @@ impl<'a, T> IterMut<'a, T> {
iterator!{struct IterMut -> *mut T, &'a mut T} iterator!{struct IterMut -> *mut T, &'a mut T}
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a, T> ExactSizeIterator for IterMut<'a, T> {} impl<'a, T> ExactSizeIterator for IterMut<'a, T> {}
/// An internal abstraction over the splitting iterators, so that /// An internal abstraction over the splitting iterators, so that
@ -943,7 +943,7 @@ trait SplitIter: DoubleEndedIterator {
/// An iterator over subslices separated by elements that match a predicate /// An iterator over subslices separated by elements that match a predicate
/// function. /// function.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub struct Split<'a, T:'a, P> where P: FnMut(&T) -> bool { pub struct Split<'a, T:'a, P> where P: FnMut(&T) -> bool {
v: &'a [T], v: &'a [T],
pred: P, pred: P,
@ -951,7 +951,7 @@ pub struct Split<'a, T:'a, P> where P: FnMut(&T) -> bool {
} }
// FIXME(#19839) Remove in favor of `#[derive(Clone)]` // FIXME(#19839) Remove in favor of `#[derive(Clone)]`
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a, T, P> Clone for Split<'a, T, P> where P: Clone + FnMut(&T) -> bool { impl<'a, T, P> Clone for Split<'a, T, P> where P: Clone + FnMut(&T) -> bool {
fn clone(&self) -> Split<'a, T, P> { fn clone(&self) -> Split<'a, T, P> {
Split { Split {
@ -962,7 +962,7 @@ impl<'a, T, P> Clone for Split<'a, T, P> where P: Clone + FnMut(&T) -> bool {
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a, T, P> Iterator for Split<'a, T, P> where P: FnMut(&T) -> bool { impl<'a, T, P> Iterator for Split<'a, T, P> where P: FnMut(&T) -> bool {
type Item = &'a [T]; type Item = &'a [T];
@ -990,7 +990,7 @@ impl<'a, T, P> Iterator for Split<'a, T, P> where P: FnMut(&T) -> bool {
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a, T, P> DoubleEndedIterator for Split<'a, T, P> where P: FnMut(&T) -> bool { impl<'a, T, P> DoubleEndedIterator for Split<'a, T, P> where P: FnMut(&T) -> bool {
#[inline] #[inline]
fn next_back(&mut self) -> Option<&'a [T]> { fn next_back(&mut self) -> Option<&'a [T]> {
@ -1016,7 +1016,7 @@ impl<'a, T, P> SplitIter for Split<'a, T, P> where P: FnMut(&T) -> bool {
/// An iterator over the subslices of the vector which are separated /// An iterator over the subslices of the vector which are separated
/// by elements that match `pred`. /// by elements that match `pred`.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub struct SplitMut<'a, T:'a, P> where P: FnMut(&T) -> bool { pub struct SplitMut<'a, T:'a, P> where P: FnMut(&T) -> bool {
v: &'a mut [T], v: &'a mut [T],
pred: P, pred: P,
@ -1035,7 +1035,7 @@ impl<'a, T, P> SplitIter for SplitMut<'a, T, P> where P: FnMut(&T) -> bool {
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a, T, P> Iterator for SplitMut<'a, T, P> where P: FnMut(&T) -> bool { impl<'a, T, P> Iterator for SplitMut<'a, T, P> where P: FnMut(&T) -> bool {
type Item = &'a mut [T]; type Item = &'a mut [T];
@ -1070,7 +1070,7 @@ impl<'a, T, P> Iterator for SplitMut<'a, T, P> where P: FnMut(&T) -> bool {
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a, T, P> DoubleEndedIterator for SplitMut<'a, T, P> where impl<'a, T, P> DoubleEndedIterator for SplitMut<'a, T, P> where
P: FnMut(&T) -> bool, P: FnMut(&T) -> bool,
{ {
@ -1125,7 +1125,7 @@ impl<T, I: SplitIter<Item=T>> Iterator for GenericSplitN<I> {
/// An iterator over subslices separated by elements that match a predicate /// An iterator over subslices separated by elements that match a predicate
/// function, limited to a given number of splits. /// function, limited to a given number of splits.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub struct SplitN<'a, T: 'a, P> where P: FnMut(&T) -> bool { pub struct SplitN<'a, T: 'a, P> where P: FnMut(&T) -> bool {
inner: GenericSplitN<Split<'a, T, P>> inner: GenericSplitN<Split<'a, T, P>>
} }
@ -1133,14 +1133,14 @@ pub struct SplitN<'a, T: 'a, P> where P: FnMut(&T) -> bool {
/// An iterator over subslices separated by elements that match a /// An iterator over subslices separated by elements that match a
/// predicate function, limited to a given number of splits, starting /// predicate function, limited to a given number of splits, starting
/// from the end of the slice. /// from the end of the slice.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub struct RSplitN<'a, T: 'a, P> where P: FnMut(&T) -> bool { pub struct RSplitN<'a, T: 'a, P> where P: FnMut(&T) -> bool {
inner: GenericSplitN<Split<'a, T, P>> inner: GenericSplitN<Split<'a, T, P>>
} }
/// An iterator over subslices separated by elements that match a predicate /// An iterator over subslices separated by elements that match a predicate
/// function, limited to a given number of splits. /// function, limited to a given number of splits.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub struct SplitNMut<'a, T: 'a, P> where P: FnMut(&T) -> bool { pub struct SplitNMut<'a, T: 'a, P> where P: FnMut(&T) -> bool {
inner: GenericSplitN<SplitMut<'a, T, P>> inner: GenericSplitN<SplitMut<'a, T, P>>
} }
@ -1148,14 +1148,14 @@ pub struct SplitNMut<'a, T: 'a, P> where P: FnMut(&T) -> bool {
/// An iterator over subslices separated by elements that match a /// An iterator over subslices separated by elements that match a
/// predicate function, limited to a given number of splits, starting /// predicate function, limited to a given number of splits, starting
/// from the end of the slice. /// from the end of the slice.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub struct RSplitNMut<'a, T: 'a, P> where P: FnMut(&T) -> bool { pub struct RSplitNMut<'a, T: 'a, P> where P: FnMut(&T) -> bool {
inner: GenericSplitN<SplitMut<'a, T, P>> inner: GenericSplitN<SplitMut<'a, T, P>>
} }
macro_rules! forward_iterator { macro_rules! forward_iterator {
($name:ident: $elem:ident, $iter_of:ty) => { ($name:ident: $elem:ident, $iter_of:ty) => {
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a, $elem, P> Iterator for $name<'a, $elem, P> where impl<'a, $elem, P> Iterator for $name<'a, $elem, P> where
P: FnMut(&T) -> bool P: FnMut(&T) -> bool
{ {
@ -1181,13 +1181,13 @@ forward_iterator! { RSplitNMut: T, &'a mut [T] }
/// An iterator over overlapping subslices of length `size`. /// An iterator over overlapping subslices of length `size`.
#[derive(Clone)] #[derive(Clone)]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub struct Windows<'a, T:'a> { pub struct Windows<'a, T:'a> {
v: &'a [T], v: &'a [T],
size: uint size: uint
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a, T> Iterator for Windows<'a, T> { impl<'a, T> Iterator for Windows<'a, T> {
type Item = &'a [T]; type Item = &'a [T];
@ -1219,13 +1219,13 @@ impl<'a, T> Iterator for Windows<'a, T> {
/// When the slice len is not evenly divided by the chunk size, the last slice /// When the slice len is not evenly divided by the chunk size, the last slice
/// of the iteration will be the remainder. /// of the iteration will be the remainder.
#[derive(Clone)] #[derive(Clone)]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub struct Chunks<'a, T:'a> { pub struct Chunks<'a, T:'a> {
v: &'a [T], v: &'a [T],
size: uint size: uint
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a, T> Iterator for Chunks<'a, T> { impl<'a, T> Iterator for Chunks<'a, T> {
type Item = &'a [T]; type Item = &'a [T];
@ -1254,7 +1254,7 @@ impl<'a, T> Iterator for Chunks<'a, T> {
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a, T> DoubleEndedIterator for Chunks<'a, T> { impl<'a, T> DoubleEndedIterator for Chunks<'a, T> {
#[inline] #[inline]
fn next_back(&mut self) -> Option<&'a [T]> { fn next_back(&mut self) -> Option<&'a [T]> {
@ -1294,13 +1294,13 @@ impl<'a, T> RandomAccessIterator for Chunks<'a, T> {
/// An iterator over a slice in (non-overlapping) mutable chunks (`size` /// An iterator over a slice in (non-overlapping) mutable chunks (`size`
/// elements at a time). When the slice len is not evenly divided by the chunk /// elements at a time). When the slice len is not evenly divided by the chunk
/// size, the last slice of the iteration will be the remainder. /// size, the last slice of the iteration will be the remainder.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub struct ChunksMut<'a, T:'a> { pub struct ChunksMut<'a, T:'a> {
v: &'a mut [T], v: &'a mut [T],
chunk_size: uint chunk_size: uint
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a, T> Iterator for ChunksMut<'a, T> { impl<'a, T> Iterator for ChunksMut<'a, T> {
type Item = &'a mut [T]; type Item = &'a mut [T];
@ -1330,7 +1330,7 @@ impl<'a, T> Iterator for ChunksMut<'a, T> {
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a, T> DoubleEndedIterator for ChunksMut<'a, T> { impl<'a, T> DoubleEndedIterator for ChunksMut<'a, T> {
#[inline] #[inline]
fn next_back(&mut self) -> Option<&'a mut [T]> { fn next_back(&mut self) -> Option<&'a mut [T]> {
@ -1461,7 +1461,7 @@ pub mod bytes {
// Boilerplate traits // Boilerplate traits
// //
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<A, B> PartialEq<[B]> for [A] where A: PartialEq<B> { impl<A, B> PartialEq<[B]> for [A] where A: PartialEq<B> {
fn eq(&self, other: &[B]) -> bool { fn eq(&self, other: &[B]) -> bool {
self.len() == other.len() && self.len() == other.len() &&
@ -1473,17 +1473,17 @@ impl<A, B> PartialEq<[B]> for [A] where A: PartialEq<B> {
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<T: Eq> Eq for [T] {} impl<T: Eq> Eq for [T] {}
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<T: Ord> Ord for [T] { impl<T: Ord> Ord for [T] {
fn cmp(&self, other: &[T]) -> Ordering { fn cmp(&self, other: &[T]) -> Ordering {
order::cmp(self.iter(), other.iter()) order::cmp(self.iter(), other.iter())
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<T: PartialOrd> PartialOrd for [T] { impl<T: PartialOrd> PartialOrd for [T] {
#[inline] #[inline]
fn partial_cmp(&self, other: &[T]) -> Option<Ordering> { fn partial_cmp(&self, other: &[T]) -> Option<Ordering> {

View File

@ -45,7 +45,7 @@ macro_rules! delegate_iter {
} }
}; };
($te:ty : $ti:ty) => { ($te:ty : $ti:ty) => {
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a> Iterator for $ti { impl<'a> Iterator for $ti {
type Item = $te; type Item = $te;
@ -58,7 +58,7 @@ macro_rules! delegate_iter {
self.0.size_hint() self.0.size_hint()
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a> DoubleEndedIterator for $ti { impl<'a> DoubleEndedIterator for $ti {
#[inline] #[inline]
fn next_back(&mut self) -> Option<$te> { fn next_back(&mut self) -> Option<$te> {
@ -67,7 +67,7 @@ macro_rules! delegate_iter {
} }
}; };
(pattern $te:ty : $ti:ty) => { (pattern $te:ty : $ti:ty) => {
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a, P: CharEq> Iterator for $ti { impl<'a, P: CharEq> Iterator for $ti {
type Item = $te; type Item = $te;
@ -80,7 +80,7 @@ macro_rules! delegate_iter {
self.0.size_hint() self.0.size_hint()
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a, P: CharEq> DoubleEndedIterator for $ti { impl<'a, P: CharEq> DoubleEndedIterator for $ti {
#[inline] #[inline]
fn next_back(&mut self) -> Option<$te> { fn next_back(&mut self) -> Option<$te> {
@ -89,7 +89,7 @@ macro_rules! delegate_iter {
} }
}; };
(pattern forward $te:ty : $ti:ty) => { (pattern forward $te:ty : $ti:ty) => {
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a, P: CharEq> Iterator for $ti { impl<'a, P: CharEq> Iterator for $ti {
type Item = $te; type Item = $te;
@ -169,7 +169,7 @@ pub enum Utf8Error {
/// ///
/// Returns `Err` if the slice is not utf-8 with a description as to why the /// Returns `Err` if the slice is not utf-8 with a description as to why the
/// provided slice is not utf-8. /// provided slice is not utf-8.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn from_utf8(v: &[u8]) -> Result<&str, Utf8Error> { pub fn from_utf8(v: &[u8]) -> Result<&str, Utf8Error> {
try!(run_utf8_validation_iterator(&mut v.iter())); try!(run_utf8_validation_iterator(&mut v.iter()));
Ok(unsafe { from_utf8_unchecked(v) }) Ok(unsafe { from_utf8_unchecked(v) })
@ -177,7 +177,7 @@ pub fn from_utf8(v: &[u8]) -> Result<&str, Utf8Error> {
/// Converts a slice of bytes to a string slice without checking /// Converts a slice of bytes to a string slice without checking
/// that the string contains valid UTF-8. /// that the string contains valid UTF-8.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub unsafe fn from_utf8_unchecked<'a>(v: &'a [u8]) -> &'a str { pub unsafe fn from_utf8_unchecked<'a>(v: &'a [u8]) -> &'a str {
mem::transmute(v) mem::transmute(v)
} }
@ -255,7 +255,7 @@ Section: Iterators
/// ///
/// Created with the method `.chars()`. /// Created with the method `.chars()`.
#[derive(Clone, Copy)] #[derive(Clone, Copy)]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub struct Chars<'a> { pub struct Chars<'a> {
iter: slice::Iter<'a, u8> iter: slice::Iter<'a, u8>
} }
@ -284,7 +284,7 @@ fn unwrap_or_0(opt: Option<&u8>) -> u8 {
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a> Iterator for Chars<'a> { impl<'a> Iterator for Chars<'a> {
type Item = char; type Item = char;
@ -330,7 +330,7 @@ impl<'a> Iterator for Chars<'a> {
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a> DoubleEndedIterator for Chars<'a> { impl<'a> DoubleEndedIterator for Chars<'a> {
#[inline] #[inline]
fn next_back(&mut self) -> Option<char> { fn next_back(&mut self) -> Option<char> {
@ -367,13 +367,13 @@ impl<'a> DoubleEndedIterator for Chars<'a> {
/// External iterator for a string's characters and their byte offsets. /// External iterator for a string's characters and their byte offsets.
/// Use with the `std::iter` module. /// Use with the `std::iter` module.
#[derive(Clone)] #[derive(Clone)]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub struct CharIndices<'a> { pub struct CharIndices<'a> {
front_offset: uint, front_offset: uint,
iter: Chars<'a>, iter: Chars<'a>,
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a> Iterator for CharIndices<'a> { impl<'a> Iterator for CharIndices<'a> {
type Item = (uint, char); type Item = (uint, char);
@ -397,7 +397,7 @@ impl<'a> Iterator for CharIndices<'a> {
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a> DoubleEndedIterator for CharIndices<'a> { impl<'a> DoubleEndedIterator for CharIndices<'a> {
#[inline] #[inline]
fn next_back(&mut self) -> Option<(uint, char)> { fn next_back(&mut self) -> Option<(uint, char)> {
@ -416,7 +416,7 @@ impl<'a> DoubleEndedIterator for CharIndices<'a> {
/// Use with the `std::iter` module. /// Use with the `std::iter` module.
/// ///
/// Created with `StrExt::bytes` /// Created with `StrExt::bytes`
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[derive(Clone)] #[derive(Clone)]
pub struct Bytes<'a>(Map<&'a u8, u8, slice::Iter<'a, u8>, BytesDeref>); pub struct Bytes<'a>(Map<&'a u8, u8, slice::Iter<'a, u8>, BytesDeref>);
delegate_iter!{exact u8 : Bytes<'a>} delegate_iter!{exact u8 : Bytes<'a>}
@ -456,13 +456,13 @@ struct CharSplitsN<'a, Sep> {
} }
/// An iterator over the lines of a string, separated by `\n`. /// An iterator over the lines of a string, separated by `\n`.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub struct Lines<'a> { pub struct Lines<'a> {
inner: CharSplits<'a, char>, inner: CharSplits<'a, char>,
} }
/// An iterator over the lines of a string, separated by either `\n` or (`\r\n`). /// An iterator over the lines of a string, separated by either `\n` or (`\r\n`).
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub struct LinesAny<'a> { pub struct LinesAny<'a> {
inner: Map<&'a str, &'a str, Lines<'a>, fn(&str) -> &str>, inner: Map<&'a str, &'a str, Lines<'a>, fn(&str) -> &str>,
} }
@ -479,7 +479,7 @@ impl<'a, Sep> CharSplits<'a, Sep> {
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a, Sep: CharEq> Iterator for CharSplits<'a, Sep> { impl<'a, Sep: CharEq> Iterator for CharSplits<'a, Sep> {
type Item = &'a str; type Item = &'a str;
@ -514,7 +514,7 @@ impl<'a, Sep: CharEq> Iterator for CharSplits<'a, Sep> {
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a, Sep: CharEq> DoubleEndedIterator for CharSplits<'a, Sep> { impl<'a, Sep: CharEq> DoubleEndedIterator for CharSplits<'a, Sep> {
#[inline] #[inline]
fn next_back(&mut self) -> Option<&'a str> { fn next_back(&mut self) -> Option<&'a str> {
@ -556,7 +556,7 @@ impl<'a, Sep: CharEq> DoubleEndedIterator for CharSplits<'a, Sep> {
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a, Sep: CharEq> Iterator for CharSplitsN<'a, Sep> { impl<'a, Sep: CharEq> Iterator for CharSplitsN<'a, Sep> {
type Item = &'a str; type Item = &'a str;
@ -880,7 +880,7 @@ pub struct SplitStr<'a> {
finished: bool finished: bool
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a> Iterator for MatchIndices<'a> { impl<'a> Iterator for MatchIndices<'a> {
type Item = (uint, uint); type Item = (uint, uint);
@ -897,7 +897,7 @@ impl<'a> Iterator for MatchIndices<'a> {
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a> Iterator for SplitStr<'a> { impl<'a> Iterator for SplitStr<'a> {
type Item = &'a str; type Item = &'a str;
@ -1084,7 +1084,7 @@ mod traits {
use ops; use ops;
use str::{StrExt, eq_slice}; use str::{StrExt, eq_slice};
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl Ord for str { impl Ord for str {
#[inline] #[inline]
fn cmp(&self, other: &str) -> Ordering { fn cmp(&self, other: &str) -> Ordering {
@ -1100,7 +1100,7 @@ mod traits {
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl PartialEq for str { impl PartialEq for str {
#[inline] #[inline]
fn eq(&self, other: &str) -> bool { fn eq(&self, other: &str) -> bool {
@ -1110,10 +1110,10 @@ mod traits {
fn ne(&self, other: &str) -> bool { !(*self).eq(other) } fn ne(&self, other: &str) -> bool { !(*self).eq(other) }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl Eq for str {} impl Eq for str {}
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl PartialOrd for str { impl PartialOrd for str {
#[inline] #[inline]
fn partial_cmp(&self, other: &str) -> Option<Ordering> { fn partial_cmp(&self, other: &str) -> Option<Ordering> {
@ -1173,7 +1173,7 @@ impl<'a, S: ?Sized> Str for &'a S where S: Str {
/// Return type of `StrExt::split` /// Return type of `StrExt::split`
#[derive(Clone)] #[derive(Clone)]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub struct Split<'a, P>(CharSplits<'a, P>); pub struct Split<'a, P>(CharSplits<'a, P>);
delegate_iter!{pattern &'a str : Split<'a, P>} delegate_iter!{pattern &'a str : Split<'a, P>}
@ -1186,13 +1186,13 @@ delegate_iter!{pattern &'a str : SplitTerminator<'a, P>}
/// Return type of `StrExt::splitn` /// Return type of `StrExt::splitn`
#[derive(Clone)] #[derive(Clone)]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub struct SplitN<'a, P>(CharSplitsN<'a, P>); pub struct SplitN<'a, P>(CharSplitsN<'a, P>);
delegate_iter!{pattern forward &'a str : SplitN<'a, P>} delegate_iter!{pattern forward &'a str : SplitN<'a, P>}
/// Return type of `StrExt::rsplitn` /// Return type of `StrExt::rsplitn`
#[derive(Clone)] #[derive(Clone)]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub struct RSplitN<'a, P>(CharSplitsN<'a, P>); pub struct RSplitN<'a, P>(CharSplitsN<'a, P>);
delegate_iter!{pattern forward &'a str : RSplitN<'a, P>} delegate_iter!{pattern forward &'a str : RSplitN<'a, P>}
@ -1607,13 +1607,13 @@ impl StrExt for str {
fn parse<T: FromStr>(&self) -> Option<T> { FromStr::from_str(self) } fn parse<T: FromStr>(&self) -> Option<T> { FromStr::from_str(self) }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a> Default for &'a str { impl<'a> Default for &'a str {
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn default() -> &'a str { "" } fn default() -> &'a str { "" }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a> Iterator for Lines<'a> { impl<'a> Iterator for Lines<'a> {
type Item = &'a str; type Item = &'a str;
@ -1623,13 +1623,13 @@ impl<'a> Iterator for Lines<'a> {
fn size_hint(&self) -> (uint, Option<uint>) { self.inner.size_hint() } fn size_hint(&self) -> (uint, Option<uint>) { self.inner.size_hint() }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a> DoubleEndedIterator for Lines<'a> { impl<'a> DoubleEndedIterator for Lines<'a> {
#[inline] #[inline]
fn next_back(&mut self) -> Option<&'a str> { self.inner.next_back() } fn next_back(&mut self) -> Option<&'a str> { self.inner.next_back() }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a> Iterator for LinesAny<'a> { impl<'a> Iterator for LinesAny<'a> {
type Item = &'a str; type Item = &'a str;
@ -1639,7 +1639,7 @@ impl<'a> Iterator for LinesAny<'a> {
fn size_hint(&self) -> (uint, Option<uint>) { self.inner.size_hint() } fn size_hint(&self) -> (uint, Option<uint>) { self.inner.size_hint() }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a> DoubleEndedIterator for LinesAny<'a> { impl<'a> DoubleEndedIterator for LinesAny<'a> {
#[inline] #[inline]
fn next_back(&mut self) -> Option<&'a str> { self.inner.next_back() } fn next_back(&mut self) -> Option<&'a str> { self.inner.next_back() }

View File

@ -33,7 +33,7 @@
//! * `Ord` //! * `Ord`
//! * `Default` //! * `Default`
#![stable(feature = "grandfathered", since = "1.0.0")] #![stable(feature = "rust1", since = "1.0.0")]
use clone::Clone; use clone::Clone;
use cmp::*; use cmp::*;
@ -55,14 +55,14 @@ macro_rules! tuple_impls {
} }
)+) => { )+) => {
$( $(
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<$($T:Clone),+> Clone for ($($T,)+) { impl<$($T:Clone),+> Clone for ($($T,)+) {
fn clone(&self) -> ($($T,)+) { fn clone(&self) -> ($($T,)+) {
($(e!(self.$idx.clone()),)+) ($(e!(self.$idx.clone()),)+)
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<$($T:PartialEq),+> PartialEq for ($($T,)+) { impl<$($T:PartialEq),+> PartialEq for ($($T,)+) {
#[inline] #[inline]
fn eq(&self, other: &($($T,)+)) -> bool { fn eq(&self, other: &($($T,)+)) -> bool {
@ -74,10 +74,10 @@ macro_rules! tuple_impls {
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<$($T:Eq),+> Eq for ($($T,)+) {} impl<$($T:Eq),+> Eq for ($($T,)+) {}
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<$($T:PartialOrd + PartialEq),+> PartialOrd for ($($T,)+) { impl<$($T:PartialOrd + PartialEq),+> PartialOrd for ($($T,)+) {
#[inline] #[inline]
fn partial_cmp(&self, other: &($($T,)+)) -> Option<Ordering> { fn partial_cmp(&self, other: &($($T,)+)) -> Option<Ordering> {
@ -101,7 +101,7 @@ macro_rules! tuple_impls {
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<$($T:Ord),+> Ord for ($($T,)+) { impl<$($T:Ord),+> Ord for ($($T,)+) {
#[inline] #[inline]
fn cmp(&self, other: &($($T,)+)) -> Ordering { fn cmp(&self, other: &($($T,)+)) -> Ordering {
@ -109,9 +109,9 @@ macro_rules! tuple_impls {
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<$($T:Default),+> Default for ($($T,)+) { impl<$($T:Default),+> Default for ($($T,)+) {
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[inline] #[inline]
fn default() -> ($($T,)+) { fn default() -> ($($T,)+) {
($({ let x: $T = Default::default(); x},)+) ($({ let x: $T = Default::default(); x},)+)

View File

@ -141,9 +141,9 @@ impl<R: Rng + Default> Reseeder<R> for ReseedWithDefault {
*rng = Default::default(); *rng = Default::default();
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl Default for ReseedWithDefault { impl Default for ReseedWithDefault {
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn default() -> ReseedWithDefault { ReseedWithDefault } fn default() -> ReseedWithDefault { ReseedWithDefault }
} }

View File

@ -59,7 +59,7 @@ impl<'a> Annotator<'a> {
Some(stab) => { Some(stab) => {
self.index.local.insert(id, stab.clone()); self.index.local.insert(id, stab.clone());
// Don't inherit #[stable(feature = "grandfathered", since = "1.0.0")] // Don't inherit #[stable(feature = "rust1", since = "1.0.0")]
if stab.level != attr::Stable { if stab.level != attr::Stable {
let parent = replace(&mut self.parent, Some(stab)); let parent = replace(&mut self.parent, Some(stab));
f(self); f(self);

View File

@ -11,5 +11,5 @@
//! The boolean type //! The boolean type
#![doc(primitive = "bool")] #![doc(primitive = "bool")]
#![stable(feature = "grandfathered", since = "1.0.0")] #![stable(feature = "rust1", since = "1.0.0")]

View File

@ -296,7 +296,7 @@ fn test_resize_policy() {
/// } /// }
/// ``` /// ```
#[derive(Clone)] #[derive(Clone)]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub struct HashMap<K, V, S = RandomState> { pub struct HashMap<K, V, S = RandomState> {
// All hashes are keyed on these values, to prevent hash collision attacks. // All hashes are keyed on these values, to prevent hash collision attacks.
hash_state: S, hash_state: S,
@ -499,7 +499,7 @@ impl<K: Hash<Hasher> + Eq, V> HashMap<K, V, RandomState> {
/// let mut map: HashMap<&str, int> = HashMap::new(); /// let mut map: HashMap<&str, int> = HashMap::new();
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn new() -> HashMap<K, V, RandomState> { pub fn new() -> HashMap<K, V, RandomState> {
Default::default() Default::default()
} }
@ -513,7 +513,7 @@ impl<K: Hash<Hasher> + Eq, V> HashMap<K, V, RandomState> {
/// let mut map: HashMap<&str, int> = HashMap::with_capacity(10); /// let mut map: HashMap<&str, int> = HashMap::with_capacity(10);
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn with_capacity(capacity: uint) -> HashMap<K, V, RandomState> { pub fn with_capacity(capacity: uint) -> HashMap<K, V, RandomState> {
HashMap::with_capacity_and_hash_state(capacity, Default::default()) HashMap::with_capacity_and_hash_state(capacity, Default::default())
} }
@ -591,7 +591,7 @@ impl<K, V, S, H> HashMap<K, V, S>
/// assert!(map.capacity() >= 100); /// assert!(map.capacity() >= 100);
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn capacity(&self) -> uint { pub fn capacity(&self) -> uint {
self.resize_policy.usable_capacity(self.table.capacity()) self.resize_policy.usable_capacity(self.table.capacity())
} }
@ -611,7 +611,7 @@ impl<K, V, S, H> HashMap<K, V, S>
/// let mut map: HashMap<&str, int> = HashMap::new(); /// let mut map: HashMap<&str, int> = HashMap::new();
/// map.reserve(10); /// map.reserve(10);
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn reserve(&mut self, additional: uint) { pub fn reserve(&mut self, additional: uint) {
let new_size = self.len().checked_add(additional).expect("capacity overflow"); let new_size = self.len().checked_add(additional).expect("capacity overflow");
let min_cap = self.resize_policy.min_capacity(new_size); let min_cap = self.resize_policy.min_capacity(new_size);
@ -723,7 +723,7 @@ impl<K, V, S, H> HashMap<K, V, S>
/// map.shrink_to_fit(); /// map.shrink_to_fit();
/// assert!(map.capacity() >= 2); /// assert!(map.capacity() >= 2);
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn shrink_to_fit(&mut self) { pub fn shrink_to_fit(&mut self) {
let min_capacity = self.resize_policy.min_capacity(self.len()); let min_capacity = self.resize_policy.min_capacity(self.len());
let min_capacity = max(min_capacity.next_power_of_two(), INITIAL_CAPACITY); let min_capacity = max(min_capacity.next_power_of_two(), INITIAL_CAPACITY);
@ -817,7 +817,7 @@ impl<K, V, S, H> HashMap<K, V, S>
/// println!("{}", key); /// println!("{}", key);
/// } /// }
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn keys<'a>(&'a self) -> Keys<'a, K, V> { pub fn keys<'a>(&'a self) -> Keys<'a, K, V> {
fn first<A, B>((a, _): (A, B)) -> A { a } fn first<A, B>((a, _): (A, B)) -> A { a }
let first: fn((&'a K,&'a V)) -> &'a K = first; // coerce to fn ptr let first: fn((&'a K,&'a V)) -> &'a K = first; // coerce to fn ptr
@ -842,7 +842,7 @@ impl<K, V, S, H> HashMap<K, V, S>
/// println!("{}", key); /// println!("{}", key);
/// } /// }
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn values<'a>(&'a self) -> Values<'a, K, V> { pub fn values<'a>(&'a self) -> Values<'a, K, V> {
fn second<A, B>((_, b): (A, B)) -> B { b } fn second<A, B>((_, b): (A, B)) -> B { b }
let second: fn((&'a K,&'a V)) -> &'a V = second; // coerce to fn ptr let second: fn((&'a K,&'a V)) -> &'a V = second; // coerce to fn ptr
@ -867,7 +867,7 @@ impl<K, V, S, H> HashMap<K, V, S>
/// println!("key: {} val: {}", key, val); /// println!("key: {} val: {}", key, val);
/// } /// }
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn iter(&self) -> Iter<K, V> { pub fn iter(&self) -> Iter<K, V> {
Iter { inner: self.table.iter() } Iter { inner: self.table.iter() }
} }
@ -895,7 +895,7 @@ impl<K, V, S, H> HashMap<K, V, S>
/// println!("key: {} val: {}", key, val); /// println!("key: {} val: {}", key, val);
/// } /// }
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn iter_mut(&mut self) -> IterMut<K, V> { pub fn iter_mut(&mut self) -> IterMut<K, V> {
IterMut { inner: self.table.iter_mut() } IterMut { inner: self.table.iter_mut() }
} }
@ -917,7 +917,7 @@ impl<K, V, S, H> HashMap<K, V, S>
/// // Not possible with .iter() /// // Not possible with .iter()
/// let vec: Vec<(&str, int)> = map.into_iter().collect(); /// let vec: Vec<(&str, int)> = map.into_iter().collect();
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn into_iter(self) -> IntoIter<K, V> { pub fn into_iter(self) -> IntoIter<K, V> {
fn last_two<A, B, C>((_, b, c): (A, B, C)) -> (B, C) { (b, c) } fn last_two<A, B, C>((_, b, c): (A, B, C)) -> (B, C) { (b, c) }
let last_two: fn((SafeHash, K, V)) -> (K, V) = last_two; let last_two: fn((SafeHash, K, V)) -> (K, V) = last_two;
@ -951,7 +951,7 @@ impl<K, V, S, H> HashMap<K, V, S>
/// a.insert(1u, "a"); /// a.insert(1u, "a");
/// assert_eq!(a.len(), 1); /// assert_eq!(a.len(), 1);
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn len(&self) -> uint { self.table.size() } pub fn len(&self) -> uint { self.table.size() }
/// Return true if the map contains no elements. /// Return true if the map contains no elements.
@ -967,7 +967,7 @@ impl<K, V, S, H> HashMap<K, V, S>
/// assert!(!a.is_empty()); /// assert!(!a.is_empty());
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn is_empty(&self) -> bool { self.len() == 0 } pub fn is_empty(&self) -> bool { self.len() == 0 }
/// Clears the map, returning all key-value pairs as an iterator. Keeps the /// Clears the map, returning all key-value pairs as an iterator. Keeps the
@ -1014,7 +1014,7 @@ impl<K, V, S, H> HashMap<K, V, S>
/// a.clear(); /// a.clear();
/// assert!(a.is_empty()); /// assert!(a.is_empty());
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[inline] #[inline]
pub fn clear(&mut self) { pub fn clear(&mut self) {
self.drain(); self.drain();
@ -1036,7 +1036,7 @@ impl<K, V, S, H> HashMap<K, V, S>
/// assert_eq!(map.get(&1), Some(&"a")); /// assert_eq!(map.get(&1), Some(&"a"));
/// assert_eq!(map.get(&2), None); /// assert_eq!(map.get(&2), None);
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn get<Q: ?Sized>(&self, k: &Q) -> Option<&V> pub fn get<Q: ?Sized>(&self, k: &Q) -> Option<&V>
where Q: Hash<H> + Eq + BorrowFrom<K> where Q: Hash<H> + Eq + BorrowFrom<K>
{ {
@ -1059,7 +1059,7 @@ impl<K, V, S, H> HashMap<K, V, S>
/// assert_eq!(map.contains_key(&1), true); /// assert_eq!(map.contains_key(&1), true);
/// assert_eq!(map.contains_key(&2), false); /// assert_eq!(map.contains_key(&2), false);
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn contains_key<Q: ?Sized>(&self, k: &Q) -> bool pub fn contains_key<Q: ?Sized>(&self, k: &Q) -> bool
where Q: Hash<H> + Eq + BorrowFrom<K> where Q: Hash<H> + Eq + BorrowFrom<K>
{ {
@ -1085,7 +1085,7 @@ impl<K, V, S, H> HashMap<K, V, S>
/// } /// }
/// assert_eq!(map[1], "b"); /// assert_eq!(map[1], "b");
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn get_mut<Q: ?Sized>(&mut self, k: &Q) -> Option<&mut V> pub fn get_mut<Q: ?Sized>(&mut self, k: &Q) -> Option<&mut V>
where Q: Hash<H> + Eq + BorrowFrom<K> where Q: Hash<H> + Eq + BorrowFrom<K>
{ {
@ -1108,7 +1108,7 @@ impl<K, V, S, H> HashMap<K, V, S>
/// assert_eq!(map.insert(37, "c"), Some("b")); /// assert_eq!(map.insert(37, "c"), Some("b"));
/// assert_eq!(map[37], "c"); /// assert_eq!(map[37], "c");
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn insert(&mut self, k: K, v: V) -> Option<V> { pub fn insert(&mut self, k: K, v: V) -> Option<V> {
let hash = self.make_hash(&k); let hash = self.make_hash(&k);
self.reserve(1); self.reserve(1);
@ -1137,7 +1137,7 @@ impl<K, V, S, H> HashMap<K, V, S>
/// assert_eq!(map.remove(&1), Some("a")); /// assert_eq!(map.remove(&1), Some("a"));
/// assert_eq!(map.remove(&1), None); /// assert_eq!(map.remove(&1), None);
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn remove<Q: ?Sized>(&mut self, k: &Q) -> Option<V> pub fn remove<Q: ?Sized>(&mut self, k: &Q) -> Option<V>
where Q: Hash<H> + Eq + BorrowFrom<K> where Q: Hash<H> + Eq + BorrowFrom<K>
{ {
@ -1210,14 +1210,14 @@ impl<K, V, S, H> PartialEq for HashMap<K, V, S>
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<K, V, S, H> Eq for HashMap<K, V, S> impl<K, V, S, H> Eq for HashMap<K, V, S>
where K: Eq + Hash<H>, V: Eq, where K: Eq + Hash<H>, V: Eq,
S: HashState<Hasher=H>, S: HashState<Hasher=H>,
H: hash::Hasher<Output=u64> H: hash::Hasher<Output=u64>
{} {}
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<K, V, S, H> Show for HashMap<K, V, S> impl<K, V, S, H> Show for HashMap<K, V, S>
where K: Eq + Hash<H> + Show, V: Show, where K: Eq + Hash<H> + Show, V: Show,
S: HashState<Hasher=H>, S: HashState<Hasher=H>,
@ -1235,7 +1235,7 @@ impl<K, V, S, H> Show for HashMap<K, V, S>
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<K, V, S, H> Default for HashMap<K, V, S> impl<K, V, S, H> Default for HashMap<K, V, S>
where K: Eq + Hash<H>, where K: Eq + Hash<H>,
S: HashState<Hasher=H> + Default, S: HashState<Hasher=H> + Default,
@ -1246,7 +1246,7 @@ impl<K, V, S, H> Default for HashMap<K, V, S>
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<K, Q: ?Sized, V, S, H> Index<Q> for HashMap<K, V, S> impl<K, Q: ?Sized, V, S, H> Index<Q> for HashMap<K, V, S>
where K: Eq + Hash<H>, where K: Eq + Hash<H>,
Q: Eq + Hash<H> + BorrowFrom<K>, Q: Eq + Hash<H> + BorrowFrom<K>,
@ -1261,7 +1261,7 @@ impl<K, Q: ?Sized, V, S, H> Index<Q> for HashMap<K, V, S>
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<K, V, S, H, Q: ?Sized> IndexMut<Q> for HashMap<K, V, S> impl<K, V, S, H, Q: ?Sized> IndexMut<Q> for HashMap<K, V, S>
where K: Eq + Hash<H>, where K: Eq + Hash<H>,
Q: Eq + Hash<H> + BorrowFrom<K>, Q: Eq + Hash<H> + BorrowFrom<K>,
@ -1277,7 +1277,7 @@ impl<K, V, S, H, Q: ?Sized> IndexMut<Q> for HashMap<K, V, S>
} }
/// HashMap iterator /// HashMap iterator
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub struct Iter<'a, K: 'a, V: 'a> { pub struct Iter<'a, K: 'a, V: 'a> {
inner: table::Iter<'a, K, V> inner: table::Iter<'a, K, V>
} }
@ -1292,13 +1292,13 @@ impl<'a, K, V> Clone for Iter<'a, K, V> {
} }
/// HashMap mutable values iterator /// HashMap mutable values iterator
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub struct IterMut<'a, K: 'a, V: 'a> { pub struct IterMut<'a, K: 'a, V: 'a> {
inner: table::IterMut<'a, K, V> inner: table::IterMut<'a, K, V>
} }
/// HashMap move iterator /// HashMap move iterator
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub struct IntoIter<K, V> { pub struct IntoIter<K, V> {
inner: iter::Map< inner: iter::Map<
(SafeHash, K, V), (SafeHash, K, V),
@ -1309,7 +1309,7 @@ pub struct IntoIter<K, V> {
} }
/// HashMap keys iterator /// HashMap keys iterator
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub struct Keys<'a, K: 'a, V: 'a> { pub struct Keys<'a, K: 'a, V: 'a> {
inner: Map<(&'a K, &'a V), &'a K, Iter<'a, K, V>, fn((&'a K, &'a V)) -> &'a K> inner: Map<(&'a K, &'a V), &'a K, Iter<'a, K, V>, fn((&'a K, &'a V)) -> &'a K>
} }
@ -1324,7 +1324,7 @@ impl<'a, K, V> Clone for Keys<'a, K, V> {
} }
/// HashMap values iterator /// HashMap values iterator
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub struct Values<'a, K: 'a, V: 'a> { pub struct Values<'a, K: 'a, V: 'a> {
inner: Map<(&'a K, &'a V), &'a V, Iter<'a, K, V>, fn((&'a K, &'a V)) -> &'a V> inner: Map<(&'a K, &'a V), &'a V, Iter<'a, K, V>, fn((&'a K, &'a V)) -> &'a V>
} }
@ -1385,74 +1385,74 @@ enum VacantEntryState<K, V, M> {
NoElem(EmptyBucket<K, V, M>), NoElem(EmptyBucket<K, V, M>),
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a, K, V> Iterator for Iter<'a, K, V> { impl<'a, K, V> Iterator for Iter<'a, K, V> {
type Item = (&'a K, &'a V); type Item = (&'a K, &'a V);
#[inline] fn next(&mut self) -> Option<(&'a K, &'a V)> { self.inner.next() } #[inline] fn next(&mut self) -> Option<(&'a K, &'a V)> { self.inner.next() }
#[inline] fn size_hint(&self) -> (usize, Option<usize>) { self.inner.size_hint() } #[inline] fn size_hint(&self) -> (usize, Option<usize>) { self.inner.size_hint() }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a, K, V> ExactSizeIterator for Iter<'a, K, V> { impl<'a, K, V> ExactSizeIterator for Iter<'a, K, V> {
#[inline] fn len(&self) -> usize { self.inner.len() } #[inline] fn len(&self) -> usize { self.inner.len() }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a, K, V> Iterator for IterMut<'a, K, V> { impl<'a, K, V> Iterator for IterMut<'a, K, V> {
type Item = (&'a K, &'a mut V); type Item = (&'a K, &'a mut V);
#[inline] fn next(&mut self) -> Option<(&'a K, &'a mut V)> { self.inner.next() } #[inline] fn next(&mut self) -> Option<(&'a K, &'a mut V)> { self.inner.next() }
#[inline] fn size_hint(&self) -> (usize, Option<usize>) { self.inner.size_hint() } #[inline] fn size_hint(&self) -> (usize, Option<usize>) { self.inner.size_hint() }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a, K, V> ExactSizeIterator for IterMut<'a, K, V> { impl<'a, K, V> ExactSizeIterator for IterMut<'a, K, V> {
#[inline] fn len(&self) -> usize { self.inner.len() } #[inline] fn len(&self) -> usize { self.inner.len() }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<K, V> Iterator for IntoIter<K, V> { impl<K, V> Iterator for IntoIter<K, V> {
type Item = (K, V); type Item = (K, V);
#[inline] fn next(&mut self) -> Option<(K, V)> { self.inner.next() } #[inline] fn next(&mut self) -> Option<(K, V)> { self.inner.next() }
#[inline] fn size_hint(&self) -> (usize, Option<usize>) { self.inner.size_hint() } #[inline] fn size_hint(&self) -> (usize, Option<usize>) { self.inner.size_hint() }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<K, V> ExactSizeIterator for IntoIter<K, V> { impl<K, V> ExactSizeIterator for IntoIter<K, V> {
#[inline] fn len(&self) -> usize { self.inner.len() } #[inline] fn len(&self) -> usize { self.inner.len() }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a, K, V> Iterator for Keys<'a, K, V> { impl<'a, K, V> Iterator for Keys<'a, K, V> {
type Item = &'a K; type Item = &'a K;
#[inline] fn next(&mut self) -> Option<(&'a K)> { self.inner.next() } #[inline] fn next(&mut self) -> Option<(&'a K)> { self.inner.next() }
#[inline] fn size_hint(&self) -> (usize, Option<usize>) { self.inner.size_hint() } #[inline] fn size_hint(&self) -> (usize, Option<usize>) { self.inner.size_hint() }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a, K, V> ExactSizeIterator for Keys<'a, K, V> { impl<'a, K, V> ExactSizeIterator for Keys<'a, K, V> {
#[inline] fn len(&self) -> usize { self.inner.len() } #[inline] fn len(&self) -> usize { self.inner.len() }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a, K, V> Iterator for Values<'a, K, V> { impl<'a, K, V> Iterator for Values<'a, K, V> {
type Item = &'a V; type Item = &'a V;
#[inline] fn next(&mut self) -> Option<(&'a V)> { self.inner.next() } #[inline] fn next(&mut self) -> Option<(&'a V)> { self.inner.next() }
#[inline] fn size_hint(&self) -> (usize, Option<usize>) { self.inner.size_hint() } #[inline] fn size_hint(&self) -> (usize, Option<usize>) { self.inner.size_hint() }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a, K, V> ExactSizeIterator for Values<'a, K, V> { impl<'a, K, V> ExactSizeIterator for Values<'a, K, V> {
#[inline] fn len(&self) -> usize { self.inner.len() } #[inline] fn len(&self) -> usize { self.inner.len() }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a, K, V> Iterator for Drain<'a, K, V> { impl<'a, K, V> Iterator for Drain<'a, K, V> {
type Item = (K, V); type Item = (K, V);
#[inline] fn next(&mut self) -> Option<(K, V)> { self.inner.next() } #[inline] fn next(&mut self) -> Option<(K, V)> { self.inner.next() }
#[inline] fn size_hint(&self) -> (usize, Option<usize>) { self.inner.size_hint() } #[inline] fn size_hint(&self) -> (usize, Option<usize>) { self.inner.size_hint() }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a, K, V> ExactSizeIterator for Drain<'a, K, V> { impl<'a, K, V> ExactSizeIterator for Drain<'a, K, V> {
#[inline] fn len(&self) -> usize { self.inner.len() } #[inline] fn len(&self) -> usize { self.inner.len() }
} }
@ -1518,7 +1518,7 @@ impl<'a, K: 'a, V: 'a> VacantEntry<'a, K, V> {
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<K, V, S, H> FromIterator<(K, V)> for HashMap<K, V, S> impl<K, V, S, H> FromIterator<(K, V)> for HashMap<K, V, S>
where K: Eq + Hash<H>, where K: Eq + Hash<H>,
S: HashState<Hasher=H> + Default, S: HashState<Hasher=H> + Default,
@ -1533,7 +1533,7 @@ impl<K, V, S, H> FromIterator<(K, V)> for HashMap<K, V, S>
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<K, V, S, H> Extend<(K, V)> for HashMap<K, V, S> impl<K, V, S, H> Extend<(K, V)> for HashMap<K, V, S>
where K: Eq + Hash<H>, where K: Eq + Hash<H>,
S: HashState<Hasher=H>, S: HashState<Hasher=H>,

View File

@ -90,7 +90,7 @@ use super::state::HashState;
/// } /// }
/// ``` /// ```
#[derive(Clone)] #[derive(Clone)]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub struct HashSet<T, S = RandomState> { pub struct HashSet<T, S = RandomState> {
map: HashMap<T, (), S> map: HashMap<T, (), S>
} }
@ -105,7 +105,7 @@ impl<T: Hash<Hasher> + Eq> HashSet<T, RandomState> {
/// let mut set: HashSet<int> = HashSet::new(); /// let mut set: HashSet<int> = HashSet::new();
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn new() -> HashSet<T, RandomState> { pub fn new() -> HashSet<T, RandomState> {
HashSet::with_capacity(INITIAL_CAPACITY) HashSet::with_capacity(INITIAL_CAPACITY)
} }
@ -120,7 +120,7 @@ impl<T: Hash<Hasher> + Eq> HashSet<T, RandomState> {
/// let mut set: HashSet<int> = HashSet::with_capacity(10); /// let mut set: HashSet<int> = HashSet::with_capacity(10);
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn with_capacity(capacity: uint) -> HashSet<T, RandomState> { pub fn with_capacity(capacity: uint) -> HashSet<T, RandomState> {
HashSet { map: HashMap::with_capacity(capacity) } HashSet { map: HashMap::with_capacity(capacity) }
} }
@ -189,7 +189,7 @@ impl<T, S, H> HashSet<T, S>
/// assert!(set.capacity() >= 100); /// assert!(set.capacity() >= 100);
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn capacity(&self) -> uint { pub fn capacity(&self) -> uint {
self.map.capacity() self.map.capacity()
} }
@ -209,7 +209,7 @@ impl<T, S, H> HashSet<T, S>
/// let mut set: HashSet<int> = HashSet::new(); /// let mut set: HashSet<int> = HashSet::new();
/// set.reserve(10); /// set.reserve(10);
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn reserve(&mut self, additional: uint) { pub fn reserve(&mut self, additional: uint) {
self.map.reserve(additional) self.map.reserve(additional)
} }
@ -230,7 +230,7 @@ impl<T, S, H> HashSet<T, S>
/// set.shrink_to_fit(); /// set.shrink_to_fit();
/// assert!(set.capacity() >= 2); /// assert!(set.capacity() >= 2);
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn shrink_to_fit(&mut self) { pub fn shrink_to_fit(&mut self) {
self.map.shrink_to_fit() self.map.shrink_to_fit()
} }
@ -251,7 +251,7 @@ impl<T, S, H> HashSet<T, S>
/// println!("{}", x); /// println!("{}", x);
/// } /// }
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn iter(&self) -> Iter<T> { pub fn iter(&self) -> Iter<T> {
Iter { iter: self.map.keys() } Iter { iter: self.map.keys() }
} }
@ -276,7 +276,7 @@ impl<T, S, H> HashSet<T, S>
/// println!("{}", x); /// println!("{}", x);
/// } /// }
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn into_iter(self) -> IntoIter<T> { pub fn into_iter(self) -> IntoIter<T> {
fn first<A, B>((a, _): (A, B)) -> A { a } fn first<A, B>((a, _): (A, B)) -> A { a }
let first: fn((T, ())) -> T = first; let first: fn((T, ())) -> T = first;
@ -306,7 +306,7 @@ impl<T, S, H> HashSet<T, S>
/// let diff: HashSet<int> = b.difference(&a).map(|&x| x).collect(); /// let diff: HashSet<int> = b.difference(&a).map(|&x| x).collect();
/// assert_eq!(diff, [4i].iter().map(|&x| x).collect()); /// assert_eq!(diff, [4i].iter().map(|&x| x).collect());
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn difference<'a>(&'a self, other: &'a HashSet<T, S>) -> Difference<'a, T, S> { pub fn difference<'a>(&'a self, other: &'a HashSet<T, S>) -> Difference<'a, T, S> {
Difference { Difference {
iter: self.iter(), iter: self.iter(),
@ -334,7 +334,7 @@ impl<T, S, H> HashSet<T, S>
/// assert_eq!(diff1, diff2); /// assert_eq!(diff1, diff2);
/// assert_eq!(diff1, [1i, 4].iter().map(|&x| x).collect()); /// assert_eq!(diff1, [1i, 4].iter().map(|&x| x).collect());
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn symmetric_difference<'a>(&'a self, other: &'a HashSet<T, S>) pub fn symmetric_difference<'a>(&'a self, other: &'a HashSet<T, S>)
-> SymmetricDifference<'a, T, S> { -> SymmetricDifference<'a, T, S> {
SymmetricDifference { iter: self.difference(other).chain(other.difference(self)) } SymmetricDifference { iter: self.difference(other).chain(other.difference(self)) }
@ -357,7 +357,7 @@ impl<T, S, H> HashSet<T, S>
/// let diff: HashSet<int> = a.intersection(&b).map(|&x| x).collect(); /// let diff: HashSet<int> = a.intersection(&b).map(|&x| x).collect();
/// assert_eq!(diff, [2i, 3].iter().map(|&x| x).collect()); /// assert_eq!(diff, [2i, 3].iter().map(|&x| x).collect());
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn intersection<'a>(&'a self, other: &'a HashSet<T, S>) -> Intersection<'a, T, S> { pub fn intersection<'a>(&'a self, other: &'a HashSet<T, S>) -> Intersection<'a, T, S> {
Intersection { Intersection {
iter: self.iter(), iter: self.iter(),
@ -382,7 +382,7 @@ impl<T, S, H> HashSet<T, S>
/// let diff: HashSet<int> = a.union(&b).map(|&x| x).collect(); /// let diff: HashSet<int> = a.union(&b).map(|&x| x).collect();
/// assert_eq!(diff, [1i, 2, 3, 4].iter().map(|&x| x).collect()); /// assert_eq!(diff, [1i, 2, 3, 4].iter().map(|&x| x).collect());
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn union<'a>(&'a self, other: &'a HashSet<T, S>) -> Union<'a, T, S> { pub fn union<'a>(&'a self, other: &'a HashSet<T, S>) -> Union<'a, T, S> {
Union { iter: self.iter().chain(other.difference(self)) } Union { iter: self.iter().chain(other.difference(self)) }
} }
@ -399,7 +399,7 @@ impl<T, S, H> HashSet<T, S>
/// v.insert(1u); /// v.insert(1u);
/// assert_eq!(v.len(), 1); /// assert_eq!(v.len(), 1);
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn len(&self) -> uint { self.map.len() } pub fn len(&self) -> uint { self.map.len() }
/// Returns true if the set contains no elements /// Returns true if the set contains no elements
@ -414,7 +414,7 @@ impl<T, S, H> HashSet<T, S>
/// v.insert(1u); /// v.insert(1u);
/// assert!(!v.is_empty()); /// assert!(!v.is_empty());
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn is_empty(&self) -> bool { self.map.len() == 0 } pub fn is_empty(&self) -> bool { self.map.len() == 0 }
/// Clears the set, returning all elements in an iterator. /// Clears the set, returning all elements in an iterator.
@ -440,7 +440,7 @@ impl<T, S, H> HashSet<T, S>
/// v.clear(); /// v.clear();
/// assert!(v.is_empty()); /// assert!(v.is_empty());
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn clear(&mut self) { self.map.clear() } pub fn clear(&mut self) { self.map.clear() }
/// Returns `true` if the set contains a value. /// Returns `true` if the set contains a value.
@ -458,7 +458,7 @@ impl<T, S, H> HashSet<T, S>
/// assert_eq!(set.contains(&1), true); /// assert_eq!(set.contains(&1), true);
/// assert_eq!(set.contains(&4), false); /// assert_eq!(set.contains(&4), false);
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn contains<Q: ?Sized>(&self, value: &Q) -> bool pub fn contains<Q: ?Sized>(&self, value: &Q) -> bool
where Q: BorrowFrom<T> + Hash<H> + Eq where Q: BorrowFrom<T> + Hash<H> + Eq
{ {
@ -482,7 +482,7 @@ impl<T, S, H> HashSet<T, S>
/// b.insert(1); /// b.insert(1);
/// assert_eq!(a.is_disjoint(&b), false); /// assert_eq!(a.is_disjoint(&b), false);
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn is_disjoint(&self, other: &HashSet<T, S>) -> bool { pub fn is_disjoint(&self, other: &HashSet<T, S>) -> bool {
self.iter().all(|v| !other.contains(v)) self.iter().all(|v| !other.contains(v))
} }
@ -503,7 +503,7 @@ impl<T, S, H> HashSet<T, S>
/// set.insert(4); /// set.insert(4);
/// assert_eq!(set.is_subset(&sup), false); /// assert_eq!(set.is_subset(&sup), false);
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn is_subset(&self, other: &HashSet<T, S>) -> bool { pub fn is_subset(&self, other: &HashSet<T, S>) -> bool {
self.iter().all(|v| other.contains(v)) self.iter().all(|v| other.contains(v))
} }
@ -528,7 +528,7 @@ impl<T, S, H> HashSet<T, S>
/// assert_eq!(set.is_superset(&sub), true); /// assert_eq!(set.is_superset(&sub), true);
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn is_superset(&self, other: &HashSet<T, S>) -> bool { pub fn is_superset(&self, other: &HashSet<T, S>) -> bool {
other.is_subset(self) other.is_subset(self)
} }
@ -547,7 +547,7 @@ impl<T, S, H> HashSet<T, S>
/// assert_eq!(set.insert(2), false); /// assert_eq!(set.insert(2), false);
/// assert_eq!(set.len(), 1); /// assert_eq!(set.len(), 1);
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn insert(&mut self, value: T) -> bool { self.map.insert(value, ()).is_none() } pub fn insert(&mut self, value: T) -> bool { self.map.insert(value, ()).is_none() }
/// Removes a value from the set. Returns `true` if the value was /// Removes a value from the set. Returns `true` if the value was
@ -568,7 +568,7 @@ impl<T, S, H> HashSet<T, S>
/// assert_eq!(set.remove(&2), true); /// assert_eq!(set.remove(&2), true);
/// assert_eq!(set.remove(&2), false); /// assert_eq!(set.remove(&2), false);
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn remove<Q: ?Sized>(&mut self, value: &Q) -> bool pub fn remove<Q: ?Sized>(&mut self, value: &Q) -> bool
where Q: BorrowFrom<T> + Hash<H> + Eq where Q: BorrowFrom<T> + Hash<H> + Eq
{ {
@ -576,7 +576,7 @@ impl<T, S, H> HashSet<T, S>
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<T, S, H> PartialEq for HashSet<T, S> impl<T, S, H> PartialEq for HashSet<T, S>
where T: Eq + Hash<H>, where T: Eq + Hash<H>,
S: HashState<Hasher=H>, S: HashState<Hasher=H>,
@ -589,14 +589,14 @@ impl<T, S, H> PartialEq for HashSet<T, S>
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<T, S, H> Eq for HashSet<T, S> impl<T, S, H> Eq for HashSet<T, S>
where T: Eq + Hash<H>, where T: Eq + Hash<H>,
S: HashState<Hasher=H>, S: HashState<Hasher=H>,
H: hash::Hasher<Output=u64> H: hash::Hasher<Output=u64>
{} {}
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<T, S, H> fmt::Show for HashSet<T, S> impl<T, S, H> fmt::Show for HashSet<T, S>
where T: Eq + Hash<H> + fmt::Show, where T: Eq + Hash<H> + fmt::Show,
S: HashState<Hasher=H>, S: HashState<Hasher=H>,
@ -614,7 +614,7 @@ impl<T, S, H> fmt::Show for HashSet<T, S>
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<T, S, H> FromIterator<T> for HashSet<T, S> impl<T, S, H> FromIterator<T> for HashSet<T, S>
where T: Eq + Hash<H>, where T: Eq + Hash<H>,
S: HashState<Hasher=H> + Default, S: HashState<Hasher=H> + Default,
@ -628,7 +628,7 @@ impl<T, S, H> FromIterator<T> for HashSet<T, S>
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<T, S, H> Extend<T> for HashSet<T, S> impl<T, S, H> Extend<T> for HashSet<T, S>
where T: Eq + Hash<H>, where T: Eq + Hash<H>,
S: HashState<Hasher=H>, S: HashState<Hasher=H>,
@ -641,19 +641,19 @@ impl<T, S, H> Extend<T> for HashSet<T, S>
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<T, S, H> Default for HashSet<T, S> impl<T, S, H> Default for HashSet<T, S>
where T: Eq + Hash<H>, where T: Eq + Hash<H>,
S: HashState<Hasher=H> + Default, S: HashState<Hasher=H> + Default,
H: hash::Hasher<Output=u64> H: hash::Hasher<Output=u64>
{ {
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn default() -> HashSet<T, S> { fn default() -> HashSet<T, S> {
HashSet::with_hash_state(Default::default()) HashSet::with_hash_state(Default::default())
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a, 'b, T, S, H> BitOr<&'b HashSet<T, S>> for &'a HashSet<T, S> impl<'a, 'b, T, S, H> BitOr<&'b HashSet<T, S>> for &'a HashSet<T, S>
where T: Eq + Hash<H> + Clone, where T: Eq + Hash<H> + Clone,
S: HashState<Hasher=H> + Default, S: HashState<Hasher=H> + Default,
@ -686,7 +686,7 @@ impl<'a, 'b, T, S, H> BitOr<&'b HashSet<T, S>> for &'a HashSet<T, S>
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a, 'b, T, S, H> BitAnd<&'b HashSet<T, S>> for &'a HashSet<T, S> impl<'a, 'b, T, S, H> BitAnd<&'b HashSet<T, S>> for &'a HashSet<T, S>
where T: Eq + Hash<H> + Clone, where T: Eq + Hash<H> + Clone,
S: HashState<Hasher=H> + Default, S: HashState<Hasher=H> + Default,
@ -719,7 +719,7 @@ impl<'a, 'b, T, S, H> BitAnd<&'b HashSet<T, S>> for &'a HashSet<T, S>
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a, 'b, T, S, H> BitXor<&'b HashSet<T, S>> for &'a HashSet<T, S> impl<'a, 'b, T, S, H> BitXor<&'b HashSet<T, S>> for &'a HashSet<T, S>
where T: Eq + Hash<H> + Clone, where T: Eq + Hash<H> + Clone,
S: HashState<Hasher=H> + Default, S: HashState<Hasher=H> + Default,
@ -752,7 +752,7 @@ impl<'a, 'b, T, S, H> BitXor<&'b HashSet<T, S>> for &'a HashSet<T, S>
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a, 'b, T, S, H> Sub<&'b HashSet<T, S>> for &'a HashSet<T, S> impl<'a, 'b, T, S, H> Sub<&'b HashSet<T, S>> for &'a HashSet<T, S>
where T: Eq + Hash<H> + Clone, where T: Eq + Hash<H> + Clone,
S: HashState<Hasher=H> + Default, S: HashState<Hasher=H> + Default,
@ -786,25 +786,25 @@ impl<'a, 'b, T, S, H> Sub<&'b HashSet<T, S>> for &'a HashSet<T, S>
} }
/// HashSet iterator /// HashSet iterator
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub struct Iter<'a, K: 'a> { pub struct Iter<'a, K: 'a> {
iter: Keys<'a, K, ()> iter: Keys<'a, K, ()>
} }
/// HashSet move iterator /// HashSet move iterator
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub struct IntoIter<K> { pub struct IntoIter<K> {
iter: Map<(K, ()), K, map::IntoIter<K, ()>, fn((K, ())) -> K> iter: Map<(K, ()), K, map::IntoIter<K, ()>, fn((K, ())) -> K>
} }
/// HashSet drain iterator /// HashSet drain iterator
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub struct Drain<'a, K: 'a> { pub struct Drain<'a, K: 'a> {
iter: Map<(K, ()), K, map::Drain<'a, K, ()>, fn((K, ())) -> K>, iter: Map<(K, ()), K, map::Drain<'a, K, ()>, fn((K, ())) -> K>,
} }
/// Intersection iterator /// Intersection iterator
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub struct Intersection<'a, T: 'a, S: 'a> { pub struct Intersection<'a, T: 'a, S: 'a> {
// iterator of the first set // iterator of the first set
iter: Iter<'a, T>, iter: Iter<'a, T>,
@ -813,7 +813,7 @@ pub struct Intersection<'a, T: 'a, S: 'a> {
} }
/// Difference iterator /// Difference iterator
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub struct Difference<'a, T: 'a, S: 'a> { pub struct Difference<'a, T: 'a, S: 'a> {
// iterator of the first set // iterator of the first set
iter: Iter<'a, T>, iter: Iter<'a, T>,
@ -822,54 +822,54 @@ pub struct Difference<'a, T: 'a, S: 'a> {
} }
/// Symmetric difference iterator. /// Symmetric difference iterator.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub struct SymmetricDifference<'a, T: 'a, S: 'a> { pub struct SymmetricDifference<'a, T: 'a, S: 'a> {
iter: Chain<Difference<'a, T, S>, Difference<'a, T, S>> iter: Chain<Difference<'a, T, S>, Difference<'a, T, S>>
} }
/// Set union iterator. /// Set union iterator.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub struct Union<'a, T: 'a, S: 'a> { pub struct Union<'a, T: 'a, S: 'a> {
iter: Chain<Iter<'a, T>, Difference<'a, T, S>> iter: Chain<Iter<'a, T>, Difference<'a, T, S>>
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a, K> Iterator for Iter<'a, K> { impl<'a, K> Iterator for Iter<'a, K> {
type Item = &'a K; type Item = &'a K;
fn next(&mut self) -> Option<&'a K> { self.iter.next() } fn next(&mut self) -> Option<&'a K> { self.iter.next() }
fn size_hint(&self) -> (usize, Option<usize>) { self.iter.size_hint() } fn size_hint(&self) -> (usize, Option<usize>) { self.iter.size_hint() }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a, K> ExactSizeIterator for Iter<'a, K> { impl<'a, K> ExactSizeIterator for Iter<'a, K> {
fn len(&self) -> usize { self.iter.len() } fn len(&self) -> usize { self.iter.len() }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<K> Iterator for IntoIter<K> { impl<K> Iterator for IntoIter<K> {
type Item = K; type Item = K;
fn next(&mut self) -> Option<K> { self.iter.next() } fn next(&mut self) -> Option<K> { self.iter.next() }
fn size_hint(&self) -> (usize, Option<usize>) { self.iter.size_hint() } fn size_hint(&self) -> (usize, Option<usize>) { self.iter.size_hint() }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<K> ExactSizeIterator for IntoIter<K> { impl<K> ExactSizeIterator for IntoIter<K> {
fn len(&self) -> usize { self.iter.len() } fn len(&self) -> usize { self.iter.len() }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a, K> Iterator for Drain<'a, K> { impl<'a, K> Iterator for Drain<'a, K> {
type Item = K; type Item = K;
fn next(&mut self) -> Option<K> { self.iter.next() } fn next(&mut self) -> Option<K> { self.iter.next() }
fn size_hint(&self) -> (usize, Option<usize>) { self.iter.size_hint() } fn size_hint(&self) -> (usize, Option<usize>) { self.iter.size_hint() }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a, K> ExactSizeIterator for Drain<'a, K> { impl<'a, K> ExactSizeIterator for Drain<'a, K> {
fn len(&self) -> usize { self.iter.len() } fn len(&self) -> usize { self.iter.len() }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a, T, S, H> Iterator for Intersection<'a, T, S> impl<'a, T, S, H> Iterator for Intersection<'a, T, S>
where T: Eq + Hash<H>, where T: Eq + Hash<H>,
S: HashState<Hasher=H>, S: HashState<Hasher=H>,
@ -894,7 +894,7 @@ impl<'a, T, S, H> Iterator for Intersection<'a, T, S>
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a, T, S, H> Iterator for Difference<'a, T, S> impl<'a, T, S, H> Iterator for Difference<'a, T, S>
where T: Eq + Hash<H>, where T: Eq + Hash<H>,
S: HashState<Hasher=H>, S: HashState<Hasher=H>,
@ -919,7 +919,7 @@ impl<'a, T, S, H> Iterator for Difference<'a, T, S>
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a, T, S, H> Iterator for SymmetricDifference<'a, T, S> impl<'a, T, S, H> Iterator for SymmetricDifference<'a, T, S>
where T: Eq + Hash<H>, where T: Eq + Hash<H>,
S: HashState<Hasher=H>, S: HashState<Hasher=H>,
@ -931,7 +931,7 @@ impl<'a, T, S, H> Iterator for SymmetricDifference<'a, T, S>
fn size_hint(&self) -> (usize, Option<usize>) { self.iter.size_hint() } fn size_hint(&self) -> (usize, Option<usize>) { self.iter.size_hint() }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a, T, S, H> Iterator for Union<'a, T, S> impl<'a, T, S, H> Iterator for Union<'a, T, S>
where T: Eq + Hash<H>, where T: Eq + Hash<H>,
S: HashState<Hasher=H>, S: HashState<Hasher=H>,

View File

@ -309,7 +309,7 @@
//! } //! }
//! ``` //! ```
#![stable(feature = "grandfathered", since = "1.0.0")] #![stable(feature = "rust1", since = "1.0.0")]
pub use core_collections::Bound; pub use core_collections::Bound;
pub use core_collections::{BinaryHeap, Bitv, BitvSet, BTreeMap, BTreeSet}; pub use core_collections::{BinaryHeap, Bitv, BitvSet, BTreeMap, BTreeSet};
@ -323,13 +323,13 @@ pub use self::hash_set::HashSet;
mod hash; mod hash;
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub mod hash_map { pub mod hash_map {
//! A hashmap //! A hashmap
pub use super::hash::map::*; pub use super::hash::map::*;
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub mod hash_set { pub mod hash_set {
//! A hashset //! A hashset
pub use super::hash::set::*; pub use super::hash::set::*;

View File

@ -78,7 +78,7 @@
//! } //! }
//! ``` //! ```
#![stable(feature = "grandfathered", since = "1.0.0")] #![stable(feature = "rust1", since = "1.0.0")]
use prelude::v1::*; use prelude::v1::*;
@ -100,22 +100,22 @@ pub trait Error {
} }
/// A trait for types that can be converted from a given error type `E`. /// A trait for types that can be converted from a given error type `E`.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub trait FromError<E> { pub trait FromError<E> {
/// Perform the conversion. /// Perform the conversion.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn from_error(err: E) -> Self; fn from_error(err: E) -> Self;
} }
// Any type is convertable from itself // Any type is convertable from itself
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<E> FromError<E> for E { impl<E> FromError<E> for E {
fn from_error(err: E) -> E { fn from_error(err: E) -> E {
err err
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl Error for Utf8Error { impl Error for Utf8Error {
fn description(&self) -> &str { fn description(&self) -> &str {
match *self { match *self {
@ -127,13 +127,13 @@ impl Error for Utf8Error {
fn detail(&self) -> Option<String> { Some(self.to_string()) } fn detail(&self) -> Option<String> { Some(self.to_string()) }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl Error for FromUtf8Error { impl Error for FromUtf8Error {
fn description(&self) -> &str { "invalid utf-8" } fn description(&self) -> &str { "invalid utf-8" }
fn detail(&self) -> Option<String> { Some(self.to_string()) } fn detail(&self) -> Option<String> { Some(self.to_string()) }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl Error for FromUtf16Error { impl Error for FromUtf16Error {
fn description(&self) -> &str { "invalid utf-16" } fn description(&self) -> &str { "invalid utf-16" }
} }

View File

@ -134,7 +134,7 @@ impl ChanWriter {
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl Clone for ChanWriter { impl Clone for ChanWriter {
fn clone(&self) -> ChanWriter { fn clone(&self) -> ChanWriter {
ChanWriter { tx: self.tx.clone() } ChanWriter { tx: self.tx.clone() }

View File

@ -1814,9 +1814,9 @@ bitflags! {
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl Default for FilePermission { impl Default for FilePermission {
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[inline] #[inline]
fn default() -> FilePermission { FilePermission::empty() } fn default() -> FilePermission { FilePermission::empty() }
} }

View File

@ -95,7 +95,7 @@
//! and `format!`, also available to all Rust code. //! and `format!`, also available to all Rust code.
#![crate_name = "std"] #![crate_name = "std"]
#![stable(feature = "grandfathered", since = "1.0.0")] #![stable(feature = "rust1", since = "1.0.0")]
#![feature(staged_api)] #![feature(staged_api)]
#![staged_api] #![staged_api]
#![crate_type = "rlib"] #![crate_type = "rlib"]
@ -183,7 +183,7 @@ pub use alloc::rc;
pub use core_collections::slice; pub use core_collections::slice;
pub use core_collections::str; pub use core_collections::str;
pub use core_collections::string; pub use core_collections::string;
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub use core_collections::vec; pub use core_collections::vec;
pub use unicode::char; pub use unicode::char;

View File

@ -36,7 +36,7 @@
/// panic!("this is a {} {message}", "fancy", message = "message"); /// panic!("this is a {} {message}", "fancy", message = "message");
/// ``` /// ```
#[macro_export] #[macro_export]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
macro_rules! panic { macro_rules! panic {
() => ({ () => ({
panic!("explicit panic") panic!("explicit panic")
@ -71,7 +71,7 @@ macro_rules! panic {
/// format!("x = {}, y = {y}", 10i, y = 30i); /// format!("x = {}, y = {y}", 10i, y = 30i);
/// ``` /// ```
#[macro_export] #[macro_export]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
macro_rules! format { macro_rules! format {
($($arg:tt)*) => ($crate::fmt::format(format_args!($($arg)*))) ($($arg:tt)*) => ($crate::fmt::format(format_args!($($arg)*)))
} }
@ -79,7 +79,7 @@ macro_rules! format {
/// Equivalent to the `println!` macro except that a newline is not printed at /// Equivalent to the `println!` macro except that a newline is not printed at
/// the end of the message. /// the end of the message.
#[macro_export] #[macro_export]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
macro_rules! print { macro_rules! print {
($($arg:tt)*) => ($crate::io::stdio::print_args(format_args!($($arg)*))) ($($arg:tt)*) => ($crate::io::stdio::print_args(format_args!($($arg)*)))
} }
@ -97,7 +97,7 @@ macro_rules! print {
/// println!("format {} arguments", "some"); /// println!("format {} arguments", "some");
/// ``` /// ```
#[macro_export] #[macro_export]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
macro_rules! println { macro_rules! println {
($($arg:tt)*) => ($crate::io::stdio::println_args(format_args!($($arg)*))) ($($arg:tt)*) => ($crate::io::stdio::println_args(format_args!($($arg)*)))
} }
@ -106,7 +106,7 @@ macro_rules! println {
/// error if the value of the expression is `Err`. For more information, see /// error if the value of the expression is `Err`. For more information, see
/// `std::io`. /// `std::io`.
#[macro_export] #[macro_export]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
macro_rules! try { macro_rules! try {
($expr:expr) => (match $expr { ($expr:expr) => (match $expr {
$crate::result::Result::Ok(val) => val, $crate::result::Result::Ok(val) => val,

View File

@ -10,7 +10,7 @@
//! Operations and constants for 32-bits floats (`f32` type) //! Operations and constants for 32-bits floats (`f32` type)
#![stable(feature = "grandfathered", since = "1.0.0")] #![stable(feature = "rust1", since = "1.0.0")]
#![allow(missing_docs)] #![allow(missing_docs)]
#![allow(unsigned_negation)] #![allow(unsigned_negation)]
#![doc(primitive = "f32")] #![doc(primitive = "f32")]
@ -73,7 +73,7 @@ mod cmath {
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl Float for f32 { impl Float for f32 {
#[inline] #[inline]
fn nan() -> f32 { num::Float::nan() } fn nan() -> f32 { num::Float::nan() }

View File

@ -10,7 +10,7 @@
//! Operations and constants for 64-bits floats (`f64` type) //! Operations and constants for 64-bits floats (`f64` type)
#![stable(feature = "grandfathered", since = "1.0.0")] #![stable(feature = "rust1", since = "1.0.0")]
#![allow(missing_docs)] #![allow(missing_docs)]
#![doc(primitive = "f64")] #![doc(primitive = "f64")]
@ -81,7 +81,7 @@ mod cmath {
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl Float for f64 { impl Float for f64 {
// inlined methods from `num::Float` // inlined methods from `num::Float`
#[inline] #[inline]

View File

@ -10,7 +10,7 @@
//! Operations and constants for signed 16-bits integers (`i16` type) //! Operations and constants for signed 16-bits integers (`i16` type)
#![stable(feature = "grandfathered", since = "1.0.0")] #![stable(feature = "rust1", since = "1.0.0")]
#![doc(primitive = "i16")] #![doc(primitive = "i16")]
pub use core::i16::{BITS, BYTES, MIN, MAX}; pub use core::i16::{BITS, BYTES, MIN, MAX};

View File

@ -10,7 +10,7 @@
//! Operations and constants for signed 32-bits integers (`i32` type) //! Operations and constants for signed 32-bits integers (`i32` type)
#![stable(feature = "grandfathered", since = "1.0.0")] #![stable(feature = "rust1", since = "1.0.0")]
#![doc(primitive = "i32")] #![doc(primitive = "i32")]
pub use core::i32::{BITS, BYTES, MIN, MAX}; pub use core::i32::{BITS, BYTES, MIN, MAX};

View File

@ -10,7 +10,7 @@
//! Operations and constants for signed 64-bits integers (`i64` type) //! Operations and constants for signed 64-bits integers (`i64` type)
#![stable(feature = "grandfathered", since = "1.0.0")] #![stable(feature = "rust1", since = "1.0.0")]
#![doc(primitive = "i64")] #![doc(primitive = "i64")]
pub use core::i64::{BITS, BYTES, MIN, MAX}; pub use core::i64::{BITS, BYTES, MIN, MAX};

View File

@ -10,7 +10,7 @@
//! Operations and constants for signed 8-bits integers (`i8` type) //! Operations and constants for signed 8-bits integers (`i8` type)
#![stable(feature = "grandfathered", since = "1.0.0")] #![stable(feature = "rust1", since = "1.0.0")]
#![doc(primitive = "i8")] #![doc(primitive = "i8")]
pub use core::i8::{BITS, BYTES, MIN, MAX}; pub use core::i8::{BITS, BYTES, MIN, MAX};

View File

@ -14,7 +14,7 @@
//! new type will gradually take place over the alpha cycle along with //! new type will gradually take place over the alpha cycle along with
//! the development of clearer conventions around integer types. //! the development of clearer conventions around integer types.
#![stable(feature = "grandfathered", since = "1.0.0")] #![stable(feature = "rust1", since = "1.0.0")]
#![doc(primitive = "isize")] #![doc(primitive = "isize")]
pub use core::isize::{BITS, BYTES, MIN, MAX}; pub use core::isize::{BITS, BYTES, MIN, MAX};

View File

@ -13,7 +13,7 @@
//! These are implemented for the primitive numeric types in `std::{u8, u16, //! These are implemented for the primitive numeric types in `std::{u8, u16,
//! u32, u64, uint, i8, i16, i32, i64, int, f32, f64}`. //! u32, u64, uint, i8, i16, i32, i64, int, f32, f64}`.
#![stable(feature = "grandfathered", since = "1.0.0")] #![stable(feature = "rust1", since = "1.0.0")]
#![allow(missing_docs)] #![allow(missing_docs)]
#[cfg(test)] use fmt::Show; #[cfg(test)] use fmt::Show;
@ -37,7 +37,7 @@ use option::Option;
pub mod strconv; pub mod strconv;
/// Mathematical operations on primitive floating point numbers. /// Mathematical operations on primitive floating point numbers.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub trait Float pub trait Float
: Copy + Clone : Copy + Clone
+ NumCast + NumCast
@ -142,7 +142,7 @@ pub trait Float
#[unstable(feature = "std_misc", reason = "position is undecided")] #[unstable(feature = "std_misc", reason = "position is undecided")]
fn is_normal(self) -> bool; fn is_normal(self) -> bool;
/// Returns the category that this number falls into. /// Returns the category that this number falls into.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn classify(self) -> FpCategory; fn classify(self) -> FpCategory;
/// Returns the mantissa, exponent and sign as integers, respectively. /// Returns the mantissa, exponent and sign as integers, respectively.
@ -150,40 +150,40 @@ pub trait Float
fn integer_decode(self) -> (u64, i16, i8); fn integer_decode(self) -> (u64, i16, i8);
/// Return the largest integer less than or equal to a number. /// Return the largest integer less than or equal to a number.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn floor(self) -> Self; fn floor(self) -> Self;
/// Return the smallest integer greater than or equal to a number. /// Return the smallest integer greater than or equal to a number.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn ceil(self) -> Self; fn ceil(self) -> Self;
/// Return the nearest integer to a number. Round half-way cases away from /// Return the nearest integer to a number. Round half-way cases away from
/// `0.0`. /// `0.0`.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn round(self) -> Self; fn round(self) -> Self;
/// Return the integer part of a number. /// Return the integer part of a number.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn trunc(self) -> Self; fn trunc(self) -> Self;
/// Return the fractional part of a number. /// Return the fractional part of a number.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn fract(self) -> Self; fn fract(self) -> Self;
/// Computes the absolute value of `self`. Returns `Float::nan()` if the /// Computes the absolute value of `self`. Returns `Float::nan()` if the
/// number is `Float::nan()`. /// number is `Float::nan()`.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn abs(self) -> Self; fn abs(self) -> Self;
/// Returns a number that represents the sign of `self`. /// Returns a number that represents the sign of `self`.
/// ///
/// - `1.0` if the number is positive, `+0.0` or `Float::infinity()` /// - `1.0` if the number is positive, `+0.0` or `Float::infinity()`
/// - `-1.0` if the number is negative, `-0.0` or `Float::neg_infinity()` /// - `-1.0` if the number is negative, `-0.0` or `Float::neg_infinity()`
/// - `Float::nan()` if the number is `Float::nan()` /// - `Float::nan()` if the number is `Float::nan()`
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn signum(self) -> Self; fn signum(self) -> Self;
/// Returns `true` if `self` is positive, including `+0.0` and /// Returns `true` if `self` is positive, including `+0.0` and
/// `Float::infinity()`. /// `Float::infinity()`.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn is_positive(self) -> bool; fn is_positive(self) -> bool;
/// Returns `true` if `self` is negative, including `-0.0` and /// Returns `true` if `self` is negative, including `-0.0` and
/// `Float::neg_infinity()`. /// `Float::neg_infinity()`.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn is_negative(self) -> bool; fn is_negative(self) -> bool;
/// Fused multiply-add. Computes `(self * a) + b` with only one rounding /// Fused multiply-add. Computes `(self * a) + b` with only one rounding
@ -200,16 +200,16 @@ pub trait Float
/// Raise a number to an integer power. /// Raise a number to an integer power.
/// ///
/// Using this function is generally faster than using `powf` /// Using this function is generally faster than using `powf`
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn powi(self, n: i32) -> Self; fn powi(self, n: i32) -> Self;
/// Raise a number to a floating point power. /// Raise a number to a floating point power.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn powf(self, n: Self) -> Self; fn powf(self, n: Self) -> Self;
/// Take the square root of a number. /// Take the square root of a number.
/// ///
/// Returns NaN if `self` is a negative number. /// Returns NaN if `self` is a negative number.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn sqrt(self) -> Self; fn sqrt(self) -> Self;
/// Take the reciprocal (inverse) square root of a number, `1/sqrt(x)`. /// Take the reciprocal (inverse) square root of a number, `1/sqrt(x)`.
#[unstable(feature = "std_misc", #[unstable(feature = "std_misc",
@ -217,22 +217,22 @@ pub trait Float
fn rsqrt(self) -> Self; fn rsqrt(self) -> Self;
/// Returns `e^(self)`, (the exponential function). /// Returns `e^(self)`, (the exponential function).
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn exp(self) -> Self; fn exp(self) -> Self;
/// Returns 2 raised to the power of the number, `2^(self)`. /// Returns 2 raised to the power of the number, `2^(self)`.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn exp2(self) -> Self; fn exp2(self) -> Self;
/// Returns the natural logarithm of the number. /// Returns the natural logarithm of the number.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn ln(self) -> Self; fn ln(self) -> Self;
/// Returns the logarithm of the number with respect to an arbitrary base. /// Returns the logarithm of the number with respect to an arbitrary base.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn log(self, base: Self) -> Self; fn log(self, base: Self) -> Self;
/// Returns the base 2 logarithm of the number. /// Returns the base 2 logarithm of the number.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn log2(self) -> Self; fn log2(self) -> Self;
/// Returns the base 10 logarithm of the number. /// Returns the base 10 logarithm of the number.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn log10(self) -> Self; fn log10(self) -> Self;
/// Convert radians to degrees. /// Convert radians to degrees.
@ -264,10 +264,10 @@ pub trait Float
fn next_after(self, other: Self) -> Self; fn next_after(self, other: Self) -> Self;
/// Returns the maximum of the two numbers. /// Returns the maximum of the two numbers.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn max(self, other: Self) -> Self; fn max(self, other: Self) -> Self;
/// Returns the minimum of the two numbers. /// Returns the minimum of the two numbers.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn min(self, other: Self) -> Self; fn min(self, other: Self) -> Self;
/// The positive difference of two numbers. Returns `0.0` if the number is /// The positive difference of two numbers. Returns `0.0` if the number is
@ -286,36 +286,36 @@ pub trait Float
fn hypot(self, other: Self) -> Self; fn hypot(self, other: Self) -> Self;
/// Computes the sine of a number (in radians). /// Computes the sine of a number (in radians).
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn sin(self) -> Self; fn sin(self) -> Self;
/// Computes the cosine of a number (in radians). /// Computes the cosine of a number (in radians).
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn cos(self) -> Self; fn cos(self) -> Self;
/// Computes the tangent of a number (in radians). /// Computes the tangent of a number (in radians).
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn tan(self) -> Self; fn tan(self) -> Self;
/// Computes the arcsine of a number. Return value is in radians in /// Computes the arcsine of a number. Return value is in radians in
/// the range [-pi/2, pi/2] or NaN if the number is outside the range /// the range [-pi/2, pi/2] or NaN if the number is outside the range
/// [-1, 1]. /// [-1, 1].
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn asin(self) -> Self; fn asin(self) -> Self;
/// Computes the arccosine of a number. Return value is in radians in /// Computes the arccosine of a number. Return value is in radians in
/// the range [0, pi] or NaN if the number is outside the range /// the range [0, pi] or NaN if the number is outside the range
/// [-1, 1]. /// [-1, 1].
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn acos(self) -> Self; fn acos(self) -> Self;
/// Computes the arctangent of a number. Return value is in radians in the /// Computes the arctangent of a number. Return value is in radians in the
/// range [-pi/2, pi/2]; /// range [-pi/2, pi/2];
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn atan(self) -> Self; fn atan(self) -> Self;
/// Computes the four quadrant arctangent of a number, `y`, and another /// Computes the four quadrant arctangent of a number, `y`, and another
/// number `x`. Return value is in radians in the range [-pi, pi]. /// number `x`. Return value is in radians in the range [-pi, pi].
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn atan2(self, other: Self) -> Self; fn atan2(self, other: Self) -> Self;
/// Simultaneously computes the sine and cosine of the number, `x`. Returns /// Simultaneously computes the sine and cosine of the number, `x`. Returns
/// `(sin(x), cos(x))`. /// `(sin(x), cos(x))`.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn sin_cos(self) -> (Self, Self); fn sin_cos(self) -> (Self, Self);
/// Returns the exponential of the number, minus 1, in a way that is /// Returns the exponential of the number, minus 1, in a way that is
@ -328,22 +328,22 @@ pub trait Float
fn ln_1p(self) -> Self; fn ln_1p(self) -> Self;
/// Hyperbolic sine function. /// Hyperbolic sine function.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn sinh(self) -> Self; fn sinh(self) -> Self;
/// Hyperbolic cosine function. /// Hyperbolic cosine function.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn cosh(self) -> Self; fn cosh(self) -> Self;
/// Hyperbolic tangent function. /// Hyperbolic tangent function.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn tanh(self) -> Self; fn tanh(self) -> Self;
/// Inverse hyperbolic sine function. /// Inverse hyperbolic sine function.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn asinh(self) -> Self; fn asinh(self) -> Self;
/// Inverse hyperbolic cosine function. /// Inverse hyperbolic cosine function.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn acosh(self) -> Self; fn acosh(self) -> Self;
/// Inverse hyperbolic tangent function. /// Inverse hyperbolic tangent function.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn atanh(self) -> Self; fn atanh(self) -> Self;
} }

View File

@ -10,7 +10,7 @@
//! Operations and constants for unsigned 16-bits integers (`u16` type) //! Operations and constants for unsigned 16-bits integers (`u16` type)
#![stable(feature = "grandfathered", since = "1.0.0")] #![stable(feature = "rust1", since = "1.0.0")]
#![doc(primitive = "u16")] #![doc(primitive = "u16")]
pub use core::u16::{BITS, BYTES, MIN, MAX}; pub use core::u16::{BITS, BYTES, MIN, MAX};

View File

@ -10,7 +10,7 @@
//! Operations and constants for unsigned 32-bits integers (`u32` type) //! Operations and constants for unsigned 32-bits integers (`u32` type)
#![stable(feature = "grandfathered", since = "1.0.0")] #![stable(feature = "rust1", since = "1.0.0")]
#![doc(primitive = "u32")] #![doc(primitive = "u32")]
pub use core::u32::{BITS, BYTES, MIN, MAX}; pub use core::u32::{BITS, BYTES, MIN, MAX};

View File

@ -10,7 +10,7 @@
//! Operations and constants for unsigned 64-bits integer (`u64` type) //! Operations and constants for unsigned 64-bits integer (`u64` type)
#![stable(feature = "grandfathered", since = "1.0.0")] #![stable(feature = "rust1", since = "1.0.0")]
#![doc(primitive = "u64")] #![doc(primitive = "u64")]
pub use core::u64::{BITS, BYTES, MIN, MAX}; pub use core::u64::{BITS, BYTES, MIN, MAX};

View File

@ -10,7 +10,7 @@
//! Operations and constants for unsigned 8-bits integers (`u8` type) //! Operations and constants for unsigned 8-bits integers (`u8` type)
#![stable(feature = "grandfathered", since = "1.0.0")] #![stable(feature = "rust1", since = "1.0.0")]
#![doc(primitive = "u8")] #![doc(primitive = "u8")]
pub use core::u8::{BITS, BYTES, MIN, MAX}; pub use core::u8::{BITS, BYTES, MIN, MAX};

View File

@ -14,7 +14,7 @@
//! new type will gradually take place over the alpha cycle along with //! new type will gradually take place over the alpha cycle along with
//! the development of clearer conventions around integer types. //! the development of clearer conventions around integer types.
#![stable(feature = "grandfathered", since = "1.0.0")] #![stable(feature = "rust1", since = "1.0.0")]
#![doc(primitive = "usize")] #![doc(primitive = "usize")]
pub use core::usize::{BITS, BYTES, MIN, MAX}; pub use core::usize::{BITS, BYTES, MIN, MAX};

View File

@ -35,6 +35,6 @@
//! pervasive that it would be obnoxious to import for every use, particularly //! pervasive that it would be obnoxious to import for every use, particularly
//! those that define methods on primitive types. //! those that define methods on primitive types.
#![stable(feature = "grandfathered", since = "1.0.0")] #![stable(feature = "rust1", since = "1.0.0")]
pub mod v1; pub mod v1;

View File

@ -10,12 +10,12 @@
//! The first version of the prelude of the standard library. //! The first version of the prelude of the standard library.
#![stable(feature = "grandfathered", since = "1.0.0")] #![stable(feature = "rust1", since = "1.0.0")]
// Reexported core operators // Reexported core operators
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[doc(no_inline)] pub use marker::{Copy, Send, Sized, Sync}; #[doc(no_inline)] pub use marker::{Copy, Send, Sized, Sync};
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[doc(no_inline)] pub use ops::{Drop, Fn, FnMut, FnOnce}; #[doc(no_inline)] pub use ops::{Drop, Fn, FnMut, FnOnce};
// TEMPORARY // TEMPORARY
@ -23,40 +23,40 @@
#[doc(no_inline)] pub use ops::FullRange; #[doc(no_inline)] pub use ops::FullRange;
// Reexported functions // Reexported functions
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[doc(no_inline)] pub use mem::drop; #[doc(no_inline)] pub use mem::drop;
// Reexported types and traits // Reexported types and traits
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[doc(no_inline)] pub use boxed::Box; #[doc(no_inline)] pub use boxed::Box;
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[doc(no_inline)] pub use char::CharExt; #[doc(no_inline)] pub use char::CharExt;
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[doc(no_inline)] pub use clone::Clone; #[doc(no_inline)] pub use clone::Clone;
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[doc(no_inline)] pub use cmp::{PartialEq, PartialOrd, Eq, Ord}; #[doc(no_inline)] pub use cmp::{PartialEq, PartialOrd, Eq, Ord};
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[doc(no_inline)] pub use iter::DoubleEndedIterator; #[doc(no_inline)] pub use iter::DoubleEndedIterator;
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[doc(no_inline)] pub use iter::ExactSizeIterator; #[doc(no_inline)] pub use iter::ExactSizeIterator;
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[doc(no_inline)] pub use iter::{Iterator, IteratorExt, Extend}; #[doc(no_inline)] pub use iter::{Iterator, IteratorExt, Extend};
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[doc(no_inline)] pub use option::Option::{self, Some, None}; #[doc(no_inline)] pub use option::Option::{self, Some, None};
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[doc(no_inline)] pub use ptr::{PtrExt, MutPtrExt}; #[doc(no_inline)] pub use ptr::{PtrExt, MutPtrExt};
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[doc(no_inline)] pub use result::Result::{self, Ok, Err}; #[doc(no_inline)] pub use result::Result::{self, Ok, Err};
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[doc(no_inline)] pub use slice::AsSlice; #[doc(no_inline)] pub use slice::AsSlice;
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[doc(no_inline)] pub use slice::{SliceExt, SliceConcatExt}; #[doc(no_inline)] pub use slice::{SliceExt, SliceConcatExt};
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[doc(no_inline)] pub use str::{Str, StrExt}; #[doc(no_inline)] pub use str::{Str, StrExt};
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[doc(no_inline)] pub use string::{String, ToString}; #[doc(no_inline)] pub use string::{String, ToString};
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[doc(no_inline)] pub use vec::Vec; #[doc(no_inline)] pub use vec::Vec;
// NB: remove when path reform lands // NB: remove when path reform lands

View File

@ -29,7 +29,7 @@ use sync::{Mutex, Condvar};
/// }); /// });
/// } /// }
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub struct Barrier { pub struct Barrier {
lock: Mutex<BarrierState>, lock: Mutex<BarrierState>,
cvar: Condvar, cvar: Condvar,
@ -54,7 +54,7 @@ impl Barrier {
/// ///
/// A barrier will block `n`-1 threads which call `wait` and then wake up /// A barrier will block `n`-1 threads which call `wait` and then wake up
/// all threads at once when the `n`th thread calls `wait`. /// all threads at once when the `n`th thread calls `wait`.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn new(n: uint) -> Barrier { pub fn new(n: uint) -> Barrier {
Barrier { Barrier {
lock: Mutex::new(BarrierState { lock: Mutex::new(BarrierState {
@ -75,7 +75,7 @@ impl Barrier {
/// returns `true` from `is_leader` when returning from this function, and /// returns `true` from `is_leader` when returning from this function, and
/// all other threads will receive a result that will return `false` from /// all other threads will receive a result that will return `false` from
/// `is_leader` /// `is_leader`
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn wait(&self) -> BarrierWaitResult { pub fn wait(&self) -> BarrierWaitResult {
let mut lock = self.lock.lock().unwrap(); let mut lock = self.lock.lock().unwrap();
let local_gen = lock.generation_id; let local_gen = lock.generation_id;
@ -102,7 +102,7 @@ impl BarrierWaitResult {
/// ///
/// Only one thread will have `true` returned from their result, all other /// Only one thread will have `true` returned from their result, all other
/// threads will have `false` returned. /// threads will have `false` returned.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn is_leader(&self) -> bool { self.0 } pub fn is_leader(&self) -> bool { self.0 }
} }

View File

@ -58,7 +58,7 @@ use sync::{mutex, MutexGuard};
/// started = cvar.wait(started).unwrap(); /// started = cvar.wait(started).unwrap();
/// } /// }
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub struct Condvar { inner: Box<StaticCondvar> } pub struct Condvar { inner: Box<StaticCondvar> }
unsafe impl Send for Condvar {} unsafe impl Send for Condvar {}
@ -97,7 +97,7 @@ pub const CONDVAR_INIT: StaticCondvar = StaticCondvar {
impl Condvar { impl Condvar {
/// Creates a new condition variable which is ready to be waited on and /// Creates a new condition variable which is ready to be waited on and
/// notified. /// notified.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn new() -> Condvar { pub fn new() -> Condvar {
Condvar { Condvar {
inner: box StaticCondvar { inner: box StaticCondvar {
@ -133,7 +133,7 @@ impl Condvar {
/// over time. Each condition variable is dynamically bound to exactly one /// over time. Each condition variable is dynamically bound to exactly one
/// mutex to ensure defined behavior across platforms. If this functionality /// mutex to ensure defined behavior across platforms. If this functionality
/// is not desired, then unsafe primitives in `sys` are provided. /// is not desired, then unsafe primitives in `sys` are provided.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn wait<'a, T>(&self, guard: MutexGuard<'a, T>) pub fn wait<'a, T>(&self, guard: MutexGuard<'a, T>)
-> LockResult<MutexGuard<'a, T>> { -> LockResult<MutexGuard<'a, T>> {
unsafe { unsafe {
@ -191,7 +191,7 @@ impl Condvar {
/// `notify_one` are not buffered in any way. /// `notify_one` are not buffered in any way.
/// ///
/// To wake up all threads, see `notify_all()`. /// To wake up all threads, see `notify_all()`.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn notify_one(&self) { unsafe { self.inner.inner.notify_one() } } pub fn notify_one(&self) { unsafe { self.inner.inner.notify_one() } }
/// Wake up all blocked threads on this condvar. /// Wake up all blocked threads on this condvar.
@ -201,11 +201,11 @@ impl Condvar {
/// way. /// way.
/// ///
/// To wake up only one thread, see `notify_one()`. /// To wake up only one thread, see `notify_one()`.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn notify_all(&self) { unsafe { self.inner.inner.notify_all() } } pub fn notify_all(&self) { unsafe { self.inner.inner.notify_all() } }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl Drop for Condvar { impl Drop for Condvar {
fn drop(&mut self) { fn drop(&mut self) {
unsafe { self.inner.inner.destroy() } unsafe { self.inner.inner.destroy() }

View File

@ -15,7 +15,7 @@
//! and/or blocking at all, but rather provide the necessary tools to build //! and/or blocking at all, but rather provide the necessary tools to build
//! other types of concurrent primitives. //! other types of concurrent primitives.
#![stable(feature = "grandfathered", since = "1.0.0")] #![stable(feature = "rust1", since = "1.0.0")]
pub use alloc::arc::{Arc, Weak}; pub use alloc::arc::{Arc, Weak};
pub use core::atomic; pub use core::atomic;

View File

@ -163,7 +163,7 @@
//! } //! }
//! ``` //! ```
#![stable(feature = "grandfathered", since = "1.0.0")] #![stable(feature = "rust1", since = "1.0.0")]
// A description of how Rust's channel implementation works // A description of how Rust's channel implementation works
// //
@ -339,7 +339,7 @@ mod spsc_queue;
/// The receiving-half of Rust's channel type. This half can only be owned by /// The receiving-half of Rust's channel type. This half can only be owned by
/// one task /// one task
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub struct Receiver<T> { pub struct Receiver<T> {
inner: UnsafeCell<Flavor<T>>, inner: UnsafeCell<Flavor<T>>,
} }
@ -351,14 +351,14 @@ unsafe impl<T:Send> Send for Receiver<T> { }
/// An iterator over messages on a receiver, this iterator will block /// An iterator over messages on a receiver, this iterator will block
/// whenever `next` is called, waiting for a new message, and `None` will be /// whenever `next` is called, waiting for a new message, and `None` will be
/// returned when the corresponding channel has hung up. /// returned when the corresponding channel has hung up.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub struct Iter<'a, T:'a> { pub struct Iter<'a, T:'a> {
rx: &'a Receiver<T> rx: &'a Receiver<T>
} }
/// The sending-half of Rust's asynchronous channel type. This half can only be /// The sending-half of Rust's asynchronous channel type. This half can only be
/// owned by one task, but it can be cloned to send to other tasks. /// owned by one task, but it can be cloned to send to other tasks.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub struct Sender<T> { pub struct Sender<T> {
inner: UnsafeCell<Flavor<T>>, inner: UnsafeCell<Flavor<T>>,
} }
@ -370,7 +370,7 @@ unsafe impl<T:Send> Send for Sender<T> { }
/// The sending-half of Rust's synchronous channel type. This half can only be /// The sending-half of Rust's synchronous channel type. This half can only be
/// owned by one task, but it can be cloned to send to other tasks. /// owned by one task, but it can be cloned to send to other tasks.
#[cfg(stage0)] // NOTE remove impl after next snapshot #[cfg(stage0)] // NOTE remove impl after next snapshot
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub struct SyncSender<T> { pub struct SyncSender<T> {
inner: Arc<RacyCell<sync::Packet<T>>>, inner: Arc<RacyCell<sync::Packet<T>>>,
// can't share in an arc // can't share in an arc
@ -379,7 +379,7 @@ pub struct SyncSender<T> {
/// The sending-half of Rust's synchronous channel type. This half can only be /// The sending-half of Rust's synchronous channel type. This half can only be
/// owned by one task, but it can be cloned to send to other tasks. /// owned by one task, but it can be cloned to send to other tasks.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[cfg(not(stage0))] // NOTE remove cfg after next snapshot #[cfg(not(stage0))] // NOTE remove cfg after next snapshot
pub struct SyncSender<T> { pub struct SyncSender<T> {
inner: Arc<RacyCell<sync::Packet<T>>>, inner: Arc<RacyCell<sync::Packet<T>>>,
@ -394,7 +394,7 @@ impl<T> !marker::Sync for SyncSender<T> {}
/// disconnected, implying that the data could never be received. The error /// disconnected, implying that the data could never be received. The error
/// contains the data being sent as a payload so it can be recovered. /// contains the data being sent as a payload so it can be recovered.
#[derive(PartialEq, Eq)] #[derive(PartialEq, Eq)]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub struct SendError<T>(pub T); pub struct SendError<T>(pub T);
/// An error returned from the `recv` function on a `Receiver`. /// An error returned from the `recv` function on a `Receiver`.
@ -402,29 +402,29 @@ pub struct SendError<T>(pub T);
/// The `recv` operation can only fail if the sending half of a channel is /// The `recv` operation can only fail if the sending half of a channel is
/// disconnected, implying that no further messages will ever be received. /// disconnected, implying that no further messages will ever be received.
#[derive(PartialEq, Eq, Clone, Copy)] #[derive(PartialEq, Eq, Clone, Copy)]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub struct RecvError; pub struct RecvError;
/// This enumeration is the list of the possible reasons that try_recv could not /// This enumeration is the list of the possible reasons that try_recv could not
/// return data when called. /// return data when called.
#[derive(PartialEq, Clone, Copy)] #[derive(PartialEq, Clone, Copy)]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub enum TryRecvError { pub enum TryRecvError {
/// This channel is currently empty, but the sender(s) have not yet /// This channel is currently empty, but the sender(s) have not yet
/// disconnected, so data may yet become available. /// disconnected, so data may yet become available.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
Empty, Empty,
/// This channel's sending half has become disconnected, and there will /// This channel's sending half has become disconnected, and there will
/// never be any more data received on this channel /// never be any more data received on this channel
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
Disconnected, Disconnected,
} }
/// This enumeration is the list of the possible error outcomes for the /// This enumeration is the list of the possible error outcomes for the
/// `SyncSender::try_send` method. /// `SyncSender::try_send` method.
#[derive(PartialEq, Clone)] #[derive(PartialEq, Clone)]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub enum TrySendError<T> { pub enum TrySendError<T> {
/// The data could not be sent on the channel because it would require that /// The data could not be sent on the channel because it would require that
/// the callee block to send the data. /// the callee block to send the data.
@ -432,12 +432,12 @@ pub enum TrySendError<T> {
/// If this is a buffered channel, then the buffer is full at this time. If /// If this is a buffered channel, then the buffer is full at this time. If
/// this is not a buffered channel, then there is no receiver available to /// this is not a buffered channel, then there is no receiver available to
/// acquire the data. /// acquire the data.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
Full(T), Full(T),
/// This channel's receiving half has disconnected, so the data could not be /// This channel's receiving half has disconnected, so the data could not be
/// sent. The data is returned back to the callee in this case. /// sent. The data is returned back to the callee in this case.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
Disconnected(T), Disconnected(T),
} }
@ -495,7 +495,7 @@ impl<T> UnsafeFlavor<T> for Receiver<T> {
/// // Let's see what that answer was /// // Let's see what that answer was
/// println!("{:?}", rx.recv().unwrap()); /// println!("{:?}", rx.recv().unwrap());
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn channel<T: Send>() -> (Sender<T>, Receiver<T>) { pub fn channel<T: Send>() -> (Sender<T>, Receiver<T>) {
let a = Arc::new(RacyCell::new(oneshot::Packet::new())); let a = Arc::new(RacyCell::new(oneshot::Packet::new()));
(Sender::new(Flavor::Oneshot(a.clone())), Receiver::new(Flavor::Oneshot(a))) (Sender::new(Flavor::Oneshot(a.clone())), Receiver::new(Flavor::Oneshot(a)))
@ -535,7 +535,7 @@ pub fn channel<T: Send>() -> (Sender<T>, Receiver<T>) {
/// assert_eq!(rx.recv().unwrap(), 1i); /// assert_eq!(rx.recv().unwrap(), 1i);
/// assert_eq!(rx.recv().unwrap(), 2i); /// assert_eq!(rx.recv().unwrap(), 2i);
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn sync_channel<T: Send>(bound: uint) -> (SyncSender<T>, Receiver<T>) { pub fn sync_channel<T: Send>(bound: uint) -> (SyncSender<T>, Receiver<T>) {
let a = Arc::new(RacyCell::new(sync::Packet::new(bound))); let a = Arc::new(RacyCell::new(sync::Packet::new(bound)));
(SyncSender::new(a.clone()), Receiver::new(Flavor::Sync(a))) (SyncSender::new(a.clone()), Receiver::new(Flavor::Sync(a)))
@ -579,7 +579,7 @@ impl<T: Send> Sender<T> {
/// drop(rx); /// drop(rx);
/// assert_eq!(tx.send(1i).err().unwrap().0, 1); /// assert_eq!(tx.send(1i).err().unwrap().0, 1);
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn send(&self, t: T) -> Result<(), SendError<T>> { pub fn send(&self, t: T) -> Result<(), SendError<T>> {
let (new_inner, ret) = match *unsafe { self.inner() } { let (new_inner, ret) = match *unsafe { self.inner() } {
Flavor::Oneshot(ref p) => { Flavor::Oneshot(ref p) => {
@ -626,7 +626,7 @@ impl<T: Send> Sender<T> {
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<T: Send> Clone for Sender<T> { impl<T: Send> Clone for Sender<T> {
fn clone(&self) -> Sender<T> { fn clone(&self) -> Sender<T> {
let (packet, sleeper, guard) = match *unsafe { self.inner() } { let (packet, sleeper, guard) = match *unsafe { self.inner() } {
@ -672,7 +672,7 @@ impl<T: Send> Clone for Sender<T> {
} }
#[unsafe_destructor] #[unsafe_destructor]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<T: Send> Drop for Sender<T> { impl<T: Send> Drop for Sender<T> {
fn drop(&mut self) { fn drop(&mut self) {
match *unsafe { self.inner_mut() } { match *unsafe { self.inner_mut() } {
@ -713,7 +713,7 @@ impl<T: Send> SyncSender<T> {
/// This function will never panic, but it may return `Err` if the /// This function will never panic, but it may return `Err` if the
/// `Receiver` has disconnected and is no longer able to receive /// `Receiver` has disconnected and is no longer able to receive
/// information. /// information.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn send(&self, t: T) -> Result<(), SendError<T>> { pub fn send(&self, t: T) -> Result<(), SendError<T>> {
unsafe { (*self.inner.get()).send(t).map_err(SendError) } unsafe { (*self.inner.get()).send(t).map_err(SendError) }
} }
@ -727,13 +727,13 @@ impl<T: Send> SyncSender<T> {
/// ///
/// See `SyncSender::send` for notes about guarantees of whether the /// See `SyncSender::send` for notes about guarantees of whether the
/// receiver has received the data or not if this function is successful. /// receiver has received the data or not if this function is successful.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn try_send(&self, t: T) -> Result<(), TrySendError<T>> { pub fn try_send(&self, t: T) -> Result<(), TrySendError<T>> {
unsafe { (*self.inner.get()).try_send(t) } unsafe { (*self.inner.get()).try_send(t) }
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<T: Send> Clone for SyncSender<T> { impl<T: Send> Clone for SyncSender<T> {
fn clone(&self) -> SyncSender<T> { fn clone(&self) -> SyncSender<T> {
unsafe { (*self.inner.get()).clone_chan(); } unsafe { (*self.inner.get()).clone_chan(); }
@ -742,7 +742,7 @@ impl<T: Send> Clone for SyncSender<T> {
} }
#[unsafe_destructor] #[unsafe_destructor]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<T: Send> Drop for SyncSender<T> { impl<T: Send> Drop for SyncSender<T> {
fn drop(&mut self) { fn drop(&mut self) {
unsafe { (*self.inner.get()).drop_chan(); } unsafe { (*self.inner.get()).drop_chan(); }
@ -766,7 +766,7 @@ impl<T: Send> Receiver<T> {
/// ///
/// This is useful for a flavor of "optimistic check" before deciding to /// This is useful for a flavor of "optimistic check" before deciding to
/// block on a receiver. /// block on a receiver.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn try_recv(&self) -> Result<T, TryRecvError> { pub fn try_recv(&self) -> Result<T, TryRecvError> {
loop { loop {
let new_port = match *unsafe { self.inner() } { let new_port = match *unsafe { self.inner() } {
@ -827,7 +827,7 @@ impl<T: Send> Receiver<T> {
/// If the corresponding `Sender` has disconnected, or it disconnects while /// If the corresponding `Sender` has disconnected, or it disconnects while
/// this call is blocking, this call will wake up and return `Err` to /// this call is blocking, this call will wake up and return `Err` to
/// indicate that no more messages can ever be received on this channel. /// indicate that no more messages can ever be received on this channel.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn recv(&self) -> Result<T, RecvError> { pub fn recv(&self) -> Result<T, RecvError> {
loop { loop {
let new_port = match *unsafe { self.inner() } { let new_port = match *unsafe { self.inner() } {
@ -866,7 +866,7 @@ impl<T: Send> Receiver<T> {
/// Returns an iterator that will block waiting for messages, but never /// Returns an iterator that will block waiting for messages, but never
/// `panic!`. It will return `None` when the channel has hung up. /// `panic!`. It will return `None` when the channel has hung up.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn iter(&self) -> Iter<T> { pub fn iter(&self) -> Iter<T> {
Iter { rx: self } Iter { rx: self }
} }
@ -958,7 +958,7 @@ impl<T: Send> select::Packet for Receiver<T> {
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a, T: Send> Iterator for Iter<'a, T> { impl<'a, T: Send> Iterator for Iter<'a, T> {
type Item = T; type Item = T;
@ -966,7 +966,7 @@ impl<'a, T: Send> Iterator for Iter<'a, T> {
} }
#[unsafe_destructor] #[unsafe_destructor]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<T: Send> Drop for Receiver<T> { impl<T: Send> Drop for Receiver<T> {
fn drop(&mut self) { fn drop(&mut self) {
match *unsafe { self.inner_mut() } { match *unsafe { self.inner_mut() } {

View File

@ -138,7 +138,7 @@ impl<T: Send> Queue<T> {
} }
#[unsafe_destructor] #[unsafe_destructor]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<T: Send> Drop for Queue<T> { impl<T: Send> Drop for Queue<T> {
fn drop(&mut self) { fn drop(&mut self) {
unsafe { unsafe {

View File

@ -109,7 +109,7 @@ use sys_common::mutex as sys;
/// ///
/// *guard += 1; /// *guard += 1;
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub struct Mutex<T> { pub struct Mutex<T> {
// Note that this static mutex is in a *box*, not inlined into the struct // Note that this static mutex is in a *box*, not inlined into the struct
// itself. Once a native mutex has been used once, its address can never // itself. Once a native mutex has been used once, its address can never
@ -161,7 +161,7 @@ unsafe impl Sync for StaticMutex {}
/// Deref and DerefMut implementations /// Deref and DerefMut implementations
#[must_use] #[must_use]
#[cfg(stage0)] // NOTE remove impl after next snapshot #[cfg(stage0)] // NOTE remove impl after next snapshot
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub struct MutexGuard<'a, T: 'a> { pub struct MutexGuard<'a, T: 'a> {
// funny underscores due to how Deref/DerefMut currently work (they // funny underscores due to how Deref/DerefMut currently work (they
// disregard field privacy). // disregard field privacy).
@ -177,7 +177,7 @@ pub struct MutexGuard<'a, T: 'a> {
/// The data protected by the mutex can be access through this guard via its /// The data protected by the mutex can be access through this guard via its
/// Deref and DerefMut implementations /// Deref and DerefMut implementations
#[must_use] #[must_use]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[cfg(not(stage0))] // NOTE remove cfg after next snapshot #[cfg(not(stage0))] // NOTE remove cfg after next snapshot
pub struct MutexGuard<'a, T: 'a> { pub struct MutexGuard<'a, T: 'a> {
// funny underscores due to how Deref/DerefMut currently work (they // funny underscores due to how Deref/DerefMut currently work (they
@ -201,7 +201,7 @@ pub const MUTEX_INIT: StaticMutex = StaticMutex {
impl<T: Send> Mutex<T> { impl<T: Send> Mutex<T> {
/// Creates a new mutex in an unlocked state ready for use. /// Creates a new mutex in an unlocked state ready for use.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn new(t: T) -> Mutex<T> { pub fn new(t: T) -> Mutex<T> {
Mutex { Mutex {
inner: box MUTEX_INIT, inner: box MUTEX_INIT,
@ -220,7 +220,7 @@ impl<T: Send> Mutex<T> {
/// ///
/// If another user of this mutex panicked while holding the mutex, then /// If another user of this mutex panicked while holding the mutex, then
/// this call will return an error once the mutex is acquired. /// this call will return an error once the mutex is acquired.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn lock(&self) -> LockResult<MutexGuard<T>> { pub fn lock(&self) -> LockResult<MutexGuard<T>> {
unsafe { self.inner.lock.lock() } unsafe { self.inner.lock.lock() }
MutexGuard::new(&*self.inner, &self.data) MutexGuard::new(&*self.inner, &self.data)
@ -239,7 +239,7 @@ impl<T: Send> Mutex<T> {
/// If another user of this mutex panicked while holding the mutex, then /// If another user of this mutex panicked while holding the mutex, then
/// this call will return failure if the mutex would otherwise be /// this call will return failure if the mutex would otherwise be
/// acquired. /// acquired.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn try_lock(&self) -> TryLockResult<MutexGuard<T>> { pub fn try_lock(&self) -> TryLockResult<MutexGuard<T>> {
if unsafe { self.inner.lock.try_lock() } { if unsafe { self.inner.lock.try_lock() } {
Ok(try!(MutexGuard::new(&*self.inner, &self.data))) Ok(try!(MutexGuard::new(&*self.inner, &self.data)))
@ -250,7 +250,7 @@ impl<T: Send> Mutex<T> {
} }
#[unsafe_destructor] #[unsafe_destructor]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<T: Send> Drop for Mutex<T> { impl<T: Send> Drop for Mutex<T> {
fn drop(&mut self) { fn drop(&mut self) {
// This is actually safe b/c we know that there is no further usage of // This is actually safe b/c we know that there is no further usage of
@ -330,7 +330,7 @@ impl<'mutex, T> MutexGuard<'mutex, T> {
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'mutex, T> Deref for MutexGuard<'mutex, T> { impl<'mutex, T> Deref for MutexGuard<'mutex, T> {
type Target = T; type Target = T;
@ -338,7 +338,7 @@ impl<'mutex, T> Deref for MutexGuard<'mutex, T> {
unsafe { &*self.__data.get() } unsafe { &*self.__data.get() }
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'mutex, T> DerefMut for MutexGuard<'mutex, T> { impl<'mutex, T> DerefMut for MutexGuard<'mutex, T> {
fn deref_mut<'a>(&'a mut self) -> &'a mut T { fn deref_mut<'a>(&'a mut self) -> &'a mut T {
unsafe { &mut *self.__data.get() } unsafe { &mut *self.__data.get() }
@ -346,7 +346,7 @@ impl<'mutex, T> DerefMut for MutexGuard<'mutex, T> {
} }
#[unsafe_destructor] #[unsafe_destructor]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a, T> Drop for MutexGuard<'a, T> { impl<'a, T> Drop for MutexGuard<'a, T> {
#[inline] #[inline]
fn drop(&mut self) { fn drop(&mut self) {

View File

@ -36,7 +36,7 @@ use sync::{StaticMutex, MUTEX_INIT};
/// // run initialization here /// // run initialization here
/// }); /// });
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub struct Once { pub struct Once {
mutex: StaticMutex, mutex: StaticMutex,
cnt: AtomicIsize, cnt: AtomicIsize,
@ -46,7 +46,7 @@ pub struct Once {
unsafe impl Sync for Once {} unsafe impl Sync for Once {}
/// Initialization value for static `Once` values. /// Initialization value for static `Once` values.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub const ONCE_INIT: Once = Once { pub const ONCE_INIT: Once = Once {
mutex: MUTEX_INIT, mutex: MUTEX_INIT,
cnt: ATOMIC_ISIZE_INIT, cnt: ATOMIC_ISIZE_INIT,
@ -63,7 +63,7 @@ impl Once {
/// ///
/// When this function returns, it is guaranteed that some initialization /// When this function returns, it is guaranteed that some initialization
/// has run and completed (it may not be the closure specified). /// has run and completed (it may not be the closure specified).
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn call_once<F>(&'static self, f: F) where F: FnOnce() { pub fn call_once<F>(&'static self, f: F) where F: FnOnce() {
// Optimize common path: load is much cheaper than fetch_add. // Optimize common path: load is much cheaper than fetch_add.
if self.cnt.load(Ordering::SeqCst) < 0 { if self.cnt.load(Ordering::SeqCst) < 0 {

View File

@ -53,22 +53,22 @@ pub struct Guard {
/// is held. The precise semantics for when a lock is poisoned is documented on /// is held. The precise semantics for when a lock is poisoned is documented on
/// each lock, but once a lock is poisoned then all future acquisitions will /// each lock, but once a lock is poisoned then all future acquisitions will
/// return this error. /// return this error.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub struct PoisonError<T> { pub struct PoisonError<T> {
guard: T, guard: T,
} }
/// An enumeration of possible errors which can occur while calling the /// An enumeration of possible errors which can occur while calling the
/// `try_lock` method. /// `try_lock` method.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub enum TryLockError<T> { pub enum TryLockError<T> {
/// The lock could not be acquired because another task failed while holding /// The lock could not be acquired because another task failed while holding
/// the lock. /// the lock.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
Poisoned(PoisonError<T>), Poisoned(PoisonError<T>),
/// The lock could not be acquired at this time because the operation would /// The lock could not be acquired at this time because the operation would
/// otherwise block. /// otherwise block.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
WouldBlock, WouldBlock,
} }
@ -79,7 +79,7 @@ pub enum TryLockError<T> {
/// that the primitive was poisoned. Note that the `Err` variant *also* carries /// that the primitive was poisoned. Note that the `Err` variant *also* carries
/// the associated guard, and it can be acquired through the `into_inner` /// the associated guard, and it can be acquired through the `into_inner`
/// method. /// method.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub type LockResult<Guard> = Result<Guard, PoisonError<Guard>>; pub type LockResult<Guard> = Result<Guard, PoisonError<Guard>>;
/// A type alias for the result of a nonblocking locking method. /// A type alias for the result of a nonblocking locking method.
@ -87,7 +87,7 @@ pub type LockResult<Guard> = Result<Guard, PoisonError<Guard>>;
/// For more information, see `LockResult`. A `TryLockResult` doesn't /// For more information, see `LockResult`. A `TryLockResult` doesn't
/// necessarily hold the associated guard in the `Err` type as the lock may not /// necessarily hold the associated guard in the `Err` type as the lock may not
/// have been acquired for other reasons. /// have been acquired for other reasons.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub type TryLockResult<Guard> = Result<Guard, TryLockError<Guard>>; pub type TryLockResult<Guard> = Result<Guard, TryLockError<Guard>>;
impl<T> fmt::Show for PoisonError<T> { impl<T> fmt::Show for PoisonError<T> {

View File

@ -58,7 +58,7 @@ use sys_common::rwlock as sys;
/// assert_eq!(*w, 6); /// assert_eq!(*w, 6);
/// } // write lock is dropped here /// } // write lock is dropped here
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub struct RwLock<T> { pub struct RwLock<T> {
inner: Box<StaticRwLock>, inner: Box<StaticRwLock>,
data: UnsafeCell<T>, data: UnsafeCell<T>,
@ -111,7 +111,7 @@ pub const RW_LOCK_INIT: StaticRwLock = StaticRwLock {
/// RAII structure used to release the shared read access of a lock when /// RAII structure used to release the shared read access of a lock when
/// dropped. /// dropped.
#[must_use] #[must_use]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[cfg(stage0)] // NOTE remove impl after next snapshot #[cfg(stage0)] // NOTE remove impl after next snapshot
pub struct RwLockReadGuard<'a, T: 'a> { pub struct RwLockReadGuard<'a, T: 'a> {
__lock: &'a StaticRwLock, __lock: &'a StaticRwLock,
@ -123,7 +123,7 @@ pub struct RwLockReadGuard<'a, T: 'a> {
/// dropped. /// dropped.
#[must_use] #[must_use]
#[cfg(not(stage0))] // NOTE remove cfg after next snapshot #[cfg(not(stage0))] // NOTE remove cfg after next snapshot
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub struct RwLockReadGuard<'a, T: 'a> { pub struct RwLockReadGuard<'a, T: 'a> {
__lock: &'a StaticRwLock, __lock: &'a StaticRwLock,
__data: &'a UnsafeCell<T>, __data: &'a UnsafeCell<T>,
@ -136,7 +136,7 @@ impl<'a, T> !marker::Send for RwLockReadGuard<'a, T> {}
/// dropped. /// dropped.
#[must_use] #[must_use]
#[cfg(stage0)] // NOTE remove impl after next snapshot #[cfg(stage0)] // NOTE remove impl after next snapshot
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub struct RwLockWriteGuard<'a, T: 'a> { pub struct RwLockWriteGuard<'a, T: 'a> {
__lock: &'a StaticRwLock, __lock: &'a StaticRwLock,
__data: &'a UnsafeCell<T>, __data: &'a UnsafeCell<T>,
@ -147,7 +147,7 @@ pub struct RwLockWriteGuard<'a, T: 'a> {
/// RAII structure used to release the exclusive write access of a lock when /// RAII structure used to release the exclusive write access of a lock when
/// dropped. /// dropped.
#[must_use] #[must_use]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[cfg(not(stage0))] // NOTE remove cfg after next snapshot #[cfg(not(stage0))] // NOTE remove cfg after next snapshot
pub struct RwLockWriteGuard<'a, T: 'a> { pub struct RwLockWriteGuard<'a, T: 'a> {
__lock: &'a StaticRwLock, __lock: &'a StaticRwLock,
@ -160,7 +160,7 @@ impl<'a, T> !marker::Send for RwLockWriteGuard<'a, T> {}
impl<T: Send + Sync> RwLock<T> { impl<T: Send + Sync> RwLock<T> {
/// Creates a new instance of an RwLock which is unlocked and read to go. /// Creates a new instance of an RwLock which is unlocked and read to go.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn new(t: T) -> RwLock<T> { pub fn new(t: T) -> RwLock<T> {
RwLock { inner: box RW_LOCK_INIT, data: UnsafeCell::new(t) } RwLock { inner: box RW_LOCK_INIT, data: UnsafeCell::new(t) }
} }
@ -183,7 +183,7 @@ impl<T: Send + Sync> RwLock<T> {
/// is poisoned whenever a writer panics while holding an exclusive lock. /// is poisoned whenever a writer panics while holding an exclusive lock.
/// The failure will occur immediately after the lock has been acquired. /// The failure will occur immediately after the lock has been acquired.
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn read(&self) -> LockResult<RwLockReadGuard<T>> { pub fn read(&self) -> LockResult<RwLockReadGuard<T>> {
unsafe { self.inner.lock.read() } unsafe { self.inner.lock.read() }
RwLockReadGuard::new(&*self.inner, &self.data) RwLockReadGuard::new(&*self.inner, &self.data)
@ -205,7 +205,7 @@ impl<T: Send + Sync> RwLock<T> {
/// error will only be returned if the lock would have otherwise been /// error will only be returned if the lock would have otherwise been
/// acquired. /// acquired.
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn try_read(&self) -> TryLockResult<RwLockReadGuard<T>> { pub fn try_read(&self) -> TryLockResult<RwLockReadGuard<T>> {
if unsafe { self.inner.lock.try_read() } { if unsafe { self.inner.lock.try_read() } {
Ok(try!(RwLockReadGuard::new(&*self.inner, &self.data))) Ok(try!(RwLockReadGuard::new(&*self.inner, &self.data)))
@ -229,7 +229,7 @@ impl<T: Send + Sync> RwLock<T> {
/// is poisoned whenever a writer panics while holding an exclusive lock. /// is poisoned whenever a writer panics while holding an exclusive lock.
/// An error will be returned when the lock is acquired. /// An error will be returned when the lock is acquired.
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn write(&self) -> LockResult<RwLockWriteGuard<T>> { pub fn write(&self) -> LockResult<RwLockWriteGuard<T>> {
unsafe { self.inner.lock.write() } unsafe { self.inner.lock.write() }
RwLockWriteGuard::new(&*self.inner, &self.data) RwLockWriteGuard::new(&*self.inner, &self.data)
@ -248,7 +248,7 @@ impl<T: Send + Sync> RwLock<T> {
/// error will only be returned if the lock would have otherwise been /// error will only be returned if the lock would have otherwise been
/// acquired. /// acquired.
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn try_write(&self) -> TryLockResult<RwLockWriteGuard<T>> { pub fn try_write(&self) -> TryLockResult<RwLockWriteGuard<T>> {
if unsafe { self.inner.lock.try_read() } { if unsafe { self.inner.lock.try_read() } {
Ok(try!(RwLockWriteGuard::new(&*self.inner, &self.data))) Ok(try!(RwLockWriteGuard::new(&*self.inner, &self.data)))
@ -259,7 +259,7 @@ impl<T: Send + Sync> RwLock<T> {
} }
#[unsafe_destructor] #[unsafe_destructor]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<T> Drop for RwLock<T> { impl<T> Drop for RwLock<T> {
fn drop(&mut self) { fn drop(&mut self) {
unsafe { self.inner.lock.destroy() } unsafe { self.inner.lock.destroy() }
@ -389,19 +389,19 @@ impl<'rwlock, T> RwLockWriteGuard<'rwlock, T> {
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'rwlock, T> Deref for RwLockReadGuard<'rwlock, T> { impl<'rwlock, T> Deref for RwLockReadGuard<'rwlock, T> {
type Target = T; type Target = T;
fn deref(&self) -> &T { unsafe { &*self.__data.get() } } fn deref(&self) -> &T { unsafe { &*self.__data.get() } }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'rwlock, T> Deref for RwLockWriteGuard<'rwlock, T> { impl<'rwlock, T> Deref for RwLockWriteGuard<'rwlock, T> {
type Target = T; type Target = T;
fn deref(&self) -> &T { unsafe { &*self.__data.get() } } fn deref(&self) -> &T { unsafe { &*self.__data.get() } }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'rwlock, T> DerefMut for RwLockWriteGuard<'rwlock, T> { impl<'rwlock, T> DerefMut for RwLockWriteGuard<'rwlock, T> {
fn deref_mut(&mut self) -> &mut T { fn deref_mut(&mut self) -> &mut T {
unsafe { &mut *self.__data.get() } unsafe { &mut *self.__data.get() }
@ -409,7 +409,7 @@ impl<'rwlock, T> DerefMut for RwLockWriteGuard<'rwlock, T> {
} }
#[unsafe_destructor] #[unsafe_destructor]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a, T> Drop for RwLockReadGuard<'a, T> { impl<'a, T> Drop for RwLockReadGuard<'a, T> {
fn drop(&mut self) { fn drop(&mut self) {
unsafe { self.__lock.lock.read_unlock(); } unsafe { self.__lock.lock.read_unlock(); }
@ -417,7 +417,7 @@ impl<'a, T> Drop for RwLockReadGuard<'a, T> {
} }
#[unsafe_destructor] #[unsafe_destructor]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a, T> Drop for RwLockWriteGuard<'a, T> { impl<'a, T> Drop for RwLockWriteGuard<'a, T> {
fn drop(&mut self) { fn drop(&mut self) {
self.__lock.poison.done(&self.__poison); self.__lock.poison.done(&self.__poison);

View File

@ -100,7 +100,7 @@ impl Semaphore {
} }
#[unsafe_destructor] #[unsafe_destructor]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a> Drop for SemaphoreGuard<'a> { impl<'a> Drop for SemaphoreGuard<'a> {
fn drop(&mut self) { fn drop(&mut self) {
self.sem.release(); self.sem.release();

View File

@ -144,7 +144,7 @@
//! //!
//! * It can be implemented highly efficiently on many platforms. //! * It can be implemented highly efficiently on many platforms.
#![stable(feature = "grandfathered", since = "1.0.0")] #![stable(feature = "rust1", since = "1.0.0")]
use any::Any; use any::Any;
use boxed::Box; use boxed::Box;
@ -166,7 +166,7 @@ use sys_common::{stack, thread_info};
/// Thread configuration. Provides detailed control over the properties /// Thread configuration. Provides detailed control over the properties
/// and behavior of new threads. /// and behavior of new threads.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub struct Builder { pub struct Builder {
// A name for the thread-to-be, for identification in panic messages // A name for the thread-to-be, for identification in panic messages
name: Option<String>, name: Option<String>,
@ -181,7 +181,7 @@ pub struct Builder {
impl Builder { impl Builder {
/// Generate the base configuration for spawning a thread, from which /// Generate the base configuration for spawning a thread, from which
/// configuration methods can be chained. /// configuration methods can be chained.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn new() -> Builder { pub fn new() -> Builder {
Builder { Builder {
name: None, name: None,
@ -193,14 +193,14 @@ impl Builder {
/// Name the thread-to-be. Currently the name is used for identification /// Name the thread-to-be. Currently the name is used for identification
/// only in panic messages. /// only in panic messages.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn name(mut self, name: String) -> Builder { pub fn name(mut self, name: String) -> Builder {
self.name = Some(name); self.name = Some(name);
self self
} }
/// Set the size of the stack for the new thread. /// Set the size of the stack for the new thread.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn stack_size(mut self, size: uint) -> Builder { pub fn stack_size(mut self, size: uint) -> Builder {
self.stack_size = Some(size); self.stack_size = Some(size);
self self
@ -330,7 +330,7 @@ struct Inner {
unsafe impl Sync for Inner {} unsafe impl Sync for Inner {}
#[derive(Clone)] #[derive(Clone)]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
/// A handle to a thread. /// A handle to a thread.
pub struct Thread { pub struct Thread {
inner: Arc<Inner>, inner: Arc<Inner>,
@ -377,7 +377,7 @@ impl Thread {
} }
/// Gets a handle to the thread that invokes it. /// Gets a handle to the thread that invokes it.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn current() -> Thread { pub fn current() -> Thread {
thread_info::current_thread() thread_info::current_thread()
} }
@ -390,7 +390,7 @@ impl Thread {
/// Determines whether the current thread is panicking. /// Determines whether the current thread is panicking.
#[inline] #[inline]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn panicking() -> bool { pub fn panicking() -> bool {
unwind::panicking() unwind::panicking()
} }
@ -427,7 +427,7 @@ impl Thread {
} }
/// Get the thread's name. /// Get the thread's name.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn name(&self) -> Option<&str> { pub fn name(&self) -> Option<&str> {
self.inner.name.as_ref().map(|s| s.as_slice()) self.inner.name.as_ref().map(|s| s.as_slice())
} }
@ -441,7 +441,7 @@ impl thread_info::NewThread for Thread {
/// Indicates the manner in which a thread exited. /// Indicates the manner in which a thread exited.
/// ///
/// A thread that completes without panicking is considered to exit successfully. /// A thread that completes without panicking is considered to exit successfully.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub type Result<T> = ::result::Result<T, Box<Any + Send>>; pub type Result<T> = ::result::Result<T, Box<Any + Send>>;
struct Packet<T>(Arc<UnsafeCell<Option<Result<T>>>>); struct Packet<T>(Arc<UnsafeCell<Option<Result<T>>>>);
@ -462,12 +462,12 @@ pub struct JoinGuard<'a, T: 'a> {
packet: Packet<T>, packet: Packet<T>,
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
unsafe impl<'a, T: Send + 'a> Sync for JoinGuard<'a, T> {} unsafe impl<'a, T: Send + 'a> Sync for JoinGuard<'a, T> {}
impl<'a, T: Send + 'a> JoinGuard<'a, T> { impl<'a, T: Send + 'a> JoinGuard<'a, T> {
/// Extract a handle to the thread this guard will join on. /// Extract a handle to the thread this guard will join on.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn thread(&self) -> &Thread { pub fn thread(&self) -> &Thread {
&self.thread &self.thread
} }
@ -477,7 +477,7 @@ impl<'a, T: Send + 'a> JoinGuard<'a, T> {
/// ///
/// If the child thread panics, `Err` is returned with the parameter given /// If the child thread panics, `Err` is returned with the parameter given
/// to `panic`. /// to `panic`.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn join(mut self) -> Result<T> { pub fn join(mut self) -> Result<T> {
assert!(!self.joined); assert!(!self.joined);
unsafe { imp::join(self.native) }; unsafe { imp::join(self.native) };
@ -499,7 +499,7 @@ impl<T: Send> JoinGuard<'static, T> {
} }
#[unsafe_destructor] #[unsafe_destructor]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a, T: Send + 'a> Drop for JoinGuard<'a, T> { impl<'a, T: Send + 'a> Drop for JoinGuard<'a, T> {
fn drop(&mut self) { fn drop(&mut self) {
if !self.joined { if !self.joined {

View File

@ -34,7 +34,7 @@
//! will want to make use of some form of **interior mutability** through the //! will want to make use of some form of **interior mutability** through the
//! `Cell` or `RefCell` types. //! `Cell` or `RefCell` types.
#![stable(feature = "grandfathered", since = "1.0.0")] #![stable(feature = "rust1", since = "1.0.0")]
use prelude::v1::*; use prelude::v1::*;
@ -93,7 +93,7 @@ pub mod __impl {
/// assert_eq!(*f.borrow(), 2); /// assert_eq!(*f.borrow(), 2);
/// }); /// });
/// ``` /// ```
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub struct Key<T> { pub struct Key<T> {
// The key itself may be tagged with #[thread_local], and this `Key` is // The key itself may be tagged with #[thread_local], and this `Key` is
// stored as a `static`, and it's not valid for a static to reference the // stored as a `static`, and it's not valid for a static to reference the
@ -113,7 +113,7 @@ pub struct Key<T> {
/// Declare a new thread local storage key of type `std::thread_local::Key`. /// Declare a new thread local storage key of type `std::thread_local::Key`.
#[macro_export] #[macro_export]
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
macro_rules! thread_local { macro_rules! thread_local {
(static $name:ident: $t:ty = $init:expr) => ( (static $name:ident: $t:ty = $init:expr) => (
static $name: ::std::thread_local::Key<$t> = { static $name: ::std::thread_local::Key<$t> = {
@ -259,7 +259,7 @@ impl<T: 'static> Key<T> {
/// This function will `panic!()` if the key currently has its /// This function will `panic!()` if the key currently has its
/// destructor running, and it **may** panic if the destructor has /// destructor running, and it **may** panic if the destructor has
/// previously been run for this thread. /// previously been run for this thread.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn with<F, R>(&'static self, f: F) -> R pub fn with<F, R>(&'static self, f: F) -> R
where F: FnOnce(&T) -> R { where F: FnOnce(&T) -> R {
let slot = (self.inner)(); let slot = (self.inner)();

View File

@ -57,4 +57,4 @@
//! ``` //! ```
#![doc(primitive = "tuple")] #![doc(primitive = "tuple")]
#![stable(feature = "grandfathered", since = "1.0.0")] #![stable(feature = "rust1", since = "1.0.0")]

View File

@ -9,7 +9,7 @@
// except according to those terms. // except according to those terms.
#![doc(primitive = "unit")] #![doc(primitive = "unit")]
#![stable(feature = "grandfathered", since = "1.0.0")] #![stable(feature = "rust1", since = "1.0.0")]
//! The `()` type, sometimes called "unit" or "nil". //! The `()` type, sometimes called "unit" or "nil".
//! //!

View File

@ -60,7 +60,7 @@ mod u_str;
/// (inclusive) are allowed. A `char` can always be safely cast to a `u32`; /// (inclusive) are allowed. A `char` can always be safely cast to a `u32`;
/// however the converse is not always true due to the above range limits /// however the converse is not always true due to the above range limits
/// and, as such, should be performed via the `from_u32` function.. /// and, as such, should be performed via the `from_u32` function..
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub mod char { pub mod char {
pub use core::char::{MAX, from_u32, from_digit}; pub use core::char::{MAX, from_u32, from_digit};

View File

@ -19,7 +19,7 @@ use core::option::Option;
use tables::{derived_property, property, general_category, conversions, charwidth}; use tables::{derived_property, property, general_category, conversions, charwidth};
/// Functionality for manipulating `char`. /// Functionality for manipulating `char`.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub trait CharExt { pub trait CharExt {
/// Checks if a `char` parses as a numeric digit in the given radix. /// Checks if a `char` parses as a numeric digit in the given radix.
/// ///
@ -59,7 +59,7 @@ pub trait CharExt {
/// All characters are escaped with Rust syntax of the form `\\u{NNNN}` /// All characters are escaped with Rust syntax of the form `\\u{NNNN}`
/// where `NNNN` is the shortest hexadecimal representation of the code /// where `NNNN` is the shortest hexadecimal representation of the code
/// point. /// point.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn escape_unicode(self) -> char::EscapeUnicode; fn escape_unicode(self) -> char::EscapeUnicode;
/// Returns an iterator that yields the 'default' ASCII and /// Returns an iterator that yields the 'default' ASCII and
@ -74,17 +74,17 @@ pub trait CharExt {
/// escaped. /// escaped.
/// * Any other chars in the range [0x20,0x7e] are not escaped. /// * Any other chars in the range [0x20,0x7e] are not escaped.
/// * Any other chars are given hex Unicode escapes; see `escape_unicode`. /// * Any other chars are given hex Unicode escapes; see `escape_unicode`.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn escape_default(self) -> char::EscapeDefault; fn escape_default(self) -> char::EscapeDefault;
/// Returns the amount of bytes this character would need if encoded in /// Returns the amount of bytes this character would need if encoded in
/// UTF-8. /// UTF-8.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn len_utf8(self) -> uint; fn len_utf8(self) -> uint;
/// Returns the amount of bytes this character would need if encoded in /// Returns the amount of bytes this character would need if encoded in
/// UTF-16. /// UTF-16.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn len_utf16(self) -> uint; fn len_utf16(self) -> uint;
/// Encodes this character as UTF-8 into the provided byte buffer, /// Encodes this character as UTF-8 into the provided byte buffer,
@ -107,7 +107,7 @@ pub trait CharExt {
/// Returns whether the specified character is considered a Unicode /// Returns whether the specified character is considered a Unicode
/// alphabetic code point. /// alphabetic code point.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn is_alphabetic(self) -> bool; fn is_alphabetic(self) -> bool;
/// Returns whether the specified character satisfies the 'XID_Start' /// Returns whether the specified character satisfies the 'XID_Start'
@ -134,38 +134,38 @@ pub trait CharExt {
/// ///
/// This is defined according to the terms of the Unicode Derived Core /// This is defined according to the terms of the Unicode Derived Core
/// Property `Lowercase`. /// Property `Lowercase`.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn is_lowercase(self) -> bool; fn is_lowercase(self) -> bool;
/// Indicates whether a character is in uppercase. /// Indicates whether a character is in uppercase.
/// ///
/// This is defined according to the terms of the Unicode Derived Core /// This is defined according to the terms of the Unicode Derived Core
/// Property `Uppercase`. /// Property `Uppercase`.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn is_uppercase(self) -> bool; fn is_uppercase(self) -> bool;
/// Indicates whether a character is whitespace. /// Indicates whether a character is whitespace.
/// ///
/// Whitespace is defined in terms of the Unicode Property `White_Space`. /// Whitespace is defined in terms of the Unicode Property `White_Space`.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn is_whitespace(self) -> bool; fn is_whitespace(self) -> bool;
/// Indicates whether a character is alphanumeric. /// Indicates whether a character is alphanumeric.
/// ///
/// Alphanumericness is defined in terms of the Unicode General Categories /// Alphanumericness is defined in terms of the Unicode General Categories
/// 'Nd', 'Nl', 'No' and the Derived Core Property 'Alphabetic'. /// 'Nd', 'Nl', 'No' and the Derived Core Property 'Alphabetic'.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn is_alphanumeric(self) -> bool; fn is_alphanumeric(self) -> bool;
/// Indicates whether a character is a control code point. /// Indicates whether a character is a control code point.
/// ///
/// Control code points are defined in terms of the Unicode General /// Control code points are defined in terms of the Unicode General
/// Category `Cc`. /// Category `Cc`.
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn is_control(self) -> bool; fn is_control(self) -> bool;
/// Indicates whether the character is numeric (Nd, Nl, or No). /// Indicates whether the character is numeric (Nd, Nl, or No).
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn is_numeric(self) -> bool; fn is_numeric(self) -> bool;
/// Converts a character to its lowercase equivalent. /// Converts a character to its lowercase equivalent.
@ -219,7 +219,7 @@ pub trait CharExt {
fn width(self, is_cjk: bool) -> Option<uint>; fn width(self, is_cjk: bool) -> Option<uint>;
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl CharExt for char { impl CharExt for char {
#[unstable(feature = "unicode", #[unstable(feature = "unicode",
reason = "pending integer conventions")] reason = "pending integer conventions")]
@ -227,13 +227,13 @@ impl CharExt for char {
#[unstable(feature = "unicode", #[unstable(feature = "unicode",
reason = "pending integer conventions")] reason = "pending integer conventions")]
fn to_digit(self, radix: uint) -> Option<uint> { C::to_digit(self, radix) } fn to_digit(self, radix: uint) -> Option<uint> { C::to_digit(self, radix) }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn escape_unicode(self) -> char::EscapeUnicode { C::escape_unicode(self) } fn escape_unicode(self) -> char::EscapeUnicode { C::escape_unicode(self) }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn escape_default(self) -> char::EscapeDefault { C::escape_default(self) } fn escape_default(self) -> char::EscapeDefault { C::escape_default(self) }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn len_utf8(self) -> uint { C::len_utf8(self) } fn len_utf8(self) -> uint { C::len_utf8(self) }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn len_utf16(self) -> uint { C::len_utf16(self) } fn len_utf16(self) -> uint { C::len_utf16(self) }
#[unstable(feature = "unicode", #[unstable(feature = "unicode",
reason = "pending decision about Iterator/Writer/Reader")] reason = "pending decision about Iterator/Writer/Reader")]
@ -242,7 +242,7 @@ impl CharExt for char {
reason = "pending decision about Iterator/Writer/Reader")] reason = "pending decision about Iterator/Writer/Reader")]
fn encode_utf16(self, dst: &mut [u16]) -> Option<uint> { C::encode_utf16(self, dst) } fn encode_utf16(self, dst: &mut [u16]) -> Option<uint> { C::encode_utf16(self, dst) }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn is_alphabetic(self) -> bool { fn is_alphabetic(self) -> bool {
match self { match self {
'a' ... 'z' | 'A' ... 'Z' => true, 'a' ... 'z' | 'A' ... 'Z' => true,
@ -259,7 +259,7 @@ impl CharExt for char {
reason = "mainly needed for compiler internals")] reason = "mainly needed for compiler internals")]
fn is_xid_continue(self) -> bool { derived_property::XID_Continue(self) } fn is_xid_continue(self) -> bool { derived_property::XID_Continue(self) }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn is_lowercase(self) -> bool { fn is_lowercase(self) -> bool {
match self { match self {
'a' ... 'z' => true, 'a' ... 'z' => true,
@ -268,7 +268,7 @@ impl CharExt for char {
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn is_uppercase(self) -> bool { fn is_uppercase(self) -> bool {
match self { match self {
'A' ... 'Z' => true, 'A' ... 'Z' => true,
@ -277,7 +277,7 @@ impl CharExt for char {
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn is_whitespace(self) -> bool { fn is_whitespace(self) -> bool {
match self { match self {
' ' | '\x09' ... '\x0d' => true, ' ' | '\x09' ... '\x0d' => true,
@ -286,15 +286,15 @@ impl CharExt for char {
} }
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn is_alphanumeric(self) -> bool { fn is_alphanumeric(self) -> bool {
self.is_alphabetic() || self.is_numeric() self.is_alphabetic() || self.is_numeric()
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn is_control(self) -> bool { general_category::Cc(self) } fn is_control(self) -> bool { general_category::Cc(self) }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn is_numeric(self) -> bool { fn is_numeric(self) -> bool {
match self { match self {
'0' ... '9' => true, '0' ... '9' => true,

View File

@ -30,7 +30,7 @@ use u_char::CharExt as UCharExt; // conflicts with core::prelude::CharExt
use tables::grapheme::GraphemeCat; use tables::grapheme::GraphemeCat;
/// An iterator over the words of a string, separated by a sequence of whitespace /// An iterator over the words of a string, separated by a sequence of whitespace
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub struct Words<'a> { pub struct Words<'a> {
inner: Filter<&'a str, Split<'a, fn(char) -> bool>, fn(&&str) -> bool>, inner: Filter<&'a str, Split<'a, fn(char) -> bool>, fn(&&str) -> bool>,
} }

View File

@ -15,14 +15,14 @@
pub fn unstable() {} pub fn unstable() {}
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn stable() {} pub fn stable() {}
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub mod stable_mod { pub mod stable_mod {
pub fn unstable() {} pub fn unstable() {}
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn stable() {} pub fn stable() {}
} }
@ -35,11 +35,11 @@ pub mod unstable_mod {
pub fn unstable() {} pub fn unstable() {}
} }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub trait Stable { pub trait Stable {
fn unstable(&self); fn unstable(&self);
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn stable(&self); fn stable(&self);
} }
@ -50,6 +50,6 @@ impl Stable for uint {
pub enum Unstable { pub enum Unstable {
UnstableVariant, UnstableVariant,
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
StableVariant StableVariant
} }

View File

@ -33,12 +33,12 @@ pub fn unstable_text() {}
pub fn unmarked() {} pub fn unmarked() {}
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn stable() {} pub fn stable() {}
#[stable(feature = "grandfathered", since = "1.0.0", reason = "text")] #[stable(feature = "rust1", since = "1.0.0", reason = "text")]
pub fn stable_text() {} pub fn stable_text() {}
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub struct MethodTester; pub struct MethodTester;
impl MethodTester { impl MethodTester {
@ -63,9 +63,9 @@ impl MethodTester {
pub fn method_unmarked(&self) {} pub fn method_unmarked(&self) {}
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn method_stable(&self) {} pub fn method_stable(&self) {}
#[stable(feature = "grandfathered", since = "1.0.0", reason = "text")] #[stable(feature = "rust1", since = "1.0.0", reason = "text")]
pub fn method_stable_text(&self) {} pub fn method_stable_text(&self) {}
#[locked] #[locked]
@ -101,9 +101,9 @@ pub trait Trait {
fn trait_unmarked(&self) {} fn trait_unmarked(&self) {}
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn trait_stable(&self) {} fn trait_stable(&self) {}
#[stable(feature = "grandfathered", since = "1.0.0", reason = "text")] #[stable(feature = "rust1", since = "1.0.0", reason = "text")]
fn trait_stable_text(&self) {} fn trait_stable_text(&self) {}
#[locked] #[locked]
@ -131,7 +131,7 @@ pub struct DeprecatedUnstableStruct { pub i: int }
#[unstable(feature = "test_feature")] #[unstable(feature = "test_feature")]
pub struct UnstableStruct { pub i: int } pub struct UnstableStruct { pub i: int }
pub struct UnmarkedStruct { pub i: int } pub struct UnmarkedStruct { pub i: int }
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub struct StableStruct { pub i: int } pub struct StableStruct { pub i: int }
#[stable(feature = "test_feature", since = "1.0.0")] #[stable(feature = "test_feature", since = "1.0.0")]
@ -143,7 +143,7 @@ pub struct DeprecatedUnstableUnitStruct;
#[unstable(feature = "test_feature")] #[unstable(feature = "test_feature")]
pub struct UnstableUnitStruct; pub struct UnstableUnitStruct;
pub struct UnmarkedUnitStruct; pub struct UnmarkedUnitStruct;
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub struct StableUnitStruct; pub struct StableUnitStruct;
pub enum Enum { pub enum Enum {
@ -157,7 +157,7 @@ pub enum Enum {
UnstableVariant, UnstableVariant,
UnmarkedVariant, UnmarkedVariant,
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
StableVariant, StableVariant,
} }
@ -170,7 +170,7 @@ pub struct DeprecatedUnstableTupleStruct(pub int);
#[unstable(feature = "test_feature")] #[unstable(feature = "test_feature")]
pub struct UnstableTupleStruct(pub int); pub struct UnstableTupleStruct(pub int);
pub struct UnmarkedTupleStruct(pub int); pub struct UnmarkedTupleStruct(pub int);
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub struct StableTupleStruct(pub int); pub struct StableTupleStruct(pub int);
#[macro_export] #[macro_export]

View File

@ -13,7 +13,7 @@ struct Foo;
impl Foo { impl Foo {
fn foo() {} fn foo() {}
#[stable(feature = "grandfathered", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
} //~ ERROR expected `fn`, found `}` } //~ ERROR expected `fn`, found `}`
fn main() {} fn main() {}

Some files were not shown because too many files have changed in this diff Show More