diff options
Diffstat (limited to 'src/libcore')
49 files changed, 1287 insertions, 1019 deletions
diff --git a/src/libcore/any.rs b/src/libcore/any.rs index 9966f0d4bf7..87030ed778d 100644 --- a/src/libcore/any.rs +++ b/src/libcore/any.rs @@ -69,7 +69,7 @@ //! } //! ``` -#![stable] +#![stable(feature = "rust1", since = "1.0.0")] use mem::transmute; use option::Option::{self, Some, None}; @@ -86,10 +86,11 @@ use marker::Sized; /// /// Every type with no non-`'static` references implements `Any`, so `Any` can /// be used as a trait object to emulate the effects dynamic typing. -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub trait Any: 'static { /// Get the `TypeId` of `self` - #[unstable = "this method will likely be replaced by an associated static"] + #[unstable(feature = "core", + reason = "this method will likely be replaced by an associated static")] fn get_type_id(&self) -> TypeId; } @@ -103,7 +104,7 @@ impl<T: 'static> Any for T { impl Any { /// Returns true if the boxed type is the same as `T` - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] #[inline] pub fn is<T: 'static>(&self) -> bool { // Get TypeId of the type this function is instantiated with @@ -118,7 +119,7 @@ impl Any { /// Returns some reference to the boxed value if it is of type `T`, or /// `None` if it isn't. - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] #[inline] pub fn downcast_ref<T: 'static>(&self) -> Option<&T> { if self.is::<T>() { @@ -136,7 +137,7 @@ impl Any { /// Returns some mutable reference to the boxed value if it is of type `T`, or /// `None` if it isn't. - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] #[inline] pub fn downcast_mut<T: 'static>(&mut self) -> Option<&mut T> { if self.is::<T>() { @@ -167,7 +168,7 @@ impl Any { /// but this limitation may be removed in the future. #[cfg_attr(stage0, lang = "type_id")] #[derive(Clone, Copy, PartialEq, Eq, Show, Hash)] -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub struct TypeId { t: u64, } @@ -175,7 +176,8 @@ pub struct TypeId { impl TypeId { /// Returns the `TypeId` of the type this generic function has been /// instantiated with - #[unstable = "may grow a `Reflect` bound soon via marker traits"] + #[unstable(feature = "core", + reason = "may grow a `Reflect` bound soon via marker traits")] pub fn of<T: ?Sized + 'static>() -> TypeId { TypeId { t: unsafe { intrinsics::type_id::<T>() }, diff --git a/src/libcore/array.rs b/src/libcore/array.rs index a83537e12f7..44541c34ee2 100644 --- a/src/libcore/array.rs +++ b/src/libcore/array.rs @@ -12,7 +12,7 @@ //! up to a certain length. Eventually we should able to generalize //! to all lengths. -#![unstable] // not yet reviewed +#![unstable(feature = "core")] // not yet reviewed use clone::Clone; use cmp::{PartialEq, Eq, PartialOrd, Ord, Ordering}; @@ -26,7 +26,7 @@ use option::Option; macro_rules! array_impls { ($($N:expr)+) => { $( - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] impl<T:Copy> Clone for [T; $N] { fn clone(&self) -> [T; $N] { *self @@ -39,14 +39,14 @@ macro_rules! array_impls { } } - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] impl<T: fmt::Debug> fmt::Debug for [T; $N] { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fmt::Debug::fmt(&&self[], f) } } - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] impl<A, B> PartialEq<[B; $N]> for [A; $N] where A: PartialEq<B> { #[inline] fn eq(&self, other: &[B; $N]) -> bool { @@ -58,7 +58,7 @@ macro_rules! array_impls { } } - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] impl<'a, A, B, Rhs> PartialEq<Rhs> for [A; $N] where A: PartialEq<B>, Rhs: Deref<Target=[B]>, @@ -73,7 +73,7 @@ macro_rules! array_impls { } } - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] impl<'a, A, B, Lhs> PartialEq<[B; $N]> for Lhs where A: PartialEq<B>, Lhs: Deref<Target=[A]> @@ -88,10 +88,10 @@ macro_rules! array_impls { } } - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] impl<T:Eq> Eq for [T; $N] { } - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] impl<T:PartialOrd> PartialOrd for [T; $N] { #[inline] fn partial_cmp(&self, other: &[T; $N]) -> Option<Ordering> { @@ -115,7 +115,7 @@ macro_rules! array_impls { } } - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] impl<T:Ord> Ord for [T; $N] { #[inline] fn cmp(&self, other: &[T; $N]) -> Ordering { diff --git a/src/libcore/atomic.rs b/src/libcore/atomic.rs index e75481198d4..cf2854be016 100644 --- a/src/libcore/atomic.rs +++ b/src/libcore/atomic.rs @@ -68,7 +68,7 @@ //! println!("live tasks: {}", old_task_count + 1); //! ``` -#![stable] +#![stable(feature = "rust1", since = "1.0.0")] use self::Ordering::*; @@ -78,7 +78,7 @@ use intrinsics; use cell::UnsafeCell; /// A boolean type which can be safely shared between threads. -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub struct AtomicBool { v: UnsafeCell<usize>, } @@ -86,7 +86,7 @@ pub struct AtomicBool { unsafe impl Sync for AtomicBool {} /// A signed integer type which can be safely shared between threads. -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub struct AtomicIsize { v: UnsafeCell<isize>, } @@ -94,7 +94,7 @@ pub struct AtomicIsize { unsafe impl Sync for AtomicIsize {} /// An unsigned integer type which can be safely shared between threads. -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub struct AtomicUsize { v: UnsafeCell<usize>, } @@ -102,7 +102,7 @@ pub struct AtomicUsize { unsafe impl Sync for AtomicUsize {} /// A raw pointer type which can be safely shared between threads. -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub struct AtomicPtr<T> { p: UnsafeCell<usize>, } @@ -119,42 +119,42 @@ unsafe impl<T> Sync for AtomicPtr<T> {} /// /// Rust's memory orderings are [the same as /// C++'s](http://gcc.gnu.org/wiki/Atomic/GCCMM/AtomicSync). -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] #[derive(Copy)] pub enum Ordering { /// No ordering constraints, only atomic operations. - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] Relaxed, /// When coupled with a store, all previous writes become visible /// to another thread that performs a load with `Acquire` ordering /// on the same value. - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] Release, /// When coupled with a load, all subsequent loads will see data /// written before a store with `Release` ordering on the same value /// in another thread. - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] Acquire, /// When coupled with a load, uses `Acquire` ordering, and with a store /// `Release` ordering. - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] AcqRel, /// Like `AcqRel` with the additional guarantee that all threads see all /// sequentially consistent operations in the same order. - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] SeqCst, } /// An `AtomicBool` initialized to `false`. -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub const ATOMIC_BOOL_INIT: AtomicBool = AtomicBool { v: UnsafeCell { value: 0 } }; /// An `AtomicIsize` initialized to `0`. -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub const ATOMIC_ISIZE_INIT: AtomicIsize = AtomicIsize { v: UnsafeCell { value: 0 } }; /// An `AtomicUsize` initialized to `0`. -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub const ATOMIC_USIZE_INIT: AtomicUsize = AtomicUsize { v: UnsafeCell { value: 0, } }; @@ -173,7 +173,7 @@ impl AtomicBool { /// let atomic_false = AtomicBool::new(false); /// ``` #[inline] - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] pub fn new(v: bool) -> AtomicBool { let val = if v { UINT_TRUE } else { 0 }; AtomicBool { v: UnsafeCell::new(val) } @@ -197,7 +197,7 @@ impl AtomicBool { /// let value = some_bool.load(Ordering::Relaxed); /// ``` #[inline] - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] pub fn load(&self, order: Ordering) -> bool { unsafe { atomic_load(self.v.get(), order) > 0 } } @@ -220,7 +220,7 @@ impl AtomicBool { /// /// Panics if `order` is `Acquire` or `AcqRel`. #[inline] - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] pub fn store(&self, val: bool, order: Ordering) { let val = if val { UINT_TRUE } else { 0 }; @@ -241,7 +241,7 @@ impl AtomicBool { /// let value = some_bool.swap(false, Ordering::Relaxed); /// ``` #[inline] - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] pub fn swap(&self, val: bool, order: Ordering) -> bool { let val = if val { UINT_TRUE } else { 0 }; @@ -265,7 +265,7 @@ impl AtomicBool { /// let value = some_bool.store(false, Ordering::Relaxed); /// ``` #[inline] - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] pub fn compare_and_swap(&self, old: bool, new: bool, order: Ordering) -> bool { let old = if old { 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)); /// ``` #[inline] - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] pub fn fetch_and(&self, val: bool, order: Ordering) -> bool { let val = if val { UINT_TRUE } else { 0 }; @@ -331,7 +331,7 @@ impl AtomicBool { /// assert_eq!(true, foo.load(Ordering::SeqCst)); /// ``` #[inline] - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] pub fn fetch_nand(&self, val: bool, order: Ordering) -> bool { let val = if val { UINT_TRUE } else { 0 }; @@ -363,7 +363,7 @@ impl AtomicBool { /// assert_eq!(false, foo.load(Ordering::SeqCst)); /// ``` #[inline] - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] pub fn fetch_or(&self, val: bool, order: Ordering) -> bool { let val = if val { UINT_TRUE } else { 0 }; @@ -395,7 +395,7 @@ impl AtomicBool { /// assert_eq!(false, foo.load(Ordering::SeqCst)); /// ``` #[inline] - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] pub fn fetch_xor(&self, val: bool, order: Ordering) -> bool { let val = if val { UINT_TRUE } else { 0 }; @@ -403,7 +403,7 @@ impl AtomicBool { } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl AtomicIsize { /// Creates a new `AtomicIsize`. /// @@ -580,7 +580,7 @@ impl AtomicIsize { } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl AtomicUsize { /// Creates a new `AtomicUsize`. /// @@ -769,7 +769,7 @@ impl<T> AtomicPtr<T> { /// let atomic_ptr = AtomicPtr::new(ptr); /// ``` #[inline] - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] pub fn new(p: *mut T) -> AtomicPtr<T> { AtomicPtr { p: UnsafeCell::new(p as usize) } } @@ -793,7 +793,7 @@ impl<T> AtomicPtr<T> { /// let value = some_ptr.load(Ordering::Relaxed); /// ``` #[inline] - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] pub fn load(&self, order: Ordering) -> *mut T { unsafe { atomic_load(self.p.get(), order) as *mut T @@ -821,7 +821,7 @@ impl<T> AtomicPtr<T> { /// /// Panics if `order` is `Acquire` or `AcqRel`. #[inline] - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] pub fn store(&self, ptr: *mut T, order: Ordering) { 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); /// ``` #[inline] - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] pub fn swap(&self, ptr: *mut T, order: Ordering) -> *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); /// ``` #[inline] - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] pub fn compare_and_swap(&self, old: *mut T, new: *mut T, order: Ordering) -> *mut T { unsafe { 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] -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] unsafe fn atomic_load<T>(dst: *const T, order:Ordering) -> T { match order { Acquire => intrinsics::atomic_load_acq(dst), @@ -902,7 +902,7 @@ unsafe fn atomic_load<T>(dst: *const T, order:Ordering) -> T { } #[inline] -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] unsafe fn atomic_swap<T>(dst: *mut T, val: T, order: Ordering) -> T { match order { 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). #[inline] -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] unsafe fn atomic_add<T>(dst: *mut T, val: T, order: Ordering) -> T { match order { 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). #[inline] -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] unsafe fn atomic_sub<T>(dst: *mut T, val: T, order: Ordering) -> T { match order { 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] -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] unsafe fn atomic_compare_and_swap<T>(dst: *mut T, old:T, new:T, order: Ordering) -> T { match order { 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] -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] unsafe fn atomic_and<T>(dst: *mut T, val: T, order: Ordering) -> T { match order { 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] -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] unsafe fn atomic_nand<T>(dst: *mut T, val: T, order: Ordering) -> T { match order { 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] -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] unsafe fn atomic_or<T>(dst: *mut T, val: T, order: Ordering) -> T { match order { 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] -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] unsafe fn atomic_xor<T>(dst: *mut T, val: T, order: Ordering) -> T { match order { 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`. #[inline] -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub fn fence(order: Ordering) { unsafe { match order { @@ -1036,7 +1036,9 @@ pub fn fence(order: Ordering) { } } -#[deprecated="renamed to AtomicIsize"] +#[unstable(feature = "core")] +#[deprecated(since = "1.0.0", + reason = "renamed to AtomicIsize")] #[allow(missing_docs)] pub struct AtomicInt { v: UnsafeCell<int>, @@ -1044,7 +1046,9 @@ pub struct AtomicInt { unsafe impl Sync for AtomicInt {} -#[deprecated="renamed to AtomicUsize"] +#[unstable(feature = "core")] +#[deprecated(since = "1.0.0", + reason = "renamed to AtomicUsize")] #[allow(missing_docs)] pub struct AtomicUint { v: UnsafeCell<uint>, @@ -1052,11 +1056,15 @@ pub struct AtomicUint { unsafe impl Sync for AtomicUint {} -#[deprecated="use ATOMIC_ISIZE_INIT instead"] +#[unstable(feature = "core")] +#[deprecated(since = "1.0.0", + reason = "use ATOMIC_ISIZE_INIT instead")] #[allow(missing_docs, deprecated)] pub const ATOMIC_INT_INIT: AtomicInt = AtomicInt { v: UnsafeCell { value: 0 } }; -#[deprecated="use ATOMIC_USIZE_INIT instead"] +#[unstable(feature = "core")] +#[deprecated(since = "1.0.0", + reason = "use ATOMIC_USIZE_INIT instead")] #[allow(missing_docs, deprecated)] pub const ATOMIC_UINT_INIT: AtomicUint = AtomicUint { v: UnsafeCell { value: 0, } }; diff --git a/src/libcore/borrow.rs b/src/libcore/borrow.rs index 63614aaa463..be144b052c7 100644 --- a/src/libcore/borrow.rs +++ b/src/libcore/borrow.rs @@ -42,7 +42,8 @@ //! is desired, `to_mut` will obtain a mutable references to an owned //! value, cloning if necessary. -#![unstable = "recently added as part of collections reform"] +#![unstable(feature = "core", + reason = "recently added as part of collections reform")] use clone::Clone; use cmp::{Eq, Ord, Ordering, PartialEq, PartialOrd}; @@ -141,7 +142,7 @@ pub enum Cow<'a, T, B: ?Sized + 'a> where B: ToOwned<T> { Owned(T) } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<'a, T, B: ?Sized> Clone for Cow<'a, T, B> where B: ToOwned<T> { fn clone(&self) -> Cow<'a, T, B> { match *self { @@ -195,7 +196,7 @@ impl<'a, T, B: ?Sized> Cow<'a, T, B> where B: ToOwned<T> { } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<'a, T, B: ?Sized> Deref for Cow<'a, T, B> where B: ToOwned<T> { type Target = B; @@ -207,10 +208,10 @@ impl<'a, T, B: ?Sized> Deref for Cow<'a, T, B> where B: ToOwned<T> { } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<'a, T, B: ?Sized> Eq for Cow<'a, T, B> where B: Eq + ToOwned<T> {} -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<'a, T, B: ?Sized> Ord for Cow<'a, T, B> where B: Ord + ToOwned<T> { #[inline] fn cmp(&self, other: &Cow<'a, T, B>) -> Ordering { @@ -218,7 +219,7 @@ impl<'a, T, B: ?Sized> Ord for Cow<'a, T, B> where B: Ord + ToOwned<T> { } } -#[stable] +#[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 B: PartialEq<C> + ToOwned<T>, C: ToOwned<U>, @@ -229,7 +230,7 @@ impl<'a, 'b, T, U, B: ?Sized, C: ?Sized> PartialEq<Cow<'b, U, C>> for Cow<'a, T, } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<'a, T, B: ?Sized> PartialOrd for Cow<'a, T, B> where B: PartialOrd + ToOwned<T> { #[inline] fn partial_cmp(&self, other: &Cow<'a, T, B>) -> Option<Ordering> { @@ -237,7 +238,7 @@ impl<'a, T, B: ?Sized> PartialOrd for Cow<'a, T, B> where B: PartialOrd + ToOwne } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<'a, T, B: ?Sized> fmt::Debug for Cow<'a, T, B> where B: fmt::Debug + ToOwned<T>, T: fmt::Debug, @@ -250,7 +251,7 @@ impl<'a, T, B: ?Sized> fmt::Debug for Cow<'a, T, B> where } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<'a, T, B: ?Sized> fmt::Display for Cow<'a, T, B> where B: fmt::Display + ToOwned<T>, T: fmt::Display, diff --git a/src/libcore/cell.rs b/src/libcore/cell.rs index 916c5f50d22..02cc4038a69 100644 --- a/src/libcore/cell.rs +++ b/src/libcore/cell.rs @@ -139,7 +139,7 @@ //! ``` //! -#![stable] +#![stable(feature = "rust1", since = "1.0.0")] use clone::Clone; use cmp::PartialEq; @@ -152,7 +152,7 @@ use option::Option::{None, Some}; /// A mutable memory location that admits only `Copy` data. /// /// See the [module-level documentation](../index.html) for more. -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub struct Cell<T> { value: UnsafeCell<T>, } @@ -167,7 +167,7 @@ impl<T:Copy> Cell<T> { /// /// let c = Cell::new(5); /// ``` - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] pub fn new(value: T) -> Cell<T> { Cell { value: UnsafeCell::new(value), @@ -186,7 +186,7 @@ impl<T:Copy> Cell<T> { /// let five = c.get(); /// ``` #[inline] - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] pub fn get(&self) -> T { unsafe{ *self.value.get() } } @@ -203,7 +203,7 @@ impl<T:Copy> Cell<T> { /// c.set(10); /// ``` #[inline] - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] pub fn set(&self, value: T) { unsafe { *self.value.get() = value; @@ -226,31 +226,31 @@ impl<T:Copy> Cell<T> { /// let uc = unsafe { c.as_unsafe_cell() }; /// ``` #[inline] - #[unstable] + #[unstable(feature = "core")] pub unsafe fn as_unsafe_cell<'a>(&'a self) -> &'a UnsafeCell<T> { &self.value } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] unsafe impl<T> Send for Cell<T> where T: Send {} -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<T:Copy> Clone for Cell<T> { fn clone(&self) -> Cell<T> { Cell::new(self.get()) } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<T:Default + Copy> Default for Cell<T> { - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] fn default() -> Cell<T> { Cell::new(Default::default()) } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<T:PartialEq + Copy> PartialEq for Cell<T> { fn eq(&self, other: &Cell<T>) -> bool { self.get() == other.get() @@ -260,7 +260,7 @@ impl<T:PartialEq + Copy> PartialEq for Cell<T> { /// A mutable memory location with dynamically checked borrow rules /// /// See the [module-level documentation](../index.html) for more. -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub struct RefCell<T> { value: UnsafeCell<T>, borrow: Cell<BorrowFlag>, @@ -282,7 +282,7 @@ impl<T> RefCell<T> { /// /// let c = RefCell::new(5); /// ``` - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] pub fn new(value: T) -> RefCell<T> { RefCell { value: UnsafeCell::new(value), @@ -301,7 +301,7 @@ impl<T> RefCell<T> { /// /// let five = c.into_inner(); /// ``` - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] pub fn into_inner(self) -> T { // Since this function takes `self` (the `RefCell`) by value, the // compiler statically verifies that it is not currently borrowed. @@ -316,7 +316,7 @@ impl<T> RefCell<T> { /// immutable borrows can be taken out at the same time. /// /// Returns `None` if the value is currently mutably borrowed. - #[unstable = "may be renamed or removed"] + #[unstable(feature = "core", reason = "may be renamed or removed")] pub fn try_borrow<'a>(&'a self) -> Option<Ref<'a, T>> { match BorrowRef::new(&self.borrow) { Some(b) => Some(Ref { _value: unsafe { &*self.value.get() }, _borrow: b }), @@ -359,7 +359,7 @@ impl<T> RefCell<T> { /// /// assert!(result.is_err()); /// ``` - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] pub fn borrow<'a>(&'a self) -> Ref<'a, T> { match self.try_borrow() { Some(ptr) => ptr, @@ -373,7 +373,7 @@ impl<T> RefCell<T> { /// cannot be borrowed while this borrow is active. /// /// Returns `None` if the value is currently borrowed. - #[unstable = "may be renamed or removed"] + #[unstable(feature = "core", reason = "may be renamed or removed")] pub fn try_borrow_mut<'a>(&'a self) -> Option<RefMut<'a, T>> { match BorrowRefMut::new(&self.borrow) { Some(b) => Some(RefMut { _value: unsafe { &mut *self.value.get() }, _borrow: b }), @@ -415,7 +415,7 @@ impl<T> RefCell<T> { /// /// assert!(result.is_err()); /// ``` - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] pub fn borrow_mut<'a>(&'a self) -> RefMut<'a, T> { match self.try_borrow_mut() { Some(ptr) => ptr, @@ -429,31 +429,31 @@ impl<T> RefCell<T> { /// /// This function is `unsafe` because `UnsafeCell`'s field is public. #[inline] - #[unstable] + #[unstable(feature = "core")] pub unsafe fn as_unsafe_cell<'a>(&'a self) -> &'a UnsafeCell<T> { &self.value } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] unsafe impl<T> Send for RefCell<T> where T: Send {} -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<T: Clone> Clone for RefCell<T> { fn clone(&self) -> RefCell<T> { RefCell::new(self.borrow().clone()) } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<T:Default> Default for RefCell<T> { - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] fn default() -> RefCell<T> { RefCell::new(Default::default()) } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<T: PartialEq> PartialEq for RefCell<T> { fn eq(&self, other: &RefCell<T>) -> bool { *self.borrow() == *other.borrow() @@ -496,10 +496,11 @@ impl<'b> Clone for BorrowRef<'b> { } } +/// Wraps a borrowed reference to a value in a `RefCell` box. /// A wrapper type for an immutably borrowed value from a `RefCell<T>`. /// /// See the [module-level documentation](../index.html) for more. -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub struct Ref<'b, T:'b> { // FIXME #12808: strange name to try to avoid interfering with // field accesses of the contained type via Deref @@ -507,7 +508,7 @@ pub struct Ref<'b, T:'b> { _borrow: BorrowRef<'b>, } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<'b, T> Deref for Ref<'b, T> { type Target = T; @@ -523,7 +524,8 @@ impl<'b, T> Deref for Ref<'b, T> { /// /// A `Clone` implementation would interfere with the widespread /// use of `r.borrow().clone()` to clone the contents of a `RefCell`. -#[unstable = "likely to be moved to a method, pending language changes"] +#[unstable(feature = "core", + reason = "likely to be moved to a method, pending language changes")] pub fn clone_ref<'b, T:Clone>(orig: &Ref<'b, T>) -> Ref<'b, T> { Ref { _value: orig._value, @@ -559,7 +561,7 @@ impl<'b> BorrowRefMut<'b> { /// A wrapper type for a mutably borrowed value from a `RefCell<T>`. /// /// See the [module-level documentation](../index.html) for more. -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub struct RefMut<'b, T:'b> { // FIXME #12808: strange name to try to avoid interfering with // field accesses of the contained type via Deref @@ -567,7 +569,7 @@ pub struct RefMut<'b, T:'b> { _borrow: BorrowRefMut<'b>, } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<'b, T> Deref for RefMut<'b, T> { type Target = T; @@ -577,7 +579,7 @@ impl<'b, T> Deref for RefMut<'b, T> { } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<'b, T> DerefMut for RefMut<'b, T> { #[inline] fn deref_mut<'a>(&'a mut self) -> &'a mut T { @@ -619,13 +621,13 @@ impl<'b, T> DerefMut for RefMut<'b, T> { /// **NOTE:** `UnsafeCell<T>`'s fields are public to allow static initializers. It is not /// recommended to access its fields directly, `get` should be used instead. #[lang="unsafe"] -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub struct UnsafeCell<T> { /// Wrapped value /// /// This field should not be accessed directly, it is made public for static /// initializers. - #[unstable] + #[unstable(feature = "core")] pub value: T, } @@ -643,7 +645,7 @@ impl<T> UnsafeCell<T> { /// /// let uc = UnsafeCell::new(5); /// ``` - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] pub fn new(value: T) -> UnsafeCell<T> { UnsafeCell { value: value } } @@ -660,7 +662,7 @@ impl<T> UnsafeCell<T> { /// let five = uc.get(); /// ``` #[inline] - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] pub fn get(&self) -> *mut T { &self.value as *const T as *mut T } /// Unwraps the value @@ -680,6 +682,6 @@ impl<T> UnsafeCell<T> { /// let five = unsafe { uc.into_inner() }; /// ``` #[inline] - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] pub unsafe fn into_inner(self) -> T { self.value } } diff --git a/src/libcore/char.rs b/src/libcore/char.rs index c17f7cdccba..22bfd47893c 100644 --- a/src/libcore/char.rs +++ b/src/libcore/char.rs @@ -64,12 +64,12 @@ static MAX_THREE_B: u32 = 0x10000u32; */ /// The highest valid code point -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub const MAX: char = '\u{10ffff}'; /// Converts from `u32` to a `char` #[inline] -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub fn from_u32(i: u32) -> Option<char> { // catch out-of-bounds and surrogates if (i > MAX as u32) || (i >= 0xD800 && i <= 0xDFFF) { @@ -92,7 +92,7 @@ pub fn from_u32(i: u32) -> Option<char> { /// Panics if given an `radix` > 36. /// #[inline] -#[unstable = "pending integer conventions"] +#[unstable(feature = "core", reason = "pending integer conventions")] pub fn from_digit(num: uint, radix: uint) -> Option<char> { if radix > 36 { panic!("from_digit: radix is too high (maximum 36)"); @@ -111,7 +111,7 @@ pub fn from_digit(num: uint, radix: uint) -> Option<char> { } /// Basic `char` manipulations. -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub trait CharExt { /// Checks if a `char` parses as a numeric digit in the given radix. /// @@ -126,7 +126,8 @@ pub trait CharExt { /// # Panics /// /// Panics if given a radix > 36. - #[unstable = "pending integer conventions"] + #[unstable(feature = "core", + reason = "pending integer conventions")] fn is_digit(self, radix: uint) -> bool; /// Converts a character to the corresponding digit. @@ -140,7 +141,8 @@ pub trait CharExt { /// # Panics /// /// Panics if given a radix outside the range [0..36]. - #[unstable = "pending integer conventions"] + #[unstable(feature = "core", + reason = "pending integer conventions")] fn to_digit(self, radix: uint) -> Option<uint>; /// Returns an iterator that yields the hexadecimal Unicode escape @@ -149,7 +151,7 @@ pub trait CharExt { /// All characters are escaped with Rust syntax of the form `\\u{NNNN}` /// where `NNNN` is the shortest hexadecimal representation of the code /// point. - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] fn escape_unicode(self) -> EscapeUnicode; /// Returns an iterator that yields the 'default' ASCII and @@ -164,17 +166,17 @@ pub trait CharExt { /// escaped. /// * Any other chars in the range [0x20,0x7e] are not escaped. /// * Any other chars are given hex Unicode escapes; see `escape_unicode`. - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] fn escape_default(self) -> EscapeDefault; /// Returns the amount of bytes this character would need if encoded in /// UTF-8. - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] fn len_utf8(self) -> uint; /// Returns the amount of bytes this character would need if encoded in /// UTF-16. - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] fn len_utf16(self) -> uint; /// Encodes this character as UTF-8 into the provided byte buffer, @@ -182,7 +184,7 @@ pub trait CharExt { /// /// If the buffer is not large enough, nothing will be written into it /// and a `None` will be returned. - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] fn encode_utf8(self, dst: &mut [u8]) -> Option<uint>; /// Encodes this character as UTF-16 into the provided `u16` buffer, @@ -190,18 +192,20 @@ pub trait CharExt { /// /// If the buffer is not large enough, nothing will be written into it /// and a `None` will be returned. - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] fn encode_utf16(self, dst: &mut [u16]) -> Option<uint>; } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl CharExt for char { - #[unstable = "pending integer conventions"] + #[unstable(feature = "core", + reason = "pending integer conventions")] fn is_digit(self, radix: uint) -> bool { self.to_digit(radix).is_some() } - #[unstable = "pending integer conventions"] + #[unstable(feature = "core", + reason = "pending integer conventions")] fn to_digit(self, radix: uint) -> Option<uint> { if radix > 36 { panic!("to_digit: radix is too high (maximum 36)"); @@ -216,12 +220,12 @@ impl CharExt for char { else { None } } - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] fn escape_unicode(self) -> EscapeUnicode { EscapeUnicode { c: self, state: EscapeUnicodeState::Backslash } } - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] fn escape_default(self) -> EscapeDefault { let init_state = match self { '\t' => EscapeDefaultState::Backslash('t'), @@ -237,7 +241,7 @@ impl CharExt for char { } #[inline] - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] fn len_utf8(self) -> uint { let code = self as u32; match () { @@ -249,20 +253,22 @@ impl CharExt for char { } #[inline] - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] fn len_utf16(self) -> uint { let ch = self as u32; if (ch & 0xFFFF_u32) == ch { 1 } else { 2 } } #[inline] - #[unstable = "pending decision about Iterator/Writer/Reader"] + #[unstable(feature = "core", + reason = "pending decision about Iterator/Writer/Reader")] fn encode_utf8(self, dst: &mut [u8]) -> Option<uint> { encode_utf8_raw(self as u32, dst) } #[inline] - #[unstable = "pending decision about Iterator/Writer/Reader"] + #[unstable(feature = "core", + reason = "pending decision about Iterator/Writer/Reader")] fn encode_utf16(self, dst: &mut [u16]) -> Option<uint> { encode_utf16_raw(self as u32, dst) } @@ -274,7 +280,7 @@ impl CharExt for char { /// If the buffer is not large enough, nothing will be written into it /// and a `None` will be returned. #[inline] -#[unstable] +#[unstable(feature = "core")] pub fn encode_utf8_raw(code: u32, dst: &mut [u8]) -> Option<uint> { // Marked #[inline] to allow llvm optimizing it away if code < MAX_ONE_B && dst.len() >= 1 { @@ -306,7 +312,7 @@ pub fn encode_utf8_raw(code: u32, dst: &mut [u8]) -> Option<uint> { /// If the buffer is not large enough, nothing will be written into it /// and a `None` will be returned. #[inline] -#[unstable] +#[unstable(feature = "core")] pub fn encode_utf16_raw(mut ch: u32, dst: &mut [u16]) -> Option<uint> { // Marked #[inline] to allow llvm optimizing it away if (ch & 0xFFFF_u32) == ch && dst.len() >= 1 { @@ -327,14 +333,14 @@ pub fn encode_utf16_raw(mut ch: u32, dst: &mut [u16]) -> Option<uint> { /// An iterator over the characters that represent a `char`, as escaped by /// Rust's unicode escaping rules. #[derive(Clone)] -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub struct EscapeUnicode { c: char, state: EscapeUnicodeState } #[derive(Clone)] -#[unstable] +#[unstable(feature = "core")] enum EscapeUnicodeState { Backslash, Type, @@ -344,7 +350,7 @@ enum EscapeUnicodeState { Done, } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl Iterator for EscapeUnicode { type Item = char; @@ -390,13 +396,13 @@ impl Iterator for EscapeUnicode { /// An iterator over the characters that represent a `char`, escaped /// for maximum portability. #[derive(Clone)] -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub struct EscapeDefault { state: EscapeDefaultState } #[derive(Clone)] -#[unstable] +#[unstable(feature = "core")] enum EscapeDefaultState { Backslash(char), Char(char), @@ -404,7 +410,7 @@ enum EscapeDefaultState { Unicode(EscapeUnicode), } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl Iterator for EscapeDefault { type Item = char; diff --git a/src/libcore/clone.rs b/src/libcore/clone.rs index ffa6d085543..28c306fc009 100644 --- a/src/libcore/clone.rs +++ b/src/libcore/clone.rs @@ -19,15 +19,15 @@ //! explicitly, by convention implementing the `Clone` trait and calling //! the `clone` method. -#![stable] +#![stable(feature = "rust1", since = "1.0.0")] use marker::Sized; /// A common trait for cloning an object. -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub trait Clone : Sized { /// Returns a copy of the value. - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] fn clone(&self) -> Self; /// Perform copy-assignment from `source`. @@ -36,13 +36,14 @@ pub trait Clone : Sized { /// but can be overridden to reuse the resources of `a` to avoid unnecessary /// allocations. #[inline(always)] - #[unstable = "this function is rarely used"] + #[unstable(feature = "core", + reason = "this function is rarely used")] fn clone_from(&mut self, source: &Self) { *self = source.clone() } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<'a, T: ?Sized> Clone for &'a T { /// Return a shallow copy of the reference. #[inline] @@ -51,7 +52,7 @@ impl<'a, T: ?Sized> Clone for &'a T { macro_rules! clone_impl { ($t:ty) => { - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] impl Clone for $t { /// Return a deep copy of the value. #[inline] @@ -81,7 +82,8 @@ clone_impl! { char } macro_rules! extern_fn_clone { ($($A:ident),*) => ( - #[unstable = "this may not be sufficient for fns with region parameters"] + #[unstable(feature = "core", + reason = "this may not be sufficient for fns with region parameters")] impl<$($A,)* ReturnType> Clone for extern "Rust" fn($($A),*) -> ReturnType { /// Return a copy of a function pointer #[inline] diff --git a/src/libcore/cmp.rs b/src/libcore/cmp.rs index 6cda9d0e653..2ecbd55fcb1 100644 --- a/src/libcore/cmp.rs +++ b/src/libcore/cmp.rs @@ -39,7 +39,7 @@ //! assert!(SketchyNum {num: 25} != SketchyNum {num: 57}); //! ``` -#![stable] +#![stable(feature = "rust1", since = "1.0.0")] 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 /// only if `a != b`. #[lang="eq"] -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] #[old_orphan_check] pub trait PartialEq<Rhs: ?Sized = Self> { /// This method tests for `self` and `other` values to be equal, and is used by `==`. - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] fn eq(&self, other: &Rhs) -> bool; /// This method tests for `!=`. #[inline] - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] fn ne(&self, other: &Rhs) -> bool { !self.eq(other) } } @@ -90,7 +90,7 @@ pub trait PartialEq<Rhs: ?Sized = Self> { /// - reflexive: `a == a`; /// - symmetric: `a == b` implies `b == a`; and /// - transitive: `a == b` and `b == c` implies `a == c`. -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub trait Eq: PartialEq<Self> { // FIXME #13101: this method is used solely by #[deriving] to // 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. #[derive(Clone, Copy, PartialEq, Show)] -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub enum Ordering { /// An ordering where a compared value is less [than another]. - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] Less = -1, /// An ordering where a compared value is equal [to another]. - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] Equal = 0, /// An ordering where a compared value is greater [than another]. - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] Greater = 1, } @@ -141,7 +141,7 @@ impl Ordering { /// assert!(data == b); /// ``` #[inline] - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] pub fn reverse(self) -> Ordering { unsafe { // this compiles really nicely (to a single instruction); @@ -164,7 +164,7 @@ impl Ordering { /// true; and /// - transitive, `a < b` and `b < c` implies `a < c`. The same must hold for /// both `==` and `>`. -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub trait Ord: Eq + PartialOrd<Self> { /// This method returns an ordering between `self` and `other` values. /// @@ -178,26 +178,26 @@ pub trait Ord: Eq + PartialOrd<Self> { /// assert_eq!(10.cmp(&5), Greater); // because 10 > 5 /// assert_eq!( 5.cmp(&5), Equal); // because 5 == 5 /// ``` - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] fn cmp(&self, other: &Self) -> Ordering; } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl Eq for Ordering {} -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl Ord for Ordering { #[inline] - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] fn cmp(&self, other: &Ordering) -> Ordering { (*self as int).cmp(&(*other as int)) } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl PartialOrd for Ordering { #[inline] - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] fn partial_cmp(&self, other: &Ordering) -> Option<Ordering> { (*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 /// 5.11). #[lang="ord"] -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub trait PartialOrd<Rhs: ?Sized = Self>: PartialEq<Rhs> { /// This method returns an ordering between `self` and `other` values /// if one exists. - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] fn partial_cmp(&self, other: &Rhs) -> Option<Ordering>; /// This method tests less than (for `self` and `other`) and is used by the `<` operator. #[inline] - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] fn lt(&self, other: &Rhs) -> bool { match self.partial_cmp(other) { Some(Less) => true, @@ -243,7 +243,7 @@ pub trait PartialOrd<Rhs: ?Sized = Self>: PartialEq<Rhs> { /// This method tests less than or equal to (`<=`). #[inline] - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] fn le(&self, other: &Rhs) -> bool { match self.partial_cmp(other) { Some(Less) | Some(Equal) => true, @@ -253,7 +253,7 @@ pub trait PartialOrd<Rhs: ?Sized = Self>: PartialEq<Rhs> { /// This method tests greater than (`>`). #[inline] - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] fn gt(&self, other: &Rhs) -> bool { match self.partial_cmp(other) { Some(Greater) => true, @@ -263,7 +263,7 @@ pub trait PartialOrd<Rhs: ?Sized = Self>: PartialEq<Rhs> { /// This method tests greater than or equal to (`>=`). #[inline] - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] fn ge(&self, other: &Rhs) -> bool { match self.partial_cmp(other) { 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. #[inline] -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub fn min<T: Ord>(v1: T, v2: T) -> T { if v1 < v2 { v1 } else { v2 } } /// Compare and return the maximum of two values. #[inline] -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub fn max<T: Ord>(v1: T, v2: T) -> T { if v1 > v2 { v1 } else { v2 } } @@ -290,7 +290,7 @@ pub fn max<T: Ord>(v1: T, v2: T) -> T { /// /// Returns the first argument if the comparison determines them to be equal. #[inline] -#[unstable] +#[unstable(feature = "core")] pub fn partial_min<T: PartialOrd>(v1: T, v2: T) -> Option<T> { match v1.partial_cmp(&v2) { Some(Less) | Some(Equal) => Some(v1), @@ -303,7 +303,7 @@ pub fn partial_min<T: PartialOrd>(v1: T, v2: T) -> Option<T> { /// /// Returns the first argument if the comparison determines them to be equal. #[inline] -#[unstable] +#[unstable(feature = "core")] pub fn partial_max<T: PartialOrd>(v1: T, v2: T) -> Option<T> { match v1.partial_cmp(&v2) { Some(Less) => Some(v2), @@ -322,7 +322,7 @@ mod impls { macro_rules! partial_eq_impl { ($($t:ty)*) => ($( - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] impl PartialEq for $t { #[inline] fn eq(&self, other: &$t) -> bool { (*self) == (*other) } @@ -332,7 +332,7 @@ mod impls { )*) } - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] impl PartialEq for () { #[inline] fn eq(&self, _other: &()) -> bool { true } @@ -346,7 +346,7 @@ mod impls { macro_rules! eq_impl { ($($t:ty)*) => ($( - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] impl Eq for $t {} )*) } @@ -355,7 +355,7 @@ mod impls { macro_rules! partial_ord_impl { ($($t:ty)*) => ($( - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] impl PartialOrd for $t { #[inline] fn partial_cmp(&self, other: &$t) -> Option<Ordering> { @@ -378,7 +378,7 @@ mod impls { )*) } - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] impl PartialOrd for () { #[inline] fn partial_cmp(&self, _: &()) -> Option<Ordering> { @@ -386,7 +386,7 @@ mod impls { } } - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] impl PartialOrd for bool { #[inline] fn partial_cmp(&self, other: &bool) -> Option<Ordering> { @@ -398,7 +398,7 @@ mod impls { macro_rules! ord_impl { ($($t:ty)*) => ($( - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] impl Ord for $t { #[inline] fn cmp(&self, other: &$t) -> Ordering { @@ -410,13 +410,13 @@ mod impls { )*) } - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] impl Ord for () { #[inline] fn cmp(&self, _other: &()) -> Ordering { Equal } } - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] impl Ord for bool { #[inline] fn cmp(&self, other: &bool) -> Ordering { @@ -428,14 +428,14 @@ mod impls { // & pointers - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] impl<'a, 'b, A: ?Sized, B: ?Sized> PartialEq<&'b B> for &'a A where A: PartialEq<B> { #[inline] fn eq(&self, other: & &'b B) -> bool { PartialEq::eq(*self, *other) } #[inline] fn ne(&self, other: & &'b B) -> bool { PartialEq::ne(*self, *other) } } - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] impl<'a, 'b, A: ?Sized, B: ?Sized> PartialOrd<&'b B> for &'a A where A: PartialOrd<B> { #[inline] fn partial_cmp(&self, other: &&'b B) -> Option<Ordering> { @@ -450,24 +450,24 @@ mod impls { #[inline] fn gt(&self, other: & &'b B) -> bool { PartialOrd::gt(*self, *other) } } - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] impl<'a, A: ?Sized> Ord for &'a A where A: Ord { #[inline] fn cmp(&self, other: & &'a A) -> Ordering { Ord::cmp(*self, *other) } } - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] impl<'a, A: ?Sized> Eq for &'a A where A: Eq {} // &mut pointers - #[stable] + #[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> { #[inline] fn eq(&self, other: &&'b mut B) -> bool { PartialEq::eq(*self, *other) } #[inline] fn ne(&self, other: &&'b mut B) -> bool { PartialEq::ne(*self, *other) } } - #[stable] + #[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> { #[inline] fn partial_cmp(&self, other: &&'b mut B) -> Option<Ordering> { @@ -482,15 +482,15 @@ mod impls { #[inline] fn gt(&self, other: &&'b mut B) -> bool { PartialOrd::gt(*self, *other) } } - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] impl<'a, A: ?Sized> Ord for &'a mut A where A: Ord { #[inline] fn cmp(&self, other: &&'a mut A) -> Ordering { Ord::cmp(*self, *other) } } - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] impl<'a, A: ?Sized> Eq for &'a mut A where A: Eq {} - #[stable] + #[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> { #[inline] 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) } } - #[stable] + #[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> { #[inline] fn eq(&self, other: &&'b B) -> bool { PartialEq::eq(*self, *other) } diff --git a/src/libcore/default.rs b/src/libcore/default.rs index 3b1e5e23150..d79b613f589 100644 --- a/src/libcore/default.rs +++ b/src/libcore/default.rs @@ -81,7 +81,7 @@ //! } //! ``` -#![stable] +#![stable(feature = "rust1", since = "1.0.0")] /// A trait that types which have a useful default value should implement. /// @@ -97,7 +97,7 @@ /// bar: f32, /// } /// ``` -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub trait Default { /// Returns the "default value" for a type. /// @@ -131,16 +131,16 @@ pub trait Default { /// fn default() -> Kind { Kind::A } /// } /// ``` - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] fn default() -> Self; } macro_rules! default_impl { ($t:ty, $v:expr) => { - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] impl Default for $t { #[inline] - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] fn default() -> $t { $v } } } diff --git a/src/libcore/error.rs b/src/libcore/error.rs index 7bb11fb5d92..71d5e88cccf 100644 --- a/src/libcore/error.rs +++ b/src/libcore/error.rs @@ -79,13 +79,14 @@ //! } //! ``` -#![stable] +#![stable(feature = "rust1", since = "1.0.0")] use prelude::*; use fmt::Display; /// Base functionality for all errors in Rust. -#[unstable = "the exact API of this trait may change"] +#[unstable(feature = "core", + reason = "the exact API of this trait may change")] pub trait Error: Display { /// A short description of the error; usually a static string. fn description(&self) -> &str; @@ -95,14 +96,15 @@ pub trait Error: Display { } /// A trait for types that can be converted from a given error type `E`. -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub trait FromError<E> { /// Perform the conversion. + #[stable(feature = "rust1", since = "1.0.0")] fn from_error(err: E) -> Self; } // Any type is convertable from itself -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<E> FromError<E> for E { fn from_error(err: E) -> E { err diff --git a/src/libcore/finally.rs b/src/libcore/finally.rs index ed3612bded0..0f444ef186f 100644 --- a/src/libcore/finally.rs +++ b/src/libcore/finally.rs @@ -30,10 +30,12 @@ //! }) //! ``` -#![deprecated = "It is unclear if this module is more robust than implementing \ - Drop on a custom type, and this module is being removed with no \ - replacement. Use a custom Drop implementation to regain existing \ - functionality."] +#![unstable(feature = "core")] +#![deprecated(since = "1.0.0", + reason = "It is unclear if this module is more robust than implementing \ + Drop on a custom type, and this module is being removed with no \ + replacement. Use a custom Drop implementation to regain existing \ + functionality.")] #![allow(deprecated)] use ops::{Drop, FnMut, FnOnce}; diff --git a/src/libcore/fmt/mod.rs b/src/libcore/fmt/mod.rs index 3c07e2e85d1..06428ad2f39 100644 --- a/src/libcore/fmt/mod.rs +++ b/src/libcore/fmt/mod.rs @@ -11,7 +11,7 @@ //! Utilities for formatting and printing strings #![allow(unused_variables)] -#![stable] +#![stable(feature = "rust1", since = "1.0.0")] use any; use cell::{Cell, RefCell, Ref, RefMut}; @@ -39,7 +39,8 @@ mod num; mod float; pub mod rt; -#[unstable = "core and I/O reconciliation may alter this definition"] +#[unstable(feature = "core", + reason = "core and I/O reconciliation may alter this definition")] /// The type returned by formatter methods. pub type Result = result::Result<(), Error>; @@ -48,7 +49,8 @@ pub type Result = result::Result<(), Error>; /// This type does not support transmission of an error other than that an error /// occurred. Any extra information must be arranged to be transmitted through /// some other means. -#[unstable = "core and I/O reconciliation may alter this definition"] +#[unstable(feature = "core", + reason = "core and I/O reconciliation may alter this definition")] #[derive(Copy, Show)] pub struct Error; @@ -61,7 +63,8 @@ pub struct Error; /// This trait should generally not be implemented by consumers of the standard /// library. The `write!` macro accepts an instance of `io::Writer`, and the /// `io::Writer` trait is favored over implementing this trait. -#[unstable = "waiting for core and I/O reconciliation"] +#[unstable(feature = "core", + reason = "waiting for core and I/O reconciliation")] pub trait Writer { /// Writes a slice of bytes into this writer, returning whether the write /// succeeded. @@ -104,7 +107,8 @@ pub trait Writer { /// A struct to represent both where to emit formatting strings to and how they /// should be formatted. A mutable version of this is passed to all formatting /// traits. -#[unstable = "name may change and implemented traits are also unstable"] +#[unstable(feature = "core", + reason = "name may change and implemented traits are also unstable")] pub struct Formatter<'a> { flags: uint, fill: char, @@ -126,7 +130,8 @@ enum Void {} /// family of functions. It contains a function to format the given value. At /// compile time it is ensured that the function and the value have the correct /// types, and then this struct is used to canonicalize arguments to one type. -#[unstable = "implementation detail of the `format_args!` macro"] +#[unstable(feature = "core", + reason = "implementation detail of the `format_args!` macro")] #[derive(Copy)] pub struct Argument<'a> { value: &'a Void, @@ -165,7 +170,8 @@ impl<'a> Arguments<'a> { /// When using the format_args!() macro, this function is used to generate the /// Arguments structure. #[doc(hidden)] #[inline] - #[unstable = "implementation detail of the `format_args!` macro"] + #[unstable(feature = "core", + reason = "implementation detail of the `format_args!` macro")] pub fn new(pieces: &'a [&'a str], args: &'a [Argument<'a>]) -> Arguments<'a> { Arguments { @@ -182,7 +188,8 @@ impl<'a> Arguments<'a> { /// created with `argumentuint`. However, failing to do so doesn't cause /// unsafety, but will ignore invalid . #[doc(hidden)] #[inline] - #[unstable = "implementation detail of the `format_args!` macro"] + #[unstable(feature = "core", + reason = "implementation detail of the `format_args!` macro")] pub fn with_placeholders(pieces: &'a [&'a str], fmt: &'a [rt::Argument], args: &'a [Argument<'a>]) -> Arguments<'a> { @@ -203,7 +210,7 @@ impl<'a> Arguments<'a> { /// 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` /// and `format` functions can be safely performed. -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] #[derive(Copy)] pub struct Arguments<'a> { // Format string pieces to print. @@ -217,14 +224,14 @@ pub struct Arguments<'a> { args: &'a [Argument<'a>], } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<'a> Debug for Arguments<'a> { fn fmt(&self, fmt: &mut Formatter) -> Result { Display::fmt(self, fmt) } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<'a> Display for Arguments<'a> { fn fmt(&self, fmt: &mut Formatter) -> Result { write(fmt.buf, *self) @@ -233,7 +240,9 @@ impl<'a> Display for Arguments<'a> { /// Format trait for the `:?` format. Useful for debugging, all types /// should implement this. -#[deprecated = "renamed to Debug"] +#[unstable(feature = "core", + reason = "I/O and core have yet to be reconciled")] +#[deprecated(since = "1.0.0", reason = "renamed to Debug")] #[cfg(not(stage0))] pub trait Show { /// Formats the value using the given formatter. @@ -242,7 +251,8 @@ pub trait Show { /// Format trait for the `:?` format. Useful for debugging, all types /// should implement this. -#[unstable = "I/O and core have yet to be reconciled"] +#[unstable(feature = "core", + reason = "I/O and core have yet to be reconciled")] #[rustc_on_unimplemented = "`{Self}` cannot be formatted using `:?`; if it is defined in your \ crate, add `#[derive(Debug)]` or manually implement it"] #[lang = "debug_trait"] @@ -259,7 +269,8 @@ impl<T: Show + ?Sized> Debug for T { /// When a value can be semantically expressed as a String, this trait may be /// used. It corresponds to the default format, `{}`. -#[deprecated = "renamed to Display"] +#[unstable(feature = "core")] +#[deprecated(since = "1.0.0", reason = "renamed to Display")] #[cfg(not(stage0))] pub trait String { /// Formats the value using the given formatter. @@ -268,7 +279,8 @@ pub trait String { /// When a value can be semantically expressed as a String, this trait may be /// used. It corresponds to the default format, `{}`. -#[unstable = "I/O and core have yet to be reconciled"] +#[unstable(feature = "core", + reason = "I/O and core have yet to be reconciled")] #[rustc_on_unimplemented = "`{Self}` cannot be formatted with the default formatter; try using \ `:?` instead if you are using a format string"] pub trait Display { @@ -283,49 +295,56 @@ impl<T: String + ?Sized> Display for T { } /// Format trait for the `o` character -#[unstable = "I/O and core have yet to be reconciled"] +#[unstable(feature = "core", + reason = "I/O and core have yet to be reconciled")] pub trait Octal { /// Formats the value using the given formatter. fn fmt(&self, &mut Formatter) -> Result; } /// Format trait for the `b` character -#[unstable = "I/O and core have yet to be reconciled"] +#[unstable(feature = "core", + reason = "I/O and core have yet to be reconciled")] pub trait Binary { /// Formats the value using the given formatter. fn fmt(&self, &mut Formatter) -> Result; } /// Format trait for the `x` character -#[unstable = "I/O and core have yet to be reconciled"] +#[unstable(feature = "core", + reason = "I/O and core have yet to be reconciled")] pub trait LowerHex { /// Formats the value using the given formatter. fn fmt(&self, &mut Formatter) -> Result; } /// Format trait for the `X` character -#[unstable = "I/O and core have yet to be reconciled"] +#[unstable(feature = "core", + reason = "I/O and core have yet to be reconciled")] pub trait UpperHex { /// Formats the value using the given formatter. fn fmt(&self, &mut Formatter) -> Result; } /// Format trait for the `p` character -#[unstable = "I/O and core have yet to be reconciled"] +#[unstable(feature = "core", + reason = "I/O and core have yet to be reconciled")] pub trait Pointer { /// Formats the value using the given formatter. fn fmt(&self, &mut Formatter) -> Result; } /// Format trait for the `e` character -#[unstable = "I/O and core have yet to be reconciled"] +#[unstable(feature = "core", + reason = "I/O and core have yet to be reconciled")] pub trait LowerExp { /// Formats the value using the given formatter. fn fmt(&self, &mut Formatter) -> Result; } /// Format trait for the `E` character -#[unstable = "I/O and core have yet to be reconciled"] +#[unstable(feature = "core", + reason = "I/O and core have yet to be reconciled")] pub trait UpperExp { /// Formats the value using the given formatter. fn fmt(&self, &mut Formatter) -> Result; @@ -339,8 +358,9 @@ pub trait UpperExp { /// /// * output - the buffer to write output to /// * args - the precompiled arguments generated by `format_args!` -#[unstable = "libcore and I/O have yet to be reconciled, and this is an \ - implementation detail which should not otherwise be exported"] +#[unstable(feature = "core", + reason = "libcore and I/O have yet to be reconciled, and this is an \ + implementation detail which should not otherwise be exported")] pub fn write(output: &mut Writer, args: Arguments) -> Result { let mut formatter = Formatter { flags: 0, @@ -436,7 +456,8 @@ impl<'a> Formatter<'a> { /// /// This function will correctly account for the flags provided as well as /// the minimum width. It will not take precision into account. - #[unstable = "definition may change slightly over time"] + #[unstable(feature = "core", + reason = "definition may change slightly over time")] pub fn pad_integral(&mut self, is_positive: bool, prefix: &str, @@ -512,7 +533,8 @@ impl<'a> Formatter<'a> { /// is longer than this length /// /// Notably this function ignored the `flag` parameters - #[unstable = "definition may change slightly over time"] + #[unstable(feature = "core", + reason = "definition may change slightly over time")] pub fn pad(&mut self, s: &str) -> Result { // Make sure there's a fast path up front if self.width.is_none() && self.precision.is_none() { @@ -589,39 +611,42 @@ impl<'a> Formatter<'a> { /// Writes some data to the underlying buffer contained within this /// formatter. - #[unstable = "reconciling core and I/O may alter this definition"] + #[unstable(feature = "core", + reason = "reconciling core and I/O may alter this definition")] pub fn write_str(&mut self, data: &str) -> Result { self.buf.write_str(data) } /// Writes some formatted information into this instance - #[unstable = "reconciling core and I/O may alter this definition"] + #[unstable(feature = "core", + reason = "reconciling core and I/O may alter this definition")] pub fn write_fmt(&mut self, fmt: Arguments) -> Result { write(self.buf, fmt) } /// Flags for formatting (packed version of rt::Flag) - #[unstable = "return type may change and method was just created"] + #[unstable(feature = "core", + reason = "return type may change and method was just created")] pub fn flags(&self) -> uint { self.flags } /// Character used as 'fill' whenever there is alignment - #[unstable = "method was just created"] + #[unstable(feature = "core", reason = "method was just created")] pub fn fill(&self) -> char { self.fill } /// Flag indicating what form of alignment was requested - #[unstable = "method was just created"] + #[unstable(feature = "core", reason = "method was just created")] pub fn align(&self) -> rt::Alignment { self.align } /// Optionally specified integer width that the output should be - #[unstable = "method was just created"] + #[unstable(feature = "core", reason = "method was just created")] pub fn width(&self) -> Option<uint> { self.width } /// Optionally specified precision for numeric types - #[unstable = "method was just created"] + #[unstable(feature = "core", reason = "method was just created")] pub fn precision(&self) -> Option<uint> { self.precision } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl Display for Error { fn fmt(&self, f: &mut Formatter) -> Result { Display::fmt("an error occurred when formatting an argument", f) @@ -631,7 +656,8 @@ impl Display for Error { /// This is a function which calls are emitted to by the compiler itself to /// create the Argument structures that are passed into the `format` function. #[doc(hidden)] #[inline] -#[unstable = "implementation detail of the `format_args!` macro"] +#[unstable(feature = "core", + reason = "implementation detail of the `format_args!` macro")] pub fn argument<'a, T>(f: fn(&T, &mut Formatter) -> Result, t: &'a T) -> Argument<'a> { Argument::new(t, f) @@ -640,7 +666,8 @@ pub fn argument<'a, T>(f: fn(&T, &mut Formatter) -> Result, /// When the compiler determines that the type of an argument *must* be a uint /// (such as for width and precision), then it invokes this method. #[doc(hidden)] #[inline] -#[unstable = "implementation detail of the `format_args!` macro"] +#[unstable(feature = "core", + reason = "implementation detail of the `format_args!` macro")] pub fn argumentuint<'a>(s: &'a uint) -> Argument<'a> { Argument::from_uint(s) } @@ -650,11 +677,11 @@ pub fn argumentuint<'a>(s: &'a uint) -> Argument<'a> { macro_rules! fmt_refs { ($($tr:ident),*) => { $( - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] impl<'a, T: ?Sized + $tr> $tr for &'a T { fn fmt(&self, f: &mut Formatter) -> Result { $tr::fmt(&**self, f) } } - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] impl<'a, T: ?Sized + $tr> $tr for &'a mut T { fn fmt(&self, f: &mut Formatter) -> Result { $tr::fmt(&**self, f) } } @@ -664,21 +691,21 @@ macro_rules! fmt_refs { fmt_refs! { Debug, Display, Octal, Binary, LowerHex, UpperHex, LowerExp, UpperExp } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl Debug for bool { fn fmt(&self, f: &mut Formatter) -> Result { Display::fmt(self, f) } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl Display for bool { fn fmt(&self, f: &mut Formatter) -> Result { Display::fmt(if *self { "true" } else { "false" }, f) } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl Debug for str { fn fmt(&self, f: &mut Formatter) -> Result { try!(write!(f, "\"")); @@ -689,14 +716,14 @@ impl Debug for str { } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl Display for str { fn fmt(&self, f: &mut Formatter) -> Result { f.pad(self) } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl Debug for char { fn fmt(&self, f: &mut Formatter) -> Result { use char::CharExt; @@ -708,7 +735,7 @@ impl Debug for char { } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl Display for char { fn fmt(&self, f: &mut Formatter) -> Result { let mut utf8 = [0u8; 4]; @@ -718,7 +745,7 @@ impl Display for char { } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<T> Pointer for *const T { fn fmt(&self, f: &mut Formatter) -> Result { f.flags |= 1 << (rt::FlagAlternate as uint); @@ -728,21 +755,21 @@ impl<T> Pointer for *const T { } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<T> Pointer for *mut T { fn fmt(&self, f: &mut Formatter) -> Result { Pointer::fmt(&(*self as *const T), f) } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<'a, T> Pointer for &'a T { fn fmt(&self, f: &mut Formatter) -> Result { Pointer::fmt(&(*self as *const T), f) } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<'a, T> Pointer for &'a mut T { fn fmt(&self, f: &mut Formatter) -> Result { Pointer::fmt(&(&**self as *const T), f) @@ -751,14 +778,14 @@ impl<'a, T> Pointer for &'a mut T { macro_rules! floating { ($ty:ident) => { - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] impl Debug for $ty { fn fmt(&self, fmt: &mut Formatter) -> Result { Display::fmt(self, fmt) } } - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] impl Display for $ty { fn fmt(&self, fmt: &mut Formatter) -> Result { use num::Float; @@ -780,7 +807,7 @@ macro_rules! floating { ($ty:ident) => { } } - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] impl LowerExp for $ty { fn fmt(&self, fmt: &mut Formatter) -> Result { use num::Float; @@ -802,7 +829,7 @@ macro_rules! floating { ($ty:ident) => { } } - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] impl UpperExp for $ty { fn fmt(&self, fmt: &mut Formatter) -> Result { use num::Float; @@ -829,11 +856,11 @@ floating! { f64 } // Implementation of Display/Debug for various core types -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<T> Debug for *const T { fn fmt(&self, f: &mut Formatter) -> Result { Pointer::fmt(self, f) } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<T> Debug for *mut T { fn fmt(&self, f: &mut Formatter) -> Result { Pointer::fmt(self, f) } } @@ -845,7 +872,7 @@ macro_rules! peel { macro_rules! tuple { () => (); ( $($name:ident,)+ ) => ( - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] impl<$($name:Debug),*> Debug for ($($name,)*) { #[allow(non_snake_case, unused_assignments)] fn fmt(&self, f: &mut Formatter) -> Result { @@ -871,12 +898,12 @@ macro_rules! tuple { tuple! { T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<'a> Debug for &'a (any::Any+'a) { fn fmt(&self, f: &mut Formatter) -> Result { f.pad("&Any") } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<T: Debug> Debug for [T] { fn fmt(&self, f: &mut Formatter) -> Result { if f.flags & (1 << (rt::FlagAlternate as uint)) == 0 { @@ -898,21 +925,21 @@ impl<T: Debug> Debug for [T] { } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl Debug for () { fn fmt(&self, f: &mut Formatter) -> Result { f.pad("()") } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<T: Copy + Debug> Debug for Cell<T> { fn fmt(&self, f: &mut Formatter) -> Result { write!(f, "Cell {{ value: {:?} }}", self.get()) } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<T: Debug> Debug for RefCell<T> { fn fmt(&self, f: &mut Formatter) -> Result { match self.try_borrow() { @@ -922,14 +949,14 @@ impl<T: Debug> Debug for RefCell<T> { } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<'b, T: Debug> Debug for Ref<'b, T> { fn fmt(&self, f: &mut Formatter) -> Result { Debug::fmt(&**self, f) } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<'b, T: Debug> Debug for RefMut<'b, T> { fn fmt(&self, f: &mut Formatter) -> Result { Debug::fmt(&*(self.deref()), f) diff --git a/src/libcore/fmt/num.rs b/src/libcore/fmt/num.rs index a659a9988bb..1222126b5e0 100644 --- a/src/libcore/fmt/num.rs +++ b/src/libcore/fmt/num.rs @@ -111,7 +111,8 @@ radix! { UpperHex, 16, "0x", x @ 0 ... 9 => b'0' + x, /// A radix with in the range of `2..36`. #[derive(Clone, Copy, PartialEq)] -#[unstable = "may be renamed or move to a different module"] +#[unstable(feature = "core", + reason = "may be renamed or move to a different module")] pub struct Radix { base: u8, } @@ -135,7 +136,8 @@ impl GenericRadix for Radix { } /// A helper type for formatting radixes. -#[unstable = "may be renamed or move to a different module"] +#[unstable(feature = "core", + reason = "may be renamed or move to a different module")] #[derive(Copy)] pub struct RadixFmt<T, R>(T, R); @@ -147,20 +149,21 @@ pub struct RadixFmt<T, R>(T, R); /// use std::fmt::radix; /// assert_eq!(format!("{}", radix(55, 36)), "1j".to_string()); /// ``` -#[unstable = "may be renamed or move to a different module"] +#[unstable(feature = "core", + reason = "may be renamed or move to a different module")] pub fn radix<T>(x: T, base: u8) -> RadixFmt<T, Radix> { RadixFmt(x, Radix::new(base)) } macro_rules! radix_fmt { ($T:ty as $U:ty, $fmt:ident, $S:expr) => { - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] impl fmt::Debug for RadixFmt<$T, Radix> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fmt::Display::fmt(self, f) } } - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] impl fmt::Display for RadixFmt<$T, Radix> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { match *self { RadixFmt(ref x, radix) => radix.$fmt(*x as $U, f) } @@ -170,7 +173,7 @@ macro_rules! radix_fmt { } macro_rules! int_base { ($Trait:ident for $T:ident as $U:ident -> $Radix:ident) => { - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] impl fmt::$Trait for $T { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { $Radix.fmt_int(*self as $U, f) @@ -181,7 +184,7 @@ macro_rules! int_base { macro_rules! show { ($T:ident with $S:expr) => { - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] impl fmt::Debug for $T { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fmt::Display::fmt(self, f) diff --git a/src/libcore/fmt/rt.rs b/src/libcore/fmt/rt.rs index bea32219155..0b2c1efbc5d 100644 --- a/src/libcore/fmt/rt.rs +++ b/src/libcore/fmt/rt.rs @@ -14,7 +14,8 @@ //! These definitions are similar to their `ct` equivalents, but differ in that //! these can be statically allocated and are slightly optimized for the runtime -#![unstable = "implementation detail of the `format_args!` macro"] +#![unstable(feature = "core", + reason = "implementation detail of the `format_args!` macro")] pub use self::Alignment::*; pub use self::Count::*; diff --git a/src/libcore/hash/mod.rs b/src/libcore/hash/mod.rs index 742e6239017..5a4d2fffade 100644 --- a/src/libcore/hash/mod.rs +++ b/src/libcore/hash/mod.rs @@ -56,7 +56,8 @@ //! assert_eq!(hash::<_, SipHasher>(&person1), hash::<_, SipHasher>(&person2)); //! ``` -#![unstable = "module was recently redesigned"] +#![unstable(feature = "hash", + reason = "module was recently redesigned")] use prelude::*; @@ -95,7 +96,8 @@ pub trait Hasher { /// A common bound on the `Hasher` parameter to `Hash` implementations in order /// to generically hash an aggregate. -#[experimental = "this trait will likely be replaced by io::Writer"] +#[unstable(feature = "hash", + reason = "this trait will likely be replaced by io::Writer")] #[allow(missing_docs)] pub trait Writer { fn write(&mut self, bytes: &[u8]); diff --git a/src/libcore/hash/sip.rs b/src/libcore/hash/sip.rs index 8840eaf5fbc..bef196d4824 100644 --- a/src/libcore/hash/sip.rs +++ b/src/libcore/hash/sip.rs @@ -112,7 +112,8 @@ impl SipHasher { } /// Returns the computed hash. - #[deprecated = "renamed to finish"] + #[unstable(feature = "hash")] + #[deprecated(since = "1.0.0", reason = "renamed to finish")] pub fn result(&self) -> u64 { self.finish() } } diff --git a/src/libcore/intrinsics.rs b/src/libcore/intrinsics.rs index dd488a74216..dd6b1e7b4e8 100644 --- a/src/libcore/intrinsics.rs +++ b/src/libcore/intrinsics.rs @@ -39,7 +39,7 @@ //! guaranteed to happen in order. This is the standard mode for working //! with atomic types and is equivalent to Java's `volatile`. -#![unstable] +#![unstable(feature = "core")] #![allow(missing_docs)] use marker::Sized; @@ -221,7 +221,7 @@ extern "rust-intrinsic" { /// /// `forget` is unsafe because the caller is responsible for /// ensuring the argument is deallocated already. - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] pub fn forget<T>(_: T) -> (); /// Unsafely transforms a value of one type into a value of another type. @@ -237,7 +237,7 @@ extern "rust-intrinsic" { /// let v: &[u8] = unsafe { mem::transmute("L") }; /// assert!(v == [76u8]); /// ``` - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] pub fn transmute<T,U>(e: T) -> U; /// Gives the address for the return value of the enclosing function. @@ -297,7 +297,7 @@ extern "rust-intrinsic" { /// } /// } /// ``` - #[unstable] + #[unstable(feature = "core")] pub fn copy_nonoverlapping_memory<T>(dst: *mut T, src: *const T, count: uint); /// Copies `count * size_of<T>` bytes from `src` to `dst`. The source @@ -327,12 +327,13 @@ extern "rust-intrinsic" { /// } /// ``` /// - #[unstable] + #[unstable(feature = "core")] pub fn copy_memory<T>(dst: *mut T, src: *const T, count: uint); /// Invokes memset on the specified pointer, setting `count * size_of::<T>()` /// bytes of memory starting at `dst` to `c`. - #[unstable = "uncertain about naming and semantics"] + #[unstable(feature = "core", + reason = "uncertain about naming and semantics")] pub fn set_memory<T>(dst: *mut T, val: u8, count: uint); /// Equivalent to the appropriate `llvm.memcpy.p0i8.0i8.*` intrinsic, with diff --git a/src/libcore/iter.rs b/src/libcore/iter.rs index 4910c03de5c..74d8a7ae1d6 100644 --- a/src/libcore/iter.rs +++ b/src/libcore/iter.rs @@ -54,7 +54,7 @@ //! //! This `for` loop syntax can be applied to any iterator over any type. -#![stable] +#![stable(feature = "rust1", since = "1.0.0")] use self::MinMaxResult::*; @@ -81,15 +81,15 @@ use usize; /// it wishes, either by returning `None` infinitely, or by doing something /// else. #[lang="iterator"] -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] #[rustc_on_unimplemented = "`{Self}` is not an iterator; maybe try calling `.iter()` or a similar \ method"] pub trait Iterator { - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] type Item; /// Advance the iterator and return the next value. Return `None` when the end is reached. - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] fn next(&mut self) -> Option<Self::Item>; /// Returns a lower and upper bound on the remaining length of the iterator. @@ -97,7 +97,7 @@ pub trait Iterator { /// An upper bound of `None` means either there is no known upper bound, or the upper bound /// does not fit within a `usize`. #[inline] - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] fn size_hint(&self) -> (usize, Option<usize>) { (0, None) } } @@ -116,7 +116,7 @@ impl<'a, T> Iterator for &'a mut (Iterator<Item=T> + 'a) { } /// Conversion from an `Iterator` -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] #[rustc_on_unimplemented="a collection of type `{Self}` cannot be \ built from an iterator over elements of type `{A}`"] pub trait FromIterator<A> { @@ -125,15 +125,15 @@ pub trait FromIterator<A> { } /// A type growable from an `Iterator` implementation -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub trait Extend<A> { /// Extend a container with the elements yielded by an arbitrary iterator - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] fn extend<T: Iterator<Item=A>>(&mut self, iterator: T); } /// An extension trait providing numerous methods applicable to all iterators. -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub trait IteratorExt: Iterator + Sized { /// Counts the number of elements in this iterator. /// @@ -144,7 +144,7 @@ pub trait IteratorExt: Iterator + Sized { /// assert_eq!(a.iter().count(), 5); /// ``` #[inline] - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] fn count(self) -> usize { self.fold(0, |cnt, _x| cnt + 1) } @@ -159,7 +159,7 @@ pub trait IteratorExt: Iterator + Sized { /// assert!(a.iter().last().unwrap() == &5); /// ``` #[inline] - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] fn last(mut self) -> Option<Self::Item> { let mut last = None; for x in self { last = Some(x); } @@ -178,7 +178,7 @@ pub trait IteratorExt: Iterator + Sized { /// assert!(it.nth(2) == None); /// ``` #[inline] - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] fn nth(&mut self, mut n: usize) -> Option<Self::Item> { for x in *self { if n == 0 { return Some(x) } @@ -202,7 +202,7 @@ pub trait IteratorExt: Iterator + Sized { /// assert!(it.next().is_none()); /// ``` #[inline] - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] fn chain<U>(self, other: U) -> Chain<Self, U> where U: Iterator<Item=Self::Item>, { @@ -224,7 +224,7 @@ pub trait IteratorExt: Iterator + Sized { /// assert!(it.next().is_none()); /// ``` #[inline] - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] fn zip<B, U>(self, other: U) -> Zip<Self, U> where U: Iterator<Item=B>, { @@ -244,7 +244,7 @@ pub trait IteratorExt: Iterator + Sized { /// assert!(it.next().is_none()); /// ``` #[inline] - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] fn map<B, F>(self, f: F) -> Map<Self::Item, B, Self, F> where F: FnMut(Self::Item) -> B, { @@ -264,7 +264,7 @@ pub trait IteratorExt: Iterator + Sized { /// assert!(it.next().is_none()); /// ``` #[inline] - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] fn filter<P>(self, predicate: P) -> Filter<Self::Item, Self, P> where P: FnMut(&Self::Item) -> bool, { @@ -284,7 +284,7 @@ pub trait IteratorExt: Iterator + Sized { /// assert!(it.next().is_none()); /// ``` #[inline] - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] fn filter_map<B, F>(self, f: F) -> FilterMap<Self::Item, B, Self, F> where F: FnMut(Self::Item) -> Option<B>, { @@ -304,7 +304,7 @@ pub trait IteratorExt: Iterator + Sized { /// assert!(it.next().is_none()); /// ``` #[inline] - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] fn enumerate(self) -> Enumerate<Self> { Enumerate{iter: self, count: 0} } @@ -327,7 +327,7 @@ pub trait IteratorExt: Iterator + Sized { /// assert!(it.next().is_none()); /// ``` #[inline] - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] fn peekable(self) -> Peekable<Self::Item, Self> { Peekable{iter: self, peeked: None} } @@ -347,7 +347,7 @@ pub trait IteratorExt: Iterator + Sized { /// assert!(it.next().is_none()); /// ``` #[inline] - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] fn skip_while<P>(self, predicate: P) -> SkipWhile<Self::Item, Self, P> where P: FnMut(&Self::Item) -> bool, { @@ -368,7 +368,7 @@ pub trait IteratorExt: Iterator + Sized { /// assert!(it.next().is_none()); /// ``` #[inline] - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] fn take_while<P>(self, predicate: P) -> TakeWhile<Self::Item, Self, P> where P: FnMut(&Self::Item) -> bool, { @@ -388,7 +388,7 @@ pub trait IteratorExt: Iterator + Sized { /// assert!(it.next().is_none()); /// ``` #[inline] - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] fn skip(self, n: usize) -> Skip<Self> { Skip{iter: self, n: n} } @@ -407,7 +407,7 @@ pub trait IteratorExt: Iterator + Sized { /// assert!(it.next().is_none()); /// ``` #[inline] - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] fn take(self, n: usize) -> Take<Self> { Take{iter: self, n: n} } @@ -433,7 +433,7 @@ pub trait IteratorExt: Iterator + Sized { /// assert!(it.next().is_none()); /// ``` #[inline] - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] fn scan<St, B, F>( self, initial_state: St, @@ -459,7 +459,7 @@ pub trait IteratorExt: Iterator + Sized { /// } /// ``` #[inline] - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] fn flat_map<B, U, F>(self, f: F) -> FlatMap<Self::Item, B, Self, U, F> where U: Iterator<Item=B>, F: FnMut(Self::Item) -> U, @@ -495,7 +495,7 @@ pub trait IteratorExt: Iterator + Sized { /// assert_eq!(process(x.into_iter()), 1006); /// ``` #[inline] - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] fn fuse(self) -> Fuse<Self> { Fuse{iter: self, done: false} } @@ -519,7 +519,7 @@ pub trait IteratorExt: Iterator + Sized { /// println!("{}", sum); /// ``` #[inline] - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] fn inspect<F>(self, f: F) -> Inspect<Self::Item, Self, F> where F: FnMut(&Self::Item), { @@ -540,7 +540,7 @@ pub trait IteratorExt: Iterator + Sized { /// assert!(partial_sum == 10); /// assert!(it.next() == Some(5)); /// ``` - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] fn by_ref<'r>(&'r mut self) -> ByRef<'r, Self> { ByRef{iter: self} } @@ -556,7 +556,7 @@ pub trait IteratorExt: Iterator + Sized { /// assert_eq!(a, b); /// ``` #[inline] - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] fn collect<B: FromIterator<Self::Item>>(self) -> B { FromIterator::from_iter(self) } @@ -572,7 +572,8 @@ pub trait IteratorExt: Iterator + Sized { /// assert_eq!(even, vec![2, 4]); /// assert_eq!(odd, vec![1, 3]); /// ``` - #[unstable = "recently added as part of collections reform"] + #[unstable(feature = "core", + reason = "recently added as part of collections reform")] fn partition<B, F>(mut self, mut f: F) -> (B, B) where B: Default + Extend<Self::Item>, F: FnMut(&Self::Item) -> bool @@ -601,7 +602,7 @@ pub trait IteratorExt: Iterator + Sized { /// assert!(a.iter().fold(0, |a, &b| a + b) == 15); /// ``` #[inline] - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] fn fold<B, F>(mut self, init: B, mut f: F) -> B where F: FnMut(B, Self::Item) -> B, { @@ -622,7 +623,7 @@ pub trait IteratorExt: Iterator + Sized { /// assert!(!a.iter().all(|x| *x > 2)); /// ``` #[inline] - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] fn all<F>(mut self, mut f: F) -> bool where F: FnMut(Self::Item) -> bool { for x in self { if !f(x) { return false; } } true @@ -642,7 +643,7 @@ pub trait IteratorExt: Iterator + Sized { /// /// ``` #[inline] - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] fn any<F>(&mut self, mut f: F) -> bool where F: FnMut(Self::Item) -> bool { for x in *self { if f(x) { return true; } } false @@ -660,7 +661,7 @@ pub trait IteratorExt: Iterator + Sized { /// assert_eq!(it.find(|&x| *x == 3).unwrap(), &3); /// assert_eq!(it.as_slice(), [4, 5]); #[inline] - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] fn find<P>(&mut self, mut predicate: P) -> Option<Self::Item> where P: FnMut(&Self::Item) -> bool, { @@ -682,7 +683,7 @@ pub trait IteratorExt: Iterator + Sized { /// assert_eq!(it.position(|x| *x == 3).unwrap(), 2); /// assert_eq!(it.as_slice(), [4, 5]); #[inline] - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] fn position<P>(&mut self, mut predicate: P) -> Option<usize> where P: FnMut(Self::Item) -> bool, { @@ -710,7 +711,7 @@ pub trait IteratorExt: Iterator + Sized { /// assert_eq!(it.rposition(|x| *x == 2).unwrap(), 2); /// assert_eq!(it.as_slice(), [1, 2]); #[inline] - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] fn rposition<P>(&mut self, mut predicate: P) -> Option<usize> where P: FnMut(Self::Item) -> bool, Self: ExactSizeIterator + DoubleEndedIterator @@ -733,7 +734,7 @@ pub trait IteratorExt: Iterator + Sized { /// assert!(a.iter().max().unwrap() == &5); /// ``` #[inline] - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] fn max(self) -> Option<Self::Item> where Self::Item: Ord { self.fold(None, |max, x| { @@ -753,7 +754,7 @@ pub trait IteratorExt: Iterator + Sized { /// assert!(a.iter().min().unwrap() == &1); /// ``` #[inline] - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] fn min(self) -> Option<Self::Item> where Self::Item: Ord { self.fold(None, |min, x| { @@ -794,7 +795,7 @@ pub trait IteratorExt: Iterator + Sized { /// let a = [1, 1, 1, 1]; /// assert!(a.iter().min_max() == MinMax(&1, &1)); /// ``` - #[unstable = "return type may change"] + #[unstable(feature = "core", reason = "return type may change")] fn min_max(mut self) -> MinMaxResult<Self::Item> where Self::Item: Ord { let (mut min, mut max) = match self.next() { @@ -851,7 +852,8 @@ pub trait IteratorExt: Iterator + Sized { /// assert_eq!(*a.iter().max_by(|x| x.abs()).unwrap(), -10); /// ``` #[inline] - #[unstable = "may want to produce an Ordering directly; see #15311"] + #[unstable(feature = "core", + reason = "may want to produce an Ordering directly; see #15311")] fn max_by<B: Ord, F>(self, mut f: F) -> Option<Self::Item> where F: FnMut(&Self::Item) -> B, { @@ -880,7 +882,8 @@ pub trait IteratorExt: Iterator + Sized { /// assert_eq!(*a.iter().min_by(|x| x.abs()).unwrap(), 0); /// ``` #[inline] - #[unstable = "may want to produce an Ordering directly; see #15311"] + #[unstable(feature = "core", + reason = "may want to produce an Ordering directly; see #15311")] fn min_by<B: Ord, F>(self, mut f: F) -> Option<Self::Item> where F: FnMut(&Self::Item) -> B, { @@ -910,7 +913,7 @@ pub trait IteratorExt: Iterator + Sized { /// Note: Random access with flipped indices still only applies to the first /// `std::usize::MAX` elements of the original iterator. #[inline] - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] fn rev(self) -> Rev<Self> { Rev{iter: self} } @@ -928,7 +931,7 @@ pub trait IteratorExt: Iterator + Sized { /// assert_eq!([1, 3], left); /// assert_eq!([2, 4], right); /// ``` - #[unstable = "recent addition"] + #[unstable(feature = "core", reason = "recent addition")] fn unzip<A, B, FromA, FromB>(mut self) -> (FromA, FromB) where FromA: Default + Extend<A>, FromB: Default + Extend<B>, @@ -961,7 +964,7 @@ pub trait IteratorExt: Iterator + Sized { /// Creates an iterator that clones the elements it yields. Useful for converting an /// Iterator<&T> to an Iterator<T>. - #[unstable = "recent addition"] + #[unstable(feature = "core", reason = "recent addition")] fn cloned<T, D>(self) -> Cloned<Self> where Self: Iterator<Item=D>, D: Deref<Target=T>, @@ -981,14 +984,15 @@ pub trait IteratorExt: Iterator + Sized { /// assert_eq!(it.next().unwrap(), &2); /// assert_eq!(it.next().unwrap(), &1); /// ``` - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] #[inline] fn cycle(self) -> Cycle<Self> where Self: Clone { Cycle{orig: self.clone(), iter: self} } /// Use an iterator to reverse a container in place. - #[unstable = "uncertain about placement or widespread use"] + #[unstable(feature = "core", + reason = "uncertain about placement or widespread use")] fn reverse_in_place<'a, T: 'a>(&mut self) where Self: Iterator<Item=&'a mut T> + DoubleEndedIterator { @@ -1001,17 +1005,17 @@ pub trait IteratorExt: Iterator + Sized { } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<I> IteratorExt for I where I: Iterator {} /// 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 /// elements from the *same* range, and do not work independently of each other. -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub trait DoubleEndedIterator: Iterator { /// Yield an element from the end of the range, returning `None` if the range is empty. - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] fn next_back(&mut self) -> Option<Self::Item>; } @@ -1021,7 +1025,8 @@ pub trait DoubleEndedIterator: Iterator { /// Calling `next()` or `next_back()` on a `RandomAccessIterator` /// reduces the indexable range accordingly. That is, `it.idx(1)` will become `it.idx(0)` /// after `it.next()` is called. -#[unstable = "not widely used, may be better decomposed into Index and ExactSizeIterator"] +#[unstable(feature = "core", + reason = "not widely used, may be better decomposed into Index and ExactSizeIterator")] pub trait RandomAccessIterator: Iterator { /// Return the number of indexable elements. At most `std::usize::MAX` /// elements are indexable, even if the iterator represents a longer range. @@ -1038,7 +1043,7 @@ pub trait RandomAccessIterator: Iterator { /// /// `Iterator::size_hint` *must* return the exact size of the iterator. /// Note that the size must fit in `usize`. -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub trait ExactSizeIterator: Iterator { #[inline] /// Return the exact length of the iterator. @@ -1055,32 +1060,32 @@ pub trait ExactSizeIterator: Iterator { // All adaptors that preserve the size of the wrapped iterator are fine // Adaptors that may overflow in `size_hint` are not, i.e. `Chain`. -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<I> ExactSizeIterator for Enumerate<I> where I: ExactSizeIterator {} -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<A, I, F> ExactSizeIterator for Inspect<A, I, F> where I: ExactSizeIterator<Item=A>, F: FnMut(&A), {} -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<I> ExactSizeIterator for Rev<I> where I: ExactSizeIterator + DoubleEndedIterator {} -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<A, B, I, F> ExactSizeIterator for Map<A, B, I, F> where I: ExactSizeIterator<Item=A>, F: FnMut(A) -> B, {} -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<A, B> ExactSizeIterator for Zip<A, B> where A: ExactSizeIterator, B: ExactSizeIterator {} /// An double-ended iterator with the direction inverted #[derive(Clone)] #[must_use = "iterator adaptors are lazy and do nothing unless consumed"] -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub struct Rev<T> { iter: T } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<I> Iterator for Rev<I> where I: DoubleEndedIterator { type Item = <I as Iterator>::Item; @@ -1090,13 +1095,13 @@ impl<I> Iterator for Rev<I> where I: DoubleEndedIterator { fn size_hint(&self) -> (usize, Option<usize>) { self.iter.size_hint() } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<I> DoubleEndedIterator for Rev<I> where I: DoubleEndedIterator { #[inline] fn next_back(&mut self) -> Option<<I as Iterator>::Item> { self.iter.next() } } -#[unstable = "trait is experimental"] +#[unstable(feature = "core", reason = "trait is experimental")] impl<I> RandomAccessIterator for Rev<I> where I: DoubleEndedIterator + RandomAccessIterator { #[inline] fn indexable(&self) -> usize { self.iter.indexable() } @@ -1109,12 +1114,12 @@ impl<I> RandomAccessIterator for Rev<I> where I: DoubleEndedIterator + RandomAcc /// A mutable reference to an iterator #[must_use = "iterator adaptors are lazy and do nothing unless consumed"] -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub struct ByRef<'a, I:'a> { iter: &'a mut I, } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<'a, I> Iterator for ByRef<'a, I> where I: 'a + Iterator { type Item = <I as Iterator>::Item; @@ -1124,17 +1129,18 @@ impl<'a, I> Iterator for ByRef<'a, I> where I: 'a + Iterator { fn size_hint(&self) -> (usize, Option<usize>) { self.iter.size_hint() } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<'a, I> DoubleEndedIterator for ByRef<'a, I> where I: 'a + DoubleEndedIterator { #[inline] fn next_back(&mut self) -> Option<<I as Iterator>::Item> { self.iter.next_back() } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<'a, I> ExactSizeIterator for ByRef<'a, I> where I: 'a + ExactSizeIterator {} /// A trait for iterators over elements which can be added together -#[unstable = "needs to be re-evaluated as part of numerics reform"] +#[unstable(feature = "core", + reason = "needs to be re-evaluated as part of numerics reform")] pub trait AdditiveIterator<A> { /// Iterates over the entire iterator, summing up all the elements /// @@ -1152,7 +1158,7 @@ pub trait AdditiveIterator<A> { macro_rules! impl_additive { ($A:ty, $init:expr) => { - #[unstable = "trait is experimental"] + #[unstable(feature = "core", reason = "trait is experimental")] impl<T: Iterator<Item=$A>> AdditiveIterator<$A> for T { #[inline] fn sum(self) -> $A { @@ -1175,7 +1181,8 @@ impl_additive! { f32, 0.0 } impl_additive! { f64, 0.0 } /// A trait for iterators over elements which can be multiplied together. -#[unstable = "needs to be re-evaluated as part of numerics reform"] +#[unstable(feature = "core", + reason = "needs to be re-evaluated as part of numerics reform")] pub trait MultiplicativeIterator<A> { /// Iterates over the entire iterator, multiplying all the elements /// @@ -1196,7 +1203,7 @@ pub trait MultiplicativeIterator<A> { macro_rules! impl_multiplicative { ($A:ty, $init:expr) => { - #[unstable = "trait is experimental"] + #[unstable(feature = "core", reason = "trait is experimental")] impl<T: Iterator<Item=$A>> MultiplicativeIterator<$A> for T { #[inline] fn product(self) -> $A { @@ -1220,7 +1227,8 @@ impl_multiplicative! { f64, 1.0 } /// `MinMaxResult` is an enum returned by `min_max`. See `IteratorOrdExt::min_max` for more detail. #[derive(Clone, PartialEq, Show)] -#[unstable = "unclear whether such a fine-grained result is widely useful"] +#[unstable(feature = "core", + reason = "unclear whether such a fine-grained result is widely useful")] pub enum MinMaxResult<T> { /// Empty iterator NoElements, @@ -1252,7 +1260,7 @@ impl<T: Clone> MinMaxResult<T> { /// let r = MinMax(1, 2); /// assert_eq!(r.into_option(), Some((1, 2))); /// ``` - #[unstable = "type is unstable"] + #[unstable(feature = "core", reason = "type is unstable")] pub fn into_option(self) -> Option<(T,T)> { match self { NoElements => None, @@ -1263,14 +1271,14 @@ impl<T: Clone> MinMaxResult<T> { } /// An iterator that clones the elements of an underlying iterator -#[unstable = "recent addition"] +#[unstable(feature = "core", reason = "recent addition")] #[must_use = "iterator adaptors are lazy and do nothing unless consumed"] #[derive(Clone)] pub struct Cloned<I> { it: I, } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<T, D, I> Iterator for Cloned<I> where T: Clone, D: Deref<Target=T>, @@ -1287,7 +1295,7 @@ impl<T, D, I> Iterator for Cloned<I> where } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<T, D, I> DoubleEndedIterator for Cloned<I> where T: Clone, D: Deref<Target=T>, @@ -1298,7 +1306,7 @@ impl<T, D, I> DoubleEndedIterator for Cloned<I> where } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<T, D, I> ExactSizeIterator for Cloned<I> where T: Clone, D: Deref<Target=T>, @@ -1308,13 +1316,13 @@ impl<T, D, I> ExactSizeIterator for Cloned<I> where /// An iterator that repeats endlessly #[derive(Clone, Copy)] #[must_use = "iterator adaptors are lazy and do nothing unless consumed"] -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub struct Cycle<I> { orig: I, iter: I, } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<I> Iterator for Cycle<I> where I: Clone + Iterator { type Item = <I as Iterator>::Item; @@ -1337,7 +1345,7 @@ impl<I> Iterator for Cycle<I> where I: Clone + Iterator { } } -#[unstable = "trait is experimental"] +#[unstable(feature = "core", reason = "trait is experimental")] impl<I> RandomAccessIterator for Cycle<I> where I: Clone + RandomAccessIterator, { @@ -1367,14 +1375,14 @@ impl<I> RandomAccessIterator for Cycle<I> where /// An iterator that strings two iterators together #[derive(Clone)] #[must_use = "iterator adaptors are lazy and do nothing unless consumed"] -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub struct Chain<A, B> { a: A, b: B, flag: bool, } -#[stable] +#[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> { type Item = T; @@ -1408,7 +1416,7 @@ impl<T, A, B> Iterator for Chain<A, B> where A: Iterator<Item=T>, B: Iterator<It } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<T, A, B> DoubleEndedIterator for Chain<A, B> where A: DoubleEndedIterator<Item=T>, B: DoubleEndedIterator<Item=T>, @@ -1422,7 +1430,7 @@ impl<T, A, B> DoubleEndedIterator for Chain<A, B> where } } -#[unstable = "trait is experimental"] +#[unstable(feature = "core", reason = "trait is experimental")] impl<T, A, B> RandomAccessIterator for Chain<A, B> where A: RandomAccessIterator<Item=T>, B: RandomAccessIterator<Item=T>, @@ -1447,13 +1455,13 @@ impl<T, A, B> RandomAccessIterator for Chain<A, B> where /// An iterator that iterates two other iterators simultaneously #[derive(Clone)] #[must_use = "iterator adaptors are lazy and do nothing unless consumed"] -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub struct Zip<A, B> { a: A, b: B } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<T, U, A, B> Iterator for Zip<A, B> where A: Iterator<Item = T>, B: Iterator<Item = U>, @@ -1489,7 +1497,7 @@ impl<T, U, A, B> Iterator for Zip<A, B> where } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<T, U, A, B> DoubleEndedIterator for Zip<A, B> where A: DoubleEndedIterator + ExactSizeIterator<Item=T>, B: DoubleEndedIterator + ExactSizeIterator<Item=U>, @@ -1514,7 +1522,7 @@ impl<T, U, A, B> DoubleEndedIterator for Zip<A, B> where } } -#[unstable = "trait is experimental"] +#[unstable(feature = "core", reason = "trait is experimental")] impl<T, U, A, B> RandomAccessIterator for Zip<A, B> where A: RandomAccessIterator<Item=T>, B: RandomAccessIterator<Item=U>, @@ -1538,14 +1546,14 @@ impl<T, U, A, B> RandomAccessIterator for Zip<A, B> where /// An iterator that maps the values of `iter` with `f` #[must_use = "iterator adaptors are lazy and do nothing unless consumed"] -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub struct Map<A, B, I: Iterator<Item=A>, F: FnMut(A) -> B> { iter: I, f: F, } // FIXME(#19839) Remove in favor of `#[derive(Clone)]` -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<A, B, I, F> Clone for Map<A, B, I, F> where I: Clone + Iterator<Item=A>, F: Clone + FnMut(A) -> B, @@ -1568,7 +1576,7 @@ impl<A, B, I, F> Map<A, B, I, F> where I: Iterator<Item=A>, F: FnMut(A) -> B { } } -#[stable] +#[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 { type Item = B; @@ -1584,7 +1592,7 @@ impl<A, B, I, F> Iterator for Map<A, B, I, F> where I: Iterator<Item=A>, F: FnMu } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<A, B, I, F> DoubleEndedIterator for Map<A, B, I, F> where I: DoubleEndedIterator<Item=A>, F: FnMut(A) -> B, @@ -1596,7 +1604,7 @@ impl<A, B, I, F> DoubleEndedIterator for Map<A, B, I, F> where } } -#[unstable = "trait is experimental"] +#[unstable(feature = "core", reason = "trait is experimental")] impl<A, B, I, F> RandomAccessIterator for Map<A, B, I, F> where I: RandomAccessIterator<Item=A>, F: FnMut(A) -> B, @@ -1615,14 +1623,14 @@ impl<A, B, I, F> RandomAccessIterator for Map<A, B, I, F> where /// An iterator that filters the elements of `iter` with `predicate` #[must_use = "iterator adaptors are lazy and do nothing unless consumed"] -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub struct Filter<A, I, P> where I: Iterator<Item=A>, P: FnMut(&A) -> bool { iter: I, predicate: P, } // FIXME(#19839) Remove in favor of `#[derive(Clone)]` -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<A, I, P> Clone for Filter<A, I, P> where I: Clone + Iterator<Item=A>, P: Clone + FnMut(&A) -> bool, @@ -1635,7 +1643,7 @@ impl<A, I, P> Clone for Filter<A, I, P> where } } -#[stable] +#[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 { type Item = A; @@ -1658,7 +1666,7 @@ impl<A, I, P> Iterator for Filter<A, I, P> where I: Iterator<Item=A>, P: FnMut(& } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<A, I, P> DoubleEndedIterator for Filter<A, I, P> where I: DoubleEndedIterator<Item=A>, P: FnMut(&A) -> bool, @@ -1676,14 +1684,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` #[must_use = "iterator adaptors are lazy and do nothing unless consumed"] -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub struct FilterMap<A, B, I, F> where I: Iterator<Item=A>, F: FnMut(A) -> Option<B> { iter: I, f: F, } // FIXME(#19839) Remove in favor of `#[derive(Clone)]` -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<A, B, I, F> Clone for FilterMap<A, B, I, F> where I: Clone + Iterator<Item=A>, F: Clone + FnMut(A) -> Option<B>, @@ -1696,7 +1704,7 @@ impl<A, B, I, F> Clone for FilterMap<A, B, I, F> where } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<A, B, I, F> Iterator for FilterMap<A, B, I, F> where I: Iterator<Item=A>, F: FnMut(A) -> Option<B>, @@ -1721,7 +1729,7 @@ impl<A, B, I, F> Iterator for FilterMap<A, B, I, F> where } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<A, B, I, F> DoubleEndedIterator for FilterMap<A, B, I, F> where I: DoubleEndedIterator<Item=A>, F: FnMut(A) -> Option<B>, @@ -1741,13 +1749,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 #[derive(Clone)] #[must_use = "iterator adaptors are lazy and do nothing unless consumed"] -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub struct Enumerate<I> { iter: I, count: usize } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<I> Iterator for Enumerate<I> where I: Iterator { type Item = (usize, <I as Iterator>::Item); @@ -1769,7 +1777,7 @@ impl<I> Iterator for Enumerate<I> where I: Iterator { } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<I> DoubleEndedIterator for Enumerate<I> where I: ExactSizeIterator + DoubleEndedIterator { @@ -1785,7 +1793,7 @@ impl<I> DoubleEndedIterator for Enumerate<I> where } } -#[unstable = "trait is experimental"] +#[unstable(feature = "core", reason = "trait is experimental")] impl<I> RandomAccessIterator for Enumerate<I> where I: RandomAccessIterator { #[inline] fn indexable(&self) -> usize { @@ -1803,14 +1811,14 @@ impl<I> RandomAccessIterator for Enumerate<I> where I: RandomAccessIterator { /// 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"] -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] #[derive(Copy)] pub struct Peekable<T, I> where I: Iterator<Item=T> { iter: I, peeked: Option<T>, } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<T, I> Iterator for Peekable<T, I> where I: Iterator<Item=T> { type Item = T; @@ -1836,10 +1844,10 @@ impl<T, I> Iterator for Peekable<T, I> where I: Iterator<Item=T> { } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<T, I> ExactSizeIterator for Peekable<T, I> where I: ExactSizeIterator<Item = T> {} -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] 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, /// or None if the iterator is exhausted. @@ -1863,7 +1871,7 @@ impl<T, I> Peekable<T, I> where I: Iterator<Item=T> { /// An iterator that rejects elements while `predicate` is true #[must_use = "iterator adaptors are lazy and do nothing unless consumed"] -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub struct SkipWhile<A, I, P> where I: Iterator<Item=A>, P: FnMut(&A) -> bool { iter: I, flag: bool, @@ -1871,7 +1879,7 @@ pub struct SkipWhile<A, I, P> where I: Iterator<Item=A>, P: FnMut(&A) -> bool { } // FIXME(#19839) Remove in favor of `#[derive(Clone)]` -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<A, I, P> Clone for SkipWhile<A, I, P> where I: Clone + Iterator<Item=A>, P: Clone + FnMut(&A) -> bool, @@ -1885,7 +1893,7 @@ impl<A, I, P> Clone for SkipWhile<A, I, P> where } } -#[stable] +#[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 { type Item = A; @@ -1909,7 +1917,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 #[must_use = "iterator adaptors are lazy and do nothing unless consumed"] -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub struct TakeWhile<A, I, P> where I: Iterator<Item=A>, P: FnMut(&A) -> bool { iter: I, flag: bool, @@ -1917,7 +1925,7 @@ pub struct TakeWhile<A, I, P> where I: Iterator<Item=A>, P: FnMut(&A) -> bool { } // FIXME(#19839) Remove in favor of `#[derive(Clone)]` -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<A, I, P> Clone for TakeWhile<A, I, P> where I: Clone + Iterator<Item=A>, P: Clone + FnMut(&A) -> bool, @@ -1931,7 +1939,7 @@ impl<A, I, P> Clone for TakeWhile<A, I, P> where } } -#[stable] +#[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 { type Item = A; @@ -1964,13 +1972,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`. #[derive(Clone)] #[must_use = "iterator adaptors are lazy and do nothing unless consumed"] -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub struct Skip<I> { iter: I, n: usize } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<I> Iterator for Skip<I> where I: Iterator { type Item = <I as Iterator>::Item; @@ -2014,7 +2022,7 @@ impl<I> Iterator for Skip<I> where I: Iterator { } } -#[unstable = "trait is experimental"] +#[unstable(feature = "core", reason = "trait is experimental")] impl<I> RandomAccessIterator for Skip<I> where I: RandomAccessIterator{ #[inline] fn indexable(&self) -> usize { @@ -2031,19 +2039,19 @@ impl<I> RandomAccessIterator for Skip<I> where I: RandomAccessIterator{ } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<I> ExactSizeIterator for Skip<I> where I: ExactSizeIterator {} /// An iterator that only iterates over the first `n` iterations of `iter`. #[derive(Clone)] #[must_use = "iterator adaptors are lazy and do nothing unless consumed"] -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub struct Take<I> { iter: I, n: usize } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<I> Iterator for Take<I> where I: Iterator{ type Item = <I as Iterator>::Item; @@ -2072,7 +2080,7 @@ impl<I> Iterator for Take<I> where I: Iterator{ } } -#[unstable = "trait is experimental"] +#[unstable(feature = "core", reason = "trait is experimental")] impl<I> RandomAccessIterator for Take<I> where I: RandomAccessIterator{ #[inline] fn indexable(&self) -> usize { @@ -2089,13 +2097,13 @@ impl<I> RandomAccessIterator for Take<I> where I: RandomAccessIterator{ } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<I> ExactSizeIterator for Take<I> where I: ExactSizeIterator {} /// An iterator to maintain state while iterating another iterator #[must_use = "iterator adaptors are lazy and do nothing unless consumed"] -#[stable] +#[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> { iter: I, f: F, @@ -2105,7 +2113,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)]` -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<A, B, I, St, F> Clone for Scan<A, B, I, St, F> where I: Clone + Iterator<Item=A>, St: Clone, @@ -2120,7 +2128,7 @@ impl<A, B, I, St, F> Clone for Scan<A, B, I, St, F> where } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<A, B, I, St, F> Iterator for Scan<A, B, I, St, F> where I: Iterator<Item=A>, F: FnMut(&mut St, A) -> Option<B>, @@ -2143,7 +2151,7 @@ impl<A, B, I, St, F> Iterator for Scan<A, B, I, St, F> where /// and yields the elements of the produced iterators /// #[must_use = "iterator adaptors are lazy and do nothing unless consumed"] -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub struct FlatMap<A, B, I, U, F> where I: Iterator<Item=A>, U: Iterator<Item=B>, @@ -2156,7 +2164,7 @@ pub struct FlatMap<A, B, I, U, F> where } // FIXME(#19839) Remove in favor of `#[derive(Clone)]` -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<A, B, I, U, F> Clone for FlatMap<A, B, I, U, F> where I: Clone + Iterator<Item=A>, U: Clone + Iterator<Item=B>, @@ -2172,7 +2180,7 @@ impl<A, B, I, U, F> Clone for FlatMap<A, B, I, U, F> where } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<A, B, I, U, F> Iterator for FlatMap<A, B, I, U, F> where I: Iterator<Item=A>, U: Iterator<Item=B>, @@ -2207,7 +2215,7 @@ impl<A, B, I, U, F> Iterator for FlatMap<A, B, I, U, F> where } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<A, B, I, U, F> DoubleEndedIterator for FlatMap<A, B, I, U, F> where I: DoubleEndedIterator<Item=A>, U: DoubleEndedIterator<Item=B>, @@ -2234,13 +2242,13 @@ impl<A, B, I, U, F> DoubleEndedIterator for FlatMap<A, B, I, U, F> where /// yields `None` once. #[derive(Clone)] #[must_use = "iterator adaptors are lazy and do nothing unless consumed"] -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub struct Fuse<I> { iter: I, done: bool } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<I> Iterator for Fuse<I> where I: Iterator { type Item = <I as Iterator>::Item; @@ -2269,7 +2277,7 @@ impl<I> Iterator for Fuse<I> where I: Iterator { } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<I> DoubleEndedIterator for Fuse<I> where I: DoubleEndedIterator { #[inline] fn next_back(&mut self) -> Option<<I as Iterator>::Item> { @@ -2288,7 +2296,7 @@ impl<I> DoubleEndedIterator for Fuse<I> where I: DoubleEndedIterator { } // Allow RandomAccessIterators to be fused without affecting random-access behavior -#[unstable = "trait is experimental"] +#[unstable(feature = "core", reason = "trait is experimental")] impl<I> RandomAccessIterator for Fuse<I> where I: RandomAccessIterator { #[inline] fn indexable(&self) -> usize { @@ -2301,14 +2309,14 @@ impl<I> RandomAccessIterator for Fuse<I> where I: RandomAccessIterator { } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<I> ExactSizeIterator for Fuse<I> where I: ExactSizeIterator {} impl<I> Fuse<I> { /// Resets the fuse such that the next call to .next() or .next_back() will /// call the underlying iterator again even if it previously returned None. #[inline] - #[unstable = "seems marginal"] + #[unstable(feature = "core", reason = "seems marginal")] pub fn reset_fuse(&mut self) { self.done = false } @@ -2317,14 +2325,14 @@ impl<I> Fuse<I> { /// An iterator that calls a function with a reference to each /// element before yielding it. #[must_use = "iterator adaptors are lazy and do nothing unless consumed"] -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub struct Inspect<A, I, F> where I: Iterator<Item=A>, F: FnMut(&A) { iter: I, f: F, } // FIXME(#19839) Remove in favor of `#[derive(Clone)]` -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<A, I, F> Clone for Inspect<A, I, F> where I: Clone + Iterator<Item=A>, F: Clone + FnMut(&A), @@ -2349,7 +2357,7 @@ impl<A, I, F> Inspect<A, I, F> where I: Iterator<Item=A>, F: FnMut(&A) { } } -#[stable] +#[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) { type Item = A; @@ -2365,7 +2373,7 @@ impl<A, I, F> Iterator for Inspect<A, I, F> where I: Iterator<Item=A>, F: FnMut( } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<A, I, F> DoubleEndedIterator for Inspect<A, I, F> where I: DoubleEndedIterator<Item=A>, F: FnMut(&A), @@ -2377,7 +2385,7 @@ impl<A, I, F> DoubleEndedIterator for Inspect<A, I, F> where } } -#[unstable = "trait is experimental"] +#[unstable(feature = "core", reason = "trait is experimental")] impl<A, I, F> RandomAccessIterator for Inspect<A, I, F> where I: RandomAccessIterator<Item=A>, F: FnMut(&A), @@ -2426,7 +2434,7 @@ impl<A, I, F> RandomAccessIterator for Inspect<A, I, F> where /// println!("{}", i); /// } /// ``` -#[unstable] +#[unstable(feature = "core")] pub struct Unfold<A, St, F> where F: FnMut(&mut St) -> Option<A> { f: F, /// Internal state that will be passed to the closure on the next iteration @@ -2434,7 +2442,7 @@ pub struct Unfold<A, St, F> where F: FnMut(&mut St) -> Option<A> { } // FIXME(#19839) Remove in favor of `#[derive(Clone)]` -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<A, St, F> Clone for Unfold<A, St, F> where F: Clone + FnMut(&mut St) -> Option<A>, St: Clone, @@ -2447,7 +2455,7 @@ impl<A, St, F> Clone for Unfold<A, St, F> where } } -#[unstable] +#[unstable(feature = "core")] impl<A, St, F> Unfold<A, St, F> where F: FnMut(&mut St) -> Option<A> { /// Creates a new iterator with the specified closure as the "iterator /// function" and an initial state to eventually pass to the closure @@ -2460,7 +2468,7 @@ impl<A, St, F> Unfold<A, St, F> where F: FnMut(&mut St) -> Option<A> { } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<A, St, F> Iterator for Unfold<A, St, F> where F: FnMut(&mut St) -> Option<A> { type Item = A; @@ -2479,7 +2487,8 @@ impl<A, St, F> Iterator for Unfold<A, St, F> where F: FnMut(&mut St) -> Option<A /// An infinite iterator starting at `start` and advancing by `step` with each /// iteration #[derive(Clone, Copy)] -#[unstable = "may be renamed or replaced by range notation adapaters"] +#[unstable(feature = "core", + reason = "may be renamed or replaced by range notation adapaters")] pub struct Counter<A> { /// The current state the counter is at (next value to be yielded) state: A, @@ -2489,12 +2498,13 @@ pub struct Counter<A> { /// Creates a new counter with the specified start/step #[inline] -#[unstable = "may be renamed or replaced by range notation adapaters"] +#[unstable(feature = "core", + reason = "may be renamed or replaced by range notation adapaters")] pub fn count<A>(start: A, step: A) -> Counter<A> { Counter{state: start, step: step} } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<A: Add<Output=A> + Clone> Iterator for Counter<A> { type Item = A; @@ -2513,7 +2523,8 @@ impl<A: Add<Output=A> + Clone> Iterator for Counter<A> { /// An iterator over the range [start, stop) #[derive(Clone, Copy)] -#[unstable = "will be replaced by range notation"] +#[unstable(feature = "core", + reason = "will be replaced by range notation")] pub struct Range<A> { state: A, stop: A, @@ -2534,7 +2545,8 @@ pub struct Range<A> { /// } /// ``` #[inline] -#[unstable = "will be replaced by range notation"] +#[unstable(feature = "core", + reason = "will be replaced by range notation")] pub fn range<A: Int>(start: A, stop: A) -> Range<A> { Range { state: start, @@ -2544,7 +2556,8 @@ pub fn range<A: Int>(start: A, stop: A) -> Range<A> { } // FIXME: #10414: Unfortunate type bound -#[unstable = "will be replaced by range notation"] +#[unstable(feature = "core", + reason = "will be replaced by range notation")] impl<A: Int + ToPrimitive> Iterator for Range<A> { type Item = A; @@ -2594,7 +2607,8 @@ impl<A: Int + ToPrimitive> Iterator for Range<A> { /// `Int` is required to ensure the range will be the same regardless of /// the direction it is consumed. -#[unstable = "will be replaced by range notation"] +#[unstable(feature = "core", + reason = "will be replaced by range notation")] impl<A: Int + ToPrimitive> DoubleEndedIterator for Range<A> { #[inline] fn next_back(&mut self) -> Option<A> { @@ -2609,7 +2623,8 @@ impl<A: Int + ToPrimitive> DoubleEndedIterator for Range<A> { /// An iterator over the range [start, stop] #[derive(Clone)] -#[unstable = "likely to be replaced by range notation and adapters"] +#[unstable(feature = "core", + reason = "likely to be replaced by range notation and adapters")] pub struct RangeInclusive<A> { range: Range<A>, done: bool, @@ -2617,7 +2632,8 @@ pub struct RangeInclusive<A> { /// Return an iterator over the range [start, stop] #[inline] -#[unstable = "likely to be replaced by range notation and adapters"] +#[unstable(feature = "core", + reason = "likely to be replaced by range notation and adapters")] pub fn range_inclusive<A: Int>(start: A, stop: A) -> RangeInclusive<A> { RangeInclusive { range: range(start, stop), @@ -2625,7 +2641,8 @@ pub fn range_inclusive<A: Int>(start: A, stop: A) -> RangeInclusive<A> { } } -#[unstable = "likely to be replaced by range notation and adapters"] +#[unstable(feature = "core", + reason = "likely to be replaced by range notation and adapters")] impl<A: Int + ToPrimitive> Iterator for RangeInclusive<A> { type Item = A; @@ -2660,7 +2677,8 @@ impl<A: Int + ToPrimitive> Iterator for RangeInclusive<A> { } } -#[unstable = "likely to be replaced by range notation and adapters"] +#[unstable(feature = "core", + reason = "likely to be replaced by range notation and adapters")] impl<A: Int + ToPrimitive> DoubleEndedIterator for RangeInclusive<A> { #[inline] fn next_back(&mut self) -> Option<A> { @@ -2679,7 +2697,8 @@ impl<A: Int + ToPrimitive> DoubleEndedIterator for RangeInclusive<A> { /// An iterator over the range [start, stop) by `step`. It handles overflow by stopping. #[derive(Clone)] -#[unstable = "likely to be replaced by range notation and adapters"] +#[unstable(feature = "core", + reason = "likely to be replaced by range notation and adapters")] pub struct RangeStep<A> { state: A, stop: A, @@ -2689,13 +2708,15 @@ pub struct RangeStep<A> { /// Return an iterator over the range [start, stop) by `step`. It handles overflow by stopping. #[inline] -#[unstable = "likely to be replaced by range notation and adapters"] +#[unstable(feature = "core", + reason = "likely to be replaced by range notation and adapters")] pub fn range_step<A: Int>(start: A, stop: A, step: A) -> RangeStep<A> { let rev = step < Int::zero(); RangeStep{state: start, stop: stop, step: step, rev: rev} } -#[unstable = "likely to be replaced by range notation and adapters"] +#[unstable(feature = "core", + reason = "likely to be replaced by range notation and adapters")] impl<A: Int> Iterator for RangeStep<A> { type Item = A; @@ -2716,7 +2737,8 @@ impl<A: Int> Iterator for RangeStep<A> { /// An iterator over the range [start, stop] by `step`. It handles overflow by stopping. #[derive(Clone)] -#[unstable = "likely to be replaced by range notation and adapters"] +#[unstable(feature = "core", + reason = "likely to be replaced by range notation and adapters")] pub struct RangeStepInclusive<A> { state: A, stop: A, @@ -2727,7 +2749,8 @@ pub struct RangeStepInclusive<A> { /// Return an iterator over the range [start, stop] by `step`. It handles overflow by stopping. #[inline] -#[unstable = "likely to be replaced by range notation and adapters"] +#[unstable(feature = "core", + reason = "likely to be replaced by range notation and adapters")] pub fn range_step_inclusive<A: Int>(start: A, stop: A, step: A) -> RangeStepInclusive<A> { let rev = step < Int::zero(); RangeStepInclusive { @@ -2739,7 +2762,8 @@ pub fn range_step_inclusive<A: Int>(start: A, stop: A, step: A) -> RangeStepIncl } } -#[unstable = "likely to be replaced by range notation and adapters"] +#[unstable(feature = "core", + reason = "likely to be replaced by range notation and adapters")] impl<A: Int> Iterator for RangeStepInclusive<A> { type Item = A; @@ -2761,7 +2785,7 @@ impl<A: Int> Iterator for RangeStepInclusive<A> { macro_rules! range_impl { ($($t:ty)*) => ($( - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] impl Iterator for ::ops::Range<$t> { type Item = $t; @@ -2784,14 +2808,14 @@ macro_rules! range_impl { } } - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] impl ExactSizeIterator for ::ops::Range<$t> {} )*) } macro_rules! range_impl_no_hint { ($($t:ty)*) => ($( - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] impl Iterator for ::ops::Range<$t> { type Item = $t; @@ -2811,7 +2835,7 @@ macro_rules! range_impl_no_hint { macro_rules! range_other_impls { ($($t:ty)*) => ($( - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] impl DoubleEndedIterator for ::ops::Range<$t> { #[inline] fn next_back(&mut self) -> Option<$t> { @@ -2824,7 +2848,7 @@ macro_rules! range_other_impls { } } - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] impl Iterator for ::ops::RangeFrom<$t> { type Item = $t; @@ -2849,12 +2873,12 @@ range_other_impls!(usize u8 u16 u32 u64 isize i8 i16 i32 i64); /// An iterator that repeats an element endlessly #[derive(Clone)] -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub struct Repeat<A> { element: A } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<A: Clone> Iterator for Repeat<A> { type Item = A; @@ -2864,13 +2888,13 @@ impl<A: Clone> Iterator for Repeat<A> { fn size_hint(&self) -> (usize, Option<usize>) { (usize::MAX, None) } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<A: Clone> DoubleEndedIterator for Repeat<A> { #[inline] fn next_back(&mut self) -> Option<A> { self.idx(0) } } -#[unstable = "trait is experimental"] +#[unstable(feature = "core", reason = "trait is experimental")] impl<A: Clone> RandomAccessIterator for Repeat<A> { #[inline] fn indexable(&self) -> usize { usize::MAX } @@ -2882,12 +2906,12 @@ type IterateState<T, F> = (F, Option<T>, bool); /// An iterator that repeatedly applies a given function, starting /// from a given seed value. -#[unstable] +#[unstable(feature = "core")] pub type Iterate<T, F> = Unfold<T, IterateState<T, F>, fn(&mut IterateState<T, F>) -> Option<T>>; /// Create a new iterator that produces an infinite sequence of /// repeated applications of the given function `f`. -#[unstable] +#[unstable(feature = "core")] pub fn iterate<T, F>(seed: T, f: F) -> Iterate<T, F> where T: Clone, F: FnMut(T) -> T, @@ -2918,7 +2942,7 @@ pub fn iterate<T, F>(seed: T, f: F) -> Iterate<T, F> where /// Create a new iterator that endlessly repeats the element `elt`. #[inline] -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub fn repeat<T: Clone>(elt: T) -> Repeat<T> { Repeat{element: elt} } @@ -2930,7 +2954,7 @@ pub fn repeat<T: Clone>(elt: T) -> Repeat<T> { /// /// If two sequences are equal up until the point where one ends, /// the shorter sequence compares less. -#[unstable = "needs review and revision"] +#[unstable(feature = "core", reason = "needs review and revision")] pub mod order { use cmp; use cmp::{Eq, Ord, PartialOrd, PartialEq}; diff --git a/src/libcore/lib.rs b/src/libcore/lib.rs index 1e271f972b1..d4ca5e3f8dc 100644 --- a/src/libcore/lib.rs +++ b/src/libcore/lib.rs @@ -48,7 +48,8 @@ // separate crate, libcoretest, to avoid bizarre issues. #![crate_name = "core"] -#![unstable] +#![unstable(feature = "core")] +#![feature(staged_api)] #![staged_api] #![crate_type = "rlib"] #![doc(html_logo_url = "http://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png", diff --git a/src/libcore/macros.rs b/src/libcore/macros.rs index d44eaae820f..943365d8454 100644 --- a/src/libcore/macros.rs +++ b/src/libcore/macros.rs @@ -52,7 +52,7 @@ macro_rules! panic { /// assert!(a + b == 30, "a = {}, b = {}", a, b); /// ``` #[macro_export] -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] macro_rules! assert { ($cond:expr) => ( if !$cond { @@ -79,7 +79,7 @@ macro_rules! assert { /// assert_eq!(a, b); /// ``` #[macro_export] -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] macro_rules! assert_eq { ($left:expr , $right:expr) => ({ match (&($left), &($right)) { @@ -123,7 +123,7 @@ macro_rules! assert_eq { /// debug_assert!(a + b == 30, "a = {}, b = {}", a, b); /// ``` #[macro_export] -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] macro_rules! debug_assert { ($($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 /// the message is written. #[macro_export] -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] macro_rules! writeln { ($dst:expr, $fmt:expr) => ( write!($dst, concat!($fmt, "\n")) @@ -235,7 +235,8 @@ macro_rules! writeln { /// } /// ``` #[macro_export] -#[unstable = "relationship with panic is unclear"] +#[unstable(feature = "core", + reason = "relationship with panic is unclear")] macro_rules! unreachable { () => ({ panic!("internal error: entered unreachable code") @@ -251,7 +252,8 @@ macro_rules! unreachable { /// A standardised placeholder for marking unfinished code. It panics with the /// message `"not yet implemented"` when executed. #[macro_export] -#[unstable = "relationship with panic is unclear"] +#[unstable(feature = "core", + reason = "relationship with panic is unclear")] macro_rules! unimplemented { () => (panic!("not yet implemented")) } diff --git a/src/libcore/marker.rs b/src/libcore/marker.rs index 688f0484401..1fc3e34af5e 100644 --- a/src/libcore/marker.rs +++ b/src/libcore/marker.rs @@ -23,12 +23,13 @@ //! implemented using unsafe code. In that case, you may want to embed //! some of the marker types below into your type. -#![stable] +#![stable(feature = "rust1", since = "1.0.0")] use clone::Clone; /// Types able to be transferred across thread boundaries. -#[unstable = "will be overhauled with new lifetime rules; see RFC 458"] +#[unstable(feature = "core", + reason = "will be overhauled with new lifetime rules; see RFC 458")] #[lang="send"] #[rustc_on_unimplemented = "`{Self}` cannot be sent between threads safely"] pub unsafe trait Send: 'static { @@ -36,7 +37,7 @@ pub unsafe trait Send: 'static { } /// Types with a constant size known at compile-time. -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] #[lang="sized"] #[rustc_on_unimplemented = "`{Self}` does not have a constant size known at compile-time"] pub trait Sized { @@ -142,7 +143,7 @@ pub trait Sized { /// 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 /// change: that second example would fail to compile if we made `Foo` non-`Copy`. -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] #[lang="copy"] pub trait Copy { // Empty. @@ -193,7 +194,8 @@ pub trait Copy { /// around the value(s) which can be mutated when behind a `&` /// reference; not doing this is undefined behaviour (for example, /// `transmute`-ing from `&T` to `&mut T` is illegal). -#[unstable = "will be overhauled with new lifetime rules; see RFC 458"] +#[unstable(feature = "core", + reason = "will be overhauled with new lifetime rules; see RFC 458")] #[lang="sync"] #[rustc_on_unimplemented = "`{Self}` cannot be shared between threads safely"] pub unsafe trait Sync { @@ -238,7 +240,8 @@ pub unsafe trait Sync { /// `S<T>` is a subtype of `S<U>` if `T` is a subtype of `U` /// (for example, `S<&'static int>` is a subtype of `S<&'a int>` /// for some lifetime `'a`, but not the other way around). -#[unstable = "likely to change with new variance strategy"] +#[unstable(feature = "core", + reason = "likely to change with new variance strategy")] #[lang="covariant_type"] #[derive(PartialEq, Eq, PartialOrd, Ord)] pub struct CovariantType<T: ?Sized>; @@ -287,7 +290,8 @@ impl<T: ?Sized> Clone for CovariantType<T> { /// subtype of `S<U>` if `U` is a subtype of `T`; given that the /// function requires arguments of type `T`, it must also accept /// arguments of type `U`, hence such a conversion is safe. -#[unstable = "likely to change with new variance strategy"] +#[unstable(feature = "core", + reason = "likely to change with new variance strategy")] #[lang="contravariant_type"] #[derive(PartialEq, Eq, PartialOrd, Ord)] pub struct ContravariantType<T: ?Sized>; @@ -317,14 +321,17 @@ impl<T: ?Sized> Clone for ContravariantType<T> { /// The type system would infer that `value` is only read here and /// never written, but in fact `Cell` uses unsafe code to achieve /// interior mutability. -#[unstable = "likely to change with new variance strategy"] +#[unstable(feature = "core", + reason = "likely to change with new variance strategy")] #[lang="invariant_type"] #[derive(PartialEq, Eq, PartialOrd, Ord)] pub struct InvariantType<T: ?Sized>; -#[unstable = "likely to change with new variance strategy"] +#[unstable(feature = "core", + reason = "likely to change with new variance strategy")] impl<T: ?Sized> Copy for InvariantType<T> {} -#[unstable = "likely to change with new variance strategy"] +#[unstable(feature = "core", + reason = "likely to change with new variance strategy")] impl<T: ?Sized> Clone for InvariantType<T> { fn clone(&self) -> InvariantType<T> { *self } } @@ -345,7 +352,8 @@ impl<T: ?Sized> Clone for InvariantType<T> { /// /// For more information about variance, refer to this Wikipedia /// article <http://en.wikipedia.org/wiki/Variance_%28computer_science%29>. -#[unstable = "likely to change with new variance strategy"] +#[unstable(feature = "core", + reason = "likely to change with new variance strategy")] #[lang="covariant_lifetime"] #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord)] pub struct CovariantLifetime<'a>; @@ -362,7 +370,8 @@ pub struct CovariantLifetime<'a>; /// /// For more information about variance, refer to this Wikipedia /// article <http://en.wikipedia.org/wiki/Variance_%28computer_science%29>. -#[unstable = "likely to change with new variance strategy"] +#[unstable(feature = "core", + reason = "likely to change with new variance strategy")] #[lang="contravariant_lifetime"] #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord)] pub struct ContravariantLifetime<'a>; @@ -374,7 +383,8 @@ pub struct ContravariantLifetime<'a>; /// pointer that is actually a pointer into memory with lifetime `'a`, /// and this pointer is itself stored in an inherently mutable /// location (such as a `Cell`). -#[unstable = "likely to change with new variance strategy"] +#[unstable(feature = "core", + reason = "likely to change with new variance strategy")] #[lang="invariant_lifetime"] #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord)] pub struct InvariantLifetime<'a>; @@ -382,7 +392,8 @@ pub struct InvariantLifetime<'a>; /// A type which is considered "not POD", meaning that it is not /// implicitly copyable. This is typically embedded in other types to /// ensure that they are never copied, even if they lack a destructor. -#[unstable = "likely to change with new variance strategy"] +#[unstable(feature = "core", + reason = "likely to change with new variance strategy")] #[lang="no_copy_bound"] #[derive(Clone, PartialEq, Eq, PartialOrd, Ord)] #[allow(missing_copy_implementations)] @@ -390,7 +401,8 @@ pub struct NoCopy; /// A type which is considered managed by the GC. This is typically /// embedded in other types. -#[unstable = "likely to change with new variance strategy"] +#[unstable(feature = "core", + reason = "likely to change with new variance strategy")] #[lang="managed_bound"] #[derive(Clone, PartialEq, Eq, PartialOrd, Ord)] #[allow(missing_copy_implementations)] diff --git a/src/libcore/mem.rs b/src/libcore/mem.rs index 608a78325b3..0d26c8e7914 100644 --- a/src/libcore/mem.rs +++ b/src/libcore/mem.rs @@ -13,13 +13,13 @@ //! This module contains functions for querying the size and alignment of //! types, initializing and manipulating memory. -#![stable] +#![stable(feature = "rust1", since = "1.0.0")] use marker::Sized; use intrinsics; use ptr; -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub use intrinsics::transmute; /// 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 /// not run any destructors. -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub use intrinsics::forget; /// Returns the size of a type in bytes. @@ -42,7 +42,7 @@ pub use intrinsics::forget; /// assert_eq!(4, mem::size_of::<i32>()); /// ``` #[inline] -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub fn size_of<T>() -> uint { unsafe { intrinsics::size_of::<T>() } } @@ -57,7 +57,7 @@ pub fn size_of<T>() -> uint { /// assert_eq!(4, mem::size_of_val(&5i32)); /// ``` #[inline] -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub fn size_of_val<T>(_val: &T) -> uint { size_of::<T>() } @@ -74,7 +74,7 @@ pub fn size_of_val<T>(_val: &T) -> uint { /// assert_eq!(4, mem::min_align_of::<i32>()); /// ``` #[inline] -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub fn min_align_of<T>() -> uint { 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)); /// ``` #[inline] -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub fn min_align_of_val<T>(_val: &T) -> uint { 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>()); /// ``` #[inline] -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub fn align_of<T>() -> uint { // We use the preferred alignment as the default alignment for a type. This // 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)); /// ``` #[inline] -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub fn align_of_val<T>(_val: &T) -> uint { align_of::<T>() } @@ -153,7 +153,7 @@ pub fn align_of_val<T>(_val: &T) -> uint { /// let x: int = unsafe { mem::zeroed() }; /// ``` #[inline] -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub unsafe fn zeroed<T>() -> T { intrinsics::init() } @@ -174,7 +174,7 @@ pub unsafe fn zeroed<T>() -> T { /// let x: int = unsafe { mem::uninitialized() }; /// ``` #[inline] -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub unsafe fn uninitialized<T>() -> T { intrinsics::uninit() } @@ -196,7 +196,7 @@ pub unsafe fn uninitialized<T>() -> T { /// assert_eq!(5, *y); /// ``` #[inline] -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub fn swap<T>(x: &mut T, y: &mut T) { unsafe { // Give ourselves some scratch space to work with @@ -261,7 +261,7 @@ pub fn swap<T>(x: &mut T, y: &mut T) { /// } /// ``` #[inline] -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub fn replace<T>(dest: &mut T, mut src: T) -> T { swap(dest, &mut src); src @@ -288,7 +288,7 @@ pub fn replace<T>(dest: &mut T, mut src: T) -> T { /// println!("{}", *borrow); /// ``` #[inline] -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub fn drop<T>(_x: T) { } /// Interprets `src` as `&U`, and then reads `src` without moving the contained value. @@ -311,15 +311,16 @@ pub fn drop<T>(_x: T) { } /// assert_eq!(1, one); /// ``` #[inline] -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub unsafe fn transmute_copy<T, U>(src: &T) -> U { ptr::read(src as *const T as *const U) } /// Transforms lifetime of the second pointer to match the first. #[inline] -#[unstable = "this function may be removed in the future due to its \ - questionable utility"] +#[unstable(feature = "core", + reason = "this function may be removed in the future due to its \ + questionable utility")] pub unsafe fn copy_lifetime<'a, S: ?Sized, T: ?Sized + 'a>(_ptr: &'a S, ptr: &T) -> &'a T { transmute(ptr) @@ -327,8 +328,9 @@ pub unsafe fn copy_lifetime<'a, S: ?Sized, T: ?Sized + 'a>(_ptr: &'a S, /// Transforms lifetime of the second mutable pointer to match the first. #[inline] -#[unstable = "this function may be removed in the future due to its \ - questionable utility"] +#[unstable(feature = "core", + reason = "this function may be removed in the future due to its \ + questionable utility")] pub unsafe fn copy_mut_lifetime<'a, S: ?Sized, T: ?Sized + 'a>(_ptr: &'a mut S, ptr: &mut T) -> &'a mut T { diff --git a/src/libcore/nonzero.rs b/src/libcore/nonzero.rs index 1231e1ab894..495c7c2bc2e 100644 --- a/src/libcore/nonzero.rs +++ b/src/libcore/nonzero.rs @@ -32,7 +32,7 @@ unsafe impl Zeroable for u64 {} /// NULL or 0 that might allow certain optimizations. #[lang="non_zero"] #[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Show, Hash)] -#[unstable] +#[unstable(feature = "core")] pub struct NonZero<T: Zeroable>(T); impl<T: Zeroable> NonZero<T> { @@ -52,4 +52,4 @@ impl<T: Zeroable> Deref for NonZero<T> { let NonZero(ref inner) = *self; inner } -} \ No newline at end of file +} diff --git a/src/libcore/num/f32.rs b/src/libcore/num/f32.rs index 2186101bc2f..83d070feb8a 100644 --- a/src/libcore/num/f32.rs +++ b/src/libcore/num/f32.rs @@ -14,7 +14,7 @@ // FIXME: MIN_VALUE and MAX_VALUE literals are parsed as -inf and inf #14353 #![allow(overflowing_literals)] -#![stable] +#![stable(feature = "rust1", since = "1.0.0")] use intrinsics; use mem; @@ -22,46 +22,47 @@ use num::Float; use num::FpCategory as Fp; use option::Option; -#[unstable = "pending integer conventions"] +#[unstable(feature = "core", reason = "pending integer conventions")] pub const RADIX: uint = 2; -#[unstable = "pending integer conventions"] +#[unstable(feature = "core", reason = "pending integer conventions")] pub const MANTISSA_DIGITS: uint = 24; -#[unstable = "pending integer conventions"] +#[unstable(feature = "core", reason = "pending integer conventions")] pub const DIGITS: uint = 6; -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub const EPSILON: f32 = 1.19209290e-07_f32; /// Smallest finite f32 value -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub const MIN_VALUE: f32 = -3.40282347e+38_f32; /// Smallest positive, normalized f32 value -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub const MIN_POS_VALUE: f32 = 1.17549435e-38_f32; /// Largest finite f32 value -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub const MAX_VALUE: f32 = 3.40282347e+38_f32; -#[unstable = "pending integer conventions"] +#[unstable(feature = "core", reason = "pending integer conventions")] pub const MIN_EXP: int = -125; -#[unstable = "pending integer conventions"] +#[unstable(feature = "core", reason = "pending integer conventions")] pub const MAX_EXP: int = 128; -#[unstable = "pending integer conventions"] +#[unstable(feature = "core", reason = "pending integer conventions")] pub const MIN_10_EXP: int = -37; -#[unstable = "pending integer conventions"] +#[unstable(feature = "core", reason = "pending integer conventions")] pub const MAX_10_EXP: int = 38; -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub const NAN: f32 = 0.0_f32/0.0_f32; -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub const INFINITY: f32 = 1.0_f32/0.0_f32; -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub const NEG_INFINITY: f32 = -1.0_f32/0.0_f32; /// Various useful constants. -#[unstable = "naming scheme needs to be revisited"] +#[unstable(feature = "core", + reason = "naming scheme needs to be revisited")] pub mod consts { // FIXME: replace with mathematical constants from cmath. @@ -117,7 +118,7 @@ pub mod consts { pub const LN_10: f32 = 2.30258509299404568401799145468436421_f32; } -#[unstable = "trait is unstable"] +#[unstable(feature = "core", reason = "trait is unstable")] impl Float for f32 { #[inline] fn nan() -> f32 { NAN } @@ -177,43 +178,53 @@ impl Float for f32 { } #[inline] - #[deprecated] + #[unstable(feature = "core")] + #[deprecated(since = "1.0.0")] fn mantissa_digits(_: Option<f32>) -> uint { MANTISSA_DIGITS } #[inline] - #[deprecated] + #[unstable(feature = "core")] + #[deprecated(since = "1.0.0")] fn digits(_: Option<f32>) -> uint { DIGITS } #[inline] - #[deprecated] + #[unstable(feature = "core")] + #[deprecated(since = "1.0.0")] fn epsilon() -> f32 { EPSILON } #[inline] - #[deprecated] + #[unstable(feature = "core")] + #[deprecated(since = "1.0.0")] fn min_exp(_: Option<f32>) -> int { MIN_EXP } #[inline] - #[deprecated] + #[unstable(feature = "core")] + #[deprecated(since = "1.0.0")] fn max_exp(_: Option<f32>) -> int { MAX_EXP } #[inline] - #[deprecated] + #[unstable(feature = "core")] + #[deprecated(since = "1.0.0")] fn min_10_exp(_: Option<f32>) -> int { MIN_10_EXP } #[inline] - #[deprecated] + #[unstable(feature = "core")] + #[deprecated(since = "1.0.0")] fn max_10_exp(_: Option<f32>) -> int { MAX_10_EXP } #[inline] - #[deprecated] + #[unstable(feature = "core")] + #[deprecated(since = "1.0.0")] fn min_value() -> f32 { MIN_VALUE } #[inline] - #[deprecated] + #[unstable(feature = "core")] + #[deprecated(since = "1.0.0")] fn min_pos_value(_: Option<f32>) -> f32 { MIN_POS_VALUE } #[inline] - #[deprecated] + #[unstable(feature = "core")] + #[deprecated(since = "1.0.0")] fn max_value() -> f32 { MAX_VALUE } /// Returns the mantissa, exponent and sign as integers. diff --git a/src/libcore/num/f64.rs b/src/libcore/num/f64.rs index a7f0266b095..ce011b3c2ee 100644 --- a/src/libcore/num/f64.rs +++ b/src/libcore/num/f64.rs @@ -14,7 +14,7 @@ // FIXME: MIN_VALUE and MAX_VALUE literals are parsed as -inf and inf #14353 #![allow(overflowing_literals)] -#![stable] +#![stable(feature = "rust1", since = "1.0.0")] use intrinsics; use mem; @@ -26,45 +26,46 @@ use option::Option; // constants are implemented in favour of referencing the respective // members of `Bounded` and `Float`. -#[unstable = "pending integer conventions"] +#[unstable(feature = "core", reason = "pending integer conventions")] pub const RADIX: uint = 2; pub const MANTISSA_DIGITS: uint = 53; -#[unstable = "pending integer conventions"] +#[unstable(feature = "core", reason = "pending integer conventions")] pub const DIGITS: uint = 15; -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub const EPSILON: f64 = 2.2204460492503131e-16_f64; /// Smallest finite f64 value -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub const MIN_VALUE: f64 = -1.7976931348623157e+308_f64; /// Smallest positive, normalized f64 value -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub const MIN_POS_VALUE: f64 = 2.2250738585072014e-308_f64; /// Largest finite f64 value -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub const MAX_VALUE: f64 = 1.7976931348623157e+308_f64; -#[unstable = "pending integer conventions"] +#[unstable(feature = "core", reason = "pending integer conventions")] pub const MIN_EXP: int = -1021; -#[unstable = "pending integer conventions"] +#[unstable(feature = "core", reason = "pending integer conventions")] pub const MAX_EXP: int = 1024; -#[unstable = "pending integer conventions"] +#[unstable(feature = "core", reason = "pending integer conventions")] pub const MIN_10_EXP: int = -307; -#[unstable = "pending integer conventions"] +#[unstable(feature = "core", reason = "pending integer conventions")] pub const MAX_10_EXP: int = 308; -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub const NAN: f64 = 0.0_f64/0.0_f64; -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub const INFINITY: f64 = 1.0_f64/0.0_f64; -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub const NEG_INFINITY: f64 = -1.0_f64/0.0_f64; /// Various useful constants. -#[unstable = "naming scheme needs to be revisited"] +#[unstable(feature = "core", + reason = "naming scheme needs to be revisited")] pub mod consts { // FIXME: replace with mathematical constants from cmath. @@ -124,7 +125,7 @@ pub mod consts { pub const LN_10: f64 = 2.30258509299404568401799145468436421_f64; } -#[unstable = "trait is unstable"] +#[unstable(feature = "core", reason = "trait is unstable")] impl Float for f64 { #[inline] fn nan() -> f64 { NAN } @@ -184,43 +185,53 @@ impl Float for f64 { } #[inline] - #[deprecated] + #[unstable(feature = "core")] + #[deprecated(since = "1.0.0")] fn mantissa_digits(_: Option<f64>) -> uint { MANTISSA_DIGITS } #[inline] - #[deprecated] + #[unstable(feature = "core")] + #[deprecated(since = "1.0.0")] fn digits(_: Option<f64>) -> uint { DIGITS } #[inline] - #[deprecated] + #[unstable(feature = "core")] + #[deprecated(since = "1.0.0")] fn epsilon() -> f64 { EPSILON } #[inline] - #[deprecated] + #[unstable(feature = "core")] + #[deprecated(since = "1.0.0")] fn min_exp(_: Option<f64>) -> int { MIN_EXP } #[inline] - #[deprecated] + #[unstable(feature = "core")] + #[deprecated(since = "1.0.0")] fn max_exp(_: Option<f64>) -> int { MAX_EXP } #[inline] - #[deprecated] + #[unstable(feature = "core")] + #[deprecated(since = "1.0.0")] fn min_10_exp(_: Option<f64>) -> int { MIN_10_EXP } #[inline] - #[deprecated] + #[unstable(feature = "core")] + #[deprecated(since = "1.0.0")] fn max_10_exp(_: Option<f64>) -> int { MAX_10_EXP } #[inline] - #[deprecated] + #[unstable(feature = "core")] + #[deprecated(since = "1.0.0")] fn min_value() -> f64 { MIN_VALUE } #[inline] - #[deprecated] + #[unstable(feature = "core")] + #[deprecated(since = "1.0.0")] fn min_pos_value(_: Option<f64>) -> f64 { MIN_POS_VALUE } #[inline] - #[deprecated] + #[unstable(feature = "core")] + #[deprecated(since = "1.0.0")] fn max_value() -> f64 { MAX_VALUE } /// Returns the mantissa, exponent and sign as integers. diff --git a/src/libcore/num/i16.rs b/src/libcore/num/i16.rs index eb2a4c3835d..5ea60d0d96d 100644 --- a/src/libcore/num/i16.rs +++ b/src/libcore/num/i16.rs @@ -10,7 +10,7 @@ //! Operations and constants for signed 16-bits integers (`i16` type) -#![stable] +#![stable(feature = "rust1", since = "1.0.0")] #![doc(primitive = "i16")] int_module! { i16, 16 } diff --git a/src/libcore/num/i32.rs b/src/libcore/num/i32.rs index 849fa205756..7d9faa998c1 100644 --- a/src/libcore/num/i32.rs +++ b/src/libcore/num/i32.rs @@ -10,7 +10,7 @@ //! Operations and constants for signed 32-bits integers (`i32` type) -#![stable] +#![stable(feature = "rust1", since = "1.0.0")] #![doc(primitive = "i32")] int_module! { i32, 32 } diff --git a/src/libcore/num/i64.rs b/src/libcore/num/i64.rs index b6cba728e44..5a70911387b 100644 --- a/src/libcore/num/i64.rs +++ b/src/libcore/num/i64.rs @@ -10,7 +10,7 @@ //! Operations and constants for signed 64-bits integers (`i64` type) -#![stable] +#![stable(feature = "rust1", since = "1.0.0")] #![doc(primitive = "i64")] int_module! { i64, 64 } diff --git a/src/libcore/num/i8.rs b/src/libcore/num/i8.rs index fd0759898ea..1d7d78ffa6c 100644 --- a/src/libcore/num/i8.rs +++ b/src/libcore/num/i8.rs @@ -10,7 +10,7 @@ //! Operations and constants for signed 8-bits integers (`i8` type) -#![stable] +#![stable(feature = "rust1", since = "1.0.0")] #![doc(primitive = "i8")] int_module! { i8, 8 } diff --git a/src/libcore/num/int.rs b/src/libcore/num/int.rs index 83011db35ce..2132b9516ab 100644 --- a/src/libcore/num/int.rs +++ b/src/libcore/num/int.rs @@ -14,7 +14,8 @@ //! alpha cycle along with the development of clearer conventions //! around integer types. -#![deprecated = "replaced by isize"] +#![unstable(feature = "core")] +#![deprecated(since = "1.0.0", reason = "replaced by isize")] #[cfg(target_pointer_width = "32")] int_module! { int, 32 } #[cfg(target_pointer_width = "64")] int_module! { int, 64 } diff --git a/src/libcore/num/int_macros.rs b/src/libcore/num/int_macros.rs index 61cd8cbf7c1..954c8a08e64 100644 --- a/src/libcore/num/int_macros.rs +++ b/src/libcore/num/int_macros.rs @@ -14,21 +14,21 @@ macro_rules! int_module { ($T:ty, $bits:expr) => ( // FIXME(#11621): Should be deprecated once CTFE is implemented in favour of // calling the `mem::size_of` function. -#[unstable] +#[unstable(feature = "core")] pub const BITS : uint = $bits; // FIXME(#11621): Should be deprecated once CTFE is implemented in favour of // calling the `mem::size_of` function. -#[unstable] +#[unstable(feature = "core")] pub const BYTES : uint = ($bits / 8); // FIXME(#11621): Should be deprecated once CTFE is implemented in favour of // calling the `Bounded::min_value` function. -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] 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(#11621): Should be deprecated once CTFE is implemented in favour of // calling the `Bounded::max_value` function. -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub const MAX: $T = !MIN; ) } diff --git a/src/libcore/num/isize.rs b/src/libcore/num/isize.rs index e4711c92c59..0fd0d90b125 100644 --- a/src/libcore/num/isize.rs +++ b/src/libcore/num/isize.rs @@ -14,7 +14,7 @@ //! new type will gradually take place over the alpha cycle along with //! the development of clearer conventions around integer types. -#![stable] +#![stable(feature = "rust1", since = "1.0.0")] #![doc(primitive = "isize")] #[cfg(target_pointer_width = "32")] diff --git a/src/libcore/num/mod.rs b/src/libcore/num/mod.rs index 910c9e6c670..9e460492b64 100644 --- a/src/libcore/num/mod.rs +++ b/src/libcore/num/mod.rs @@ -12,7 +12,7 @@ //! Numeric traits and functions for the built-in numeric types. -#![stable] +#![stable(feature = "rust1", since = "1.0.0")] #![allow(missing_docs)] use char::CharExt; @@ -30,7 +30,7 @@ use option::Option::{Some, None}; use str::{FromStr, StrExt}; /// A built-in signed or unsigned integer. -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub trait Int : Copy + Clone + NumCast @@ -50,22 +50,26 @@ pub trait Int { /// Returns the `0` value of this integer type. // FIXME (#5527): Should be an associated constant - #[unstable = "unsure about its place in the world"] + #[unstable(feature = "core", + reason = "unsure about its place in the world")] fn zero() -> Self; /// Returns the `1` value of this integer type. // FIXME (#5527): Should be an associated constant - #[unstable = "unsure about its place in the world"] + #[unstable(feature = "core", + reason = "unsure about its place in the world")] fn one() -> Self; /// Returns the smallest value that can be represented by this integer type. // FIXME (#5527): Should be and associated constant - #[unstable = "unsure about its place in the world"] + #[unstable(feature = "core", + reason = "unsure about its place in the world")] fn min_value() -> Self; /// Returns the largest value that can be represented by this integer type. // FIXME (#5527): Should be and associated constant - #[unstable = "unsure about its place in the world"] + #[unstable(feature = "core", + reason = "unsure about its place in the world")] fn max_value() -> Self; /// Returns the number of ones in the binary representation of `self`. @@ -79,7 +83,8 @@ pub trait Int /// /// assert_eq!(n.count_ones(), 3); /// ``` - #[unstable = "pending integer conventions"] + #[unstable(feature = "core", + reason = "pending integer conventions")] fn count_ones(self) -> uint; /// Returns the number of zeros in the binary representation of `self`. @@ -93,7 +98,8 @@ pub trait Int /// /// assert_eq!(n.count_zeros(), 5); /// ``` - #[unstable = "pending integer conventions"] + #[unstable(feature = "core", + reason = "pending integer conventions")] #[inline] fn count_zeros(self) -> uint { (!self).count_ones() @@ -111,7 +117,8 @@ pub trait Int /// /// assert_eq!(n.leading_zeros(), 10); /// ``` - #[unstable = "pending integer conventions"] + #[unstable(feature = "core", + reason = "pending integer conventions")] fn leading_zeros(self) -> uint; /// Returns the number of trailing zeros in the binary representation @@ -126,7 +133,8 @@ pub trait Int /// /// assert_eq!(n.trailing_zeros(), 3); /// ``` - #[unstable = "pending integer conventions"] + #[unstable(feature = "core", + reason = "pending integer conventions")] fn trailing_zeros(self) -> uint; /// Shifts the bits to the left by a specified amount amount, `n`, wrapping @@ -142,7 +150,8 @@ pub trait Int /// /// assert_eq!(n.rotate_left(12), m); /// ``` - #[unstable = "pending integer conventions"] + #[unstable(feature = "core", + reason = "pending integer conventions")] fn rotate_left(self, n: uint) -> Self; /// Shifts the bits to the right by a specified amount amount, `n`, wrapping @@ -158,7 +167,8 @@ pub trait Int /// /// assert_eq!(n.rotate_right(12), m); /// ``` - #[unstable = "pending integer conventions"] + #[unstable(feature = "core", + reason = "pending integer conventions")] fn rotate_right(self, n: uint) -> Self; /// Reverses the byte order of the integer. @@ -173,7 +183,7 @@ pub trait Int /// /// assert_eq!(n.swap_bytes(), m); /// ``` - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] fn swap_bytes(self) -> Self; /// Convert an integer from big endian to the target's endianness. @@ -193,7 +203,7 @@ pub trait Int /// assert_eq!(Int::from_be(n), n.swap_bytes()) /// } /// ``` - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] #[inline] fn from_be(x: Self) -> Self { if cfg!(target_endian = "big") { x } else { x.swap_bytes() } @@ -216,7 +226,7 @@ pub trait Int /// assert_eq!(Int::from_le(n), n.swap_bytes()) /// } /// ``` - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] #[inline] fn from_le(x: Self) -> Self { if cfg!(target_endian = "little") { x } else { x.swap_bytes() } @@ -239,7 +249,7 @@ pub trait Int /// assert_eq!(n.to_be(), n.swap_bytes()) /// } /// ``` - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] #[inline] fn to_be(self) -> Self { // or not to be? if cfg!(target_endian = "big") { self } else { self.swap_bytes() } @@ -262,7 +272,7 @@ pub trait Int /// assert_eq!(n.to_le(), n.swap_bytes()) /// } /// ``` - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] #[inline] fn to_le(self) -> Self { if cfg!(target_endian = "little") { self } else { self.swap_bytes() } @@ -279,7 +289,7 @@ pub trait Int /// assert_eq!(5u16.checked_add(65530), Some(65535)); /// assert_eq!(6u16.checked_add(65530), None); /// ``` - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] fn checked_add(self, other: Self) -> Option<Self>; /// Checked integer subtraction. Computes `self - other`, returning `None` @@ -293,7 +303,7 @@ pub trait Int /// assert_eq!((-127i8).checked_sub(1), Some(-128)); /// assert_eq!((-128i8).checked_sub(1), None); /// ``` - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] fn checked_sub(self, other: Self) -> Option<Self>; /// Checked integer multiplication. Computes `self * other`, returning @@ -307,7 +317,7 @@ pub trait Int /// assert_eq!(5u8.checked_mul(51), Some(255)); /// assert_eq!(5u8.checked_mul(52), None); /// ``` - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] fn checked_mul(self, other: Self) -> Option<Self>; /// Checked integer division. Computes `self / other`, returning `None` if @@ -322,12 +332,12 @@ pub trait Int /// assert_eq!((-128i8).checked_div(-1), None); /// assert_eq!((1i8).checked_div(0), None); /// ``` - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] fn checked_div(self, other: Self) -> Option<Self>; /// Saturating integer addition. Computes `self + other`, saturating at /// the numeric bounds instead of overflowing. - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] #[inline] fn saturating_add(self, other: Self) -> Self { match self.checked_add(other) { @@ -339,7 +349,7 @@ pub trait Int /// Saturating integer subtraction. Computes `self - other`, saturating at /// the numeric bounds instead of overflowing. - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] #[inline] fn saturating_sub(self, other: Self) -> Self { match self.checked_sub(other) { @@ -358,7 +368,8 @@ pub trait Int /// /// assert_eq!(2.pow(4), 16); /// ``` - #[unstable = "pending integer conventions"] + #[unstable(feature = "core", + reason = "pending integer conventions")] #[inline] fn pow(self, mut exp: uint) -> Self { let mut base = self; @@ -390,7 +401,7 @@ macro_rules! uint_impl { $add_with_overflow:path, $sub_with_overflow:path, $mul_with_overflow:path) => { - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] impl Int for $T { #[inline] fn zero() -> $T { 0 } @@ -521,7 +532,7 @@ macro_rules! int_impl { $add_with_overflow:path, $sub_with_overflow:path, $mul_with_overflow:path) => { - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] impl Int for $T { #[inline] fn zero() -> $T { 0 } @@ -614,14 +625,14 @@ int_impl! { int = i64, u64, 64, intrinsics::i64_mul_with_overflow } /// A built-in two's complement integer. -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub trait SignedInt : Int + Neg<Output=Self> { /// Computes the absolute value of `self`. `Int::min_value()` will be /// returned if the number is `Int::min_value()`. - #[unstable = "overflow in debug builds?"] + #[unstable(feature = "core", reason = "overflow in debug builds?")] fn abs(self) -> Self; /// Returns a number representing sign of `self`. @@ -629,23 +640,23 @@ pub trait SignedInt /// - `0` if the number is zero /// - `1` if the number is positive /// - `-1` if the number is negative - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] fn signum(self) -> Self; /// Returns `true` if `self` is positive and `false` if the number /// is zero or negative. - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] fn is_positive(self) -> bool; /// Returns `true` if `self` is negative and `false` if the number /// is zero or positive. - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] fn is_negative(self) -> bool; } macro_rules! signed_int_impl { ($T:ty) => { - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] impl SignedInt for $T { #[inline] fn abs(self) -> $T { @@ -677,10 +688,10 @@ signed_int_impl! { i64 } signed_int_impl! { int } /// A built-in unsigned integer. -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub trait UnsignedInt: Int { /// Returns `true` iff `self == 2^k` for some `k`. - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] #[inline] fn is_power_of_two(self) -> bool { (self - Int::one()) & self == Int::zero() && !(self == Int::zero()) @@ -688,7 +699,7 @@ pub trait UnsignedInt: Int { /// Returns the smallest power of two greater than or equal to `self`. /// Unspecified behavior on overflow. - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] #[inline] fn next_power_of_two(self) -> Self { let bits = size_of::<Self>() * 8; @@ -699,7 +710,7 @@ pub trait UnsignedInt: Int { /// 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 /// returned, otherwise the power of two is wrapped in `Some`. - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] fn checked_next_power_of_two(self) -> Option<Self> { let npot = self.next_power_of_two(); if npot >= self { @@ -710,23 +721,23 @@ pub trait UnsignedInt: Int { } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl UnsignedInt for uint {} -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl UnsignedInt for u8 {} -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl UnsignedInt for u16 {} -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl UnsignedInt for u32 {} -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl UnsignedInt for u64 {} /// A generic trait for converting a value to a number. -#[unstable = "trait is likely to be removed"] +#[unstable(feature = "core", reason = "trait is likely to be removed")] pub trait ToPrimitive { /// Converts the value of `self` to an `int`. #[inline] @@ -991,7 +1002,7 @@ impl_to_primitive_float! { f32 } impl_to_primitive_float! { f64 } /// A generic trait for converting a number to a value. -#[unstable = "trait is likely to be removed"] +#[unstable(feature = "core", reason = "trait is likely to be removed")] pub trait FromPrimitive : ::marker::Sized { /// Convert an `int` to return an optional value of this type. If the /// value cannot be represented by this value, the `None` is returned. @@ -1073,73 +1084,73 @@ pub trait FromPrimitive : ::marker::Sized { } /// A utility function that just calls `FromPrimitive::from_int`. -#[unstable = "likely to be removed"] +#[unstable(feature = "core", reason = "likely to be removed")] pub fn from_int<A: FromPrimitive>(n: int) -> Option<A> { FromPrimitive::from_int(n) } /// A utility function that just calls `FromPrimitive::from_i8`. -#[unstable = "likely to be removed"] +#[unstable(feature = "core", reason = "likely to be removed")] pub fn from_i8<A: FromPrimitive>(n: i8) -> Option<A> { FromPrimitive::from_i8(n) } /// A utility function that just calls `FromPrimitive::from_i16`. -#[unstable = "likely to be removed"] +#[unstable(feature = "core", reason = "likely to be removed")] pub fn from_i16<A: FromPrimitive>(n: i16) -> Option<A> { FromPrimitive::from_i16(n) } /// A utility function that just calls `FromPrimitive::from_i32`. -#[unstable = "likely to be removed"] +#[unstable(feature = "core", reason = "likely to be removed")] pub fn from_i32<A: FromPrimitive>(n: i32) -> Option<A> { FromPrimitive::from_i32(n) } /// A utility function that just calls `FromPrimitive::from_i64`. -#[unstable = "likely to be removed"] +#[unstable(feature = "core", reason = "likely to be removed")] pub fn from_i64<A: FromPrimitive>(n: i64) -> Option<A> { FromPrimitive::from_i64(n) } /// A utility function that just calls `FromPrimitive::from_uint`. -#[unstable = "likely to be removed"] +#[unstable(feature = "core", reason = "likely to be removed")] pub fn from_uint<A: FromPrimitive>(n: uint) -> Option<A> { FromPrimitive::from_uint(n) } /// A utility function that just calls `FromPrimitive::from_u8`. -#[unstable = "likely to be removed"] +#[unstable(feature = "core", reason = "likely to be removed")] pub fn from_u8<A: FromPrimitive>(n: u8) -> Option<A> { FromPrimitive::from_u8(n) } /// A utility function that just calls `FromPrimitive::from_u16`. -#[unstable = "likely to be removed"] +#[unstable(feature = "core", reason = "likely to be removed")] pub fn from_u16<A: FromPrimitive>(n: u16) -> Option<A> { FromPrimitive::from_u16(n) } /// A utility function that just calls `FromPrimitive::from_u32`. -#[unstable = "likely to be removed"] +#[unstable(feature = "core", reason = "likely to be removed")] pub fn from_u32<A: FromPrimitive>(n: u32) -> Option<A> { FromPrimitive::from_u32(n) } /// A utility function that just calls `FromPrimitive::from_u64`. -#[unstable = "likely to be removed"] +#[unstable(feature = "core", reason = "likely to be removed")] pub fn from_u64<A: FromPrimitive>(n: u64) -> Option<A> { FromPrimitive::from_u64(n) } /// A utility function that just calls `FromPrimitive::from_f32`. -#[unstable = "likely to be removed"] +#[unstable(feature = "core", reason = "likely to be removed")] pub fn from_f32<A: FromPrimitive>(n: f32) -> Option<A> { FromPrimitive::from_f32(n) } /// A utility function that just calls `FromPrimitive::from_f64`. -#[unstable = "likely to be removed"] +#[unstable(feature = "core", reason = "likely to be removed")] pub fn from_f64<A: FromPrimitive>(n: f64) -> Option<A> { FromPrimitive::from_f64(n) } @@ -1190,13 +1201,13 @@ impl_from_primitive! { f64, to_f64 } /// ``` /// #[inline] -#[unstable = "likely to be removed"] +#[unstable(feature = "core", reason = "likely to be removed")] pub fn cast<T: NumCast,U: NumCast>(n: T) -> Option<U> { NumCast::from(n) } /// An interface for casting between machine scalars. -#[unstable = "trait is likely to be removed"] +#[unstable(feature = "core", reason = "trait is likely to be removed")] pub trait NumCast: ToPrimitive { /// Creates a number from another value that can be converted into a primitive via the /// `ToPrimitive` trait. @@ -1231,7 +1242,7 @@ impl_num_cast! { f64, to_f64 } /// Used for representing the classification of floating point numbers #[derive(Copy, PartialEq, Show)] -#[unstable = "may be renamed"] +#[unstable(feature = "core", reason = "may be renamed")] pub enum FpCategory { /// "Not a Number", often obtained by dividing by zero Nan, @@ -1251,7 +1262,8 @@ pub enum FpCategory { // // FIXME(#8888): Several of these functions have a parameter named // `unused_self`. Removing it requires #8888 to be fixed. -#[unstable = "distribution of methods between core/std is unclear"] +#[unstable(feature = "core", + reason = "distribution of methods between core/std is unclear")] pub trait Float : Copy + Clone + NumCast @@ -1280,34 +1292,56 @@ pub trait Float // FIXME (#5527): These should be associated constants /// Returns the number of binary digits of mantissa that this type supports. - #[deprecated = "use `std::f32::MANTISSA_DIGITS` or `std::f64::MANTISSA_DIGITS` as appropriate"] + #[unstable(feature = "core")] + #[deprecated(since = "1.0.0", + reason = "use `std::f32::MANTISSA_DIGITS` or \ + `std::f64::MANTISSA_DIGITS` as appropriate")] fn mantissa_digits(unused_self: Option<Self>) -> uint; /// Returns the number of base-10 digits of precision that this type supports. - #[deprecated = "use `std::f32::DIGITS` or `std::f64::DIGITS` as appropriate"] + #[unstable(feature = "core")] + #[deprecated(since = "1.0.0", + reason = "use `std::f32::DIGITS` or `std::f64::DIGITS` as appropriate")] fn digits(unused_self: Option<Self>) -> uint; /// Returns the difference between 1.0 and the smallest representable number larger than 1.0. - #[deprecated = "use `std::f32::EPSILON` or `std::f64::EPSILON` as appropriate"] + #[unstable(feature = "core")] + #[deprecated(since = "1.0.0", + reason = "use `std::f32::EPSILON` or `std::f64::EPSILON` as appropriate")] fn epsilon() -> Self; /// Returns the minimum binary exponent that this type can represent. - #[deprecated = "use `std::f32::MIN_EXP` or `std::f64::MIN_EXP` as appropriate"] + #[unstable(feature = "core")] + #[deprecated(since = "1.0.0", + reason = "use `std::f32::MIN_EXP` or `std::f64::MIN_EXP` as appropriate")] fn min_exp(unused_self: Option<Self>) -> int; /// Returns the maximum binary exponent that this type can represent. - #[deprecated = "use `std::f32::MAX_EXP` or `std::f64::MAX_EXP` as appropriate"] + #[unstable(feature = "core")] + #[deprecated(since = "1.0.0", + reason = "use `std::f32::MAX_EXP` or `std::f64::MAX_EXP` as appropriate")] fn max_exp(unused_self: Option<Self>) -> int; /// Returns the minimum base-10 exponent that this type can represent. - #[deprecated = "use `std::f32::MIN_10_EXP` or `std::f64::MIN_10_EXP` as appropriate"] + #[unstable(feature = "core")] + #[deprecated(since = "1.0.0", + reason = "use `std::f32::MIN_10_EXP` or `std::f64::MIN_10_EXP` as appropriate")] fn min_10_exp(unused_self: Option<Self>) -> int; /// Returns the maximum base-10 exponent that this type can represent. - #[deprecated = "use `std::f32::MAX_10_EXP` or `std::f64::MAX_10_EXP` as appropriate"] + #[unstable(feature = "core")] + #[deprecated(since = "1.0.0", + reason = "use `std::f32::MAX_10_EXP` or `std::f64::MAX_10_EXP` as appropriate")] fn max_10_exp(unused_self: Option<Self>) -> int; /// Returns the smallest finite value that this type can represent. - #[deprecated = "use `std::f32::MIN_VALUE` or `std::f64::MIN_VALUE` as appropriate"] + #[unstable(feature = "core")] + #[deprecated(since = "1.0.0", + reason = "use `std::f32::MIN_VALUE` or `std::f64::MIN_VALUE` as appropriate")] fn min_value() -> Self; /// Returns the smallest normalized positive number that this type can represent. - #[deprecated = "use `std::f32::MIN_POS_VALUE` or `std::f64::MIN_POS_VALUE` as appropriate"] + #[unstable(feature = "core")] + #[deprecated(since = "1.0.0", + reason = "use `std::f32::MIN_POS_VALUE` or \ + `std::f64::MIN_POS_VALUE` as appropriate")] fn min_pos_value(unused_self: Option<Self>) -> Self; /// Returns the largest finite value that this type can represent. - #[deprecated = "use `std::f32::MAX_VALUE` or `std::f64::MAX_VALUE` as appropriate"] + #[unstable(feature = "core")] + #[deprecated(since = "1.0.0", + reason = "use `std::f32::MAX_VALUE` or `std::f64::MAX_VALUE` as appropriate")] fn max_value() -> Self; /// Returns true if this value is NaN and false otherwise. @@ -1394,20 +1428,21 @@ pub trait Float } /// A generic trait for converting a string with a radix (base) to a value -#[unstable = "might need to return Result"] +#[unstable(feature = "core", reason = "might need to return Result")] pub trait FromStrRadix { fn from_str_radix(str: &str, radix: uint) -> Option<Self>; } /// A utility function that just calls FromStrRadix::from_str_radix. -#[unstable = "might need to return Result"] +#[unstable(feature = "core", reason = "might need to return Result")] pub fn from_str_radix<T: FromStrRadix>(str: &str, radix: uint) -> Option<T> { FromStrRadix::from_str_radix(str, radix) } macro_rules! from_str_radix_float_impl { ($T:ty) => { - #[unstable = "might need to return Result"] + #[unstable(feature = "core", + reason = "might need to return Result")] impl FromStr for $T { /// Convert a string in base 10 to a float. /// Accepts an optional decimal exponent. @@ -1440,7 +1475,8 @@ macro_rules! from_str_radix_float_impl { } } - #[unstable = "might need to return Result"] + #[unstable(feature = "core", + reason = "might need to return Result")] impl FromStrRadix for $T { /// Convert a string in a given base to a float. /// @@ -1604,7 +1640,8 @@ from_str_radix_float_impl! { f64 } macro_rules! from_str_radix_int_impl { ($T:ty) => { - #[unstable = "might need to return Result"] + #[unstable(feature = "core", + reason = "might need to return Result")] impl FromStr for $T { #[inline] fn from_str(src: &str) -> Option<$T> { @@ -1612,7 +1649,8 @@ macro_rules! from_str_radix_int_impl { } } - #[unstable = "might need to return Result"] + #[unstable(feature = "core", + reason = "might need to return Result")] impl FromStrRadix for $T { fn from_str_radix(src: &str, radix: uint) -> Option<$T> { assert!(radix >= 2 && radix <= 36, diff --git a/src/libcore/num/u16.rs b/src/libcore/num/u16.rs index 730a24a963a..21635799a77 100644 --- a/src/libcore/num/u16.rs +++ b/src/libcore/num/u16.rs @@ -10,7 +10,7 @@ //! Operations and constants for unsigned 16-bits integers (`u16` type) -#![stable] +#![stable(feature = "rust1", since = "1.0.0")] #![doc(primitive = "u16")] uint_module! { u16, i16, 16 } diff --git a/src/libcore/num/u32.rs b/src/libcore/num/u32.rs index f308122af43..7d520770503 100644 --- a/src/libcore/num/u32.rs +++ b/src/libcore/num/u32.rs @@ -10,7 +10,7 @@ //! Operations and constants for unsigned 32-bits integers (`u32` type) -#![stable] +#![stable(feature = "rust1", since = "1.0.0")] #![doc(primitive = "u32")] uint_module! { u32, i32, 32 } diff --git a/src/libcore/num/u64.rs b/src/libcore/num/u64.rs index a55868eb746..f10822077dc 100644 --- a/src/libcore/num/u64.rs +++ b/src/libcore/num/u64.rs @@ -10,7 +10,7 @@ //! Operations and constants for unsigned 64-bits integer (`u64` type) -#![stable] +#![stable(feature = "rust1", since = "1.0.0")] #![doc(primitive = "u64")] uint_module! { u64, i64, 64 } diff --git a/src/libcore/num/u8.rs b/src/libcore/num/u8.rs index 8643f8ad650..3d6922b07b1 100644 --- a/src/libcore/num/u8.rs +++ b/src/libcore/num/u8.rs @@ -10,7 +10,7 @@ //! Operations and constants for unsigned 8-bits integers (`u8` type) -#![stable] +#![stable(feature = "rust1", since = "1.0.0")] #![doc(primitive = "u8")] uint_module! { u8, i8, 8 } diff --git a/src/libcore/num/uint.rs b/src/libcore/num/uint.rs index 7931890ca5e..f66a0eed971 100644 --- a/src/libcore/num/uint.rs +++ b/src/libcore/num/uint.rs @@ -14,6 +14,7 @@ //! alpha cycle along with the development of clearer conventions //! around integer types. -#![deprecated = "replaced by usize"] +#![unstable(feature = "core")] +#![deprecated(since = "1.0.0", reason = "replaced by usize")] uint_module! { uint, int, ::int::BITS } diff --git a/src/libcore/num/uint_macros.rs b/src/libcore/num/uint_macros.rs index 535765840a0..06502be54aa 100644 --- a/src/libcore/num/uint_macros.rs +++ b/src/libcore/num/uint_macros.rs @@ -12,14 +12,14 @@ macro_rules! uint_module { ($T:ty, $T_SIGNED:ty, $bits:expr) => ( -#[unstable] +#[unstable(feature = "core")] pub const BITS : uint = $bits; -#[unstable] +#[unstable(feature = "core")] pub const BYTES : uint = ($bits / 8); -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub const MIN: $T = 0 as $T; -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub const MAX: $T = 0 as $T - 1 as $T; ) } diff --git a/src/libcore/num/usize.rs b/src/libcore/num/usize.rs index 5eebcd51a77..602ef4fe45e 100644 --- a/src/libcore/num/usize.rs +++ b/src/libcore/num/usize.rs @@ -14,7 +14,7 @@ //! new type will gradually take place over the alpha cycle along with //! the development of clearer conventions around integer types. -#![stable] +#![stable(feature = "rust1", since = "1.0.0")] #![doc(primitive = "usize")] uint_module! { usize, isize, ::isize::BITS } diff --git a/src/libcore/ops.rs b/src/libcore/ops.rs index 130db7d8ce6..bbb964508b4 100644 --- a/src/libcore/ops.rs +++ b/src/libcore/ops.rs @@ -65,7 +65,7 @@ //! See the documentation for each trait for a minimum implementation that prints //! something to the screen. -#![stable] +#![stable(feature = "rust1", since = "1.0.0")] use marker::Sized; use fmt; @@ -92,10 +92,10 @@ use fmt; /// } /// ``` #[lang="drop"] -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub trait Drop { /// The `drop` method, called when the value goes out of scope. - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] fn drop(&mut self); } @@ -103,7 +103,8 @@ pub trait Drop { // based on "op T" where T is expected to be `Copy`able macro_rules! forward_ref_unop { (impl $imp:ident, $method:ident for $t:ty) => { - #[unstable = "recently added, waiting for dust to settle"] + #[unstable(feature = "core", + reason = "recently added, waiting for dust to settle")] impl<'a> $imp for &'a $t { type Output = <$t as $imp>::Output; @@ -119,7 +120,8 @@ macro_rules! forward_ref_unop { // based on "T op U" where T and U are expected to be `Copy`able macro_rules! forward_ref_binop { (impl $imp:ident, $method:ident for $t:ty, $u:ty) => { - #[unstable = "recently added, waiting for dust to settle"] + #[unstable(feature = "core", + reason = "recently added, waiting for dust to settle")] impl<'a> $imp<$u> for &'a $t { type Output = <$t as $imp<$u>>::Output; @@ -129,7 +131,8 @@ macro_rules! forward_ref_binop { } } - #[unstable = "recently added, waiting for dust to settle"] + #[unstable(feature = "core", + reason = "recently added, waiting for dust to settle")] impl<'a> $imp<&'a $u> for $t { type Output = <$t as $imp<$u>>::Output; @@ -139,7 +142,8 @@ macro_rules! forward_ref_binop { } } - #[unstable = "recently added, waiting for dust to settle"] + #[unstable(feature = "core", + reason = "recently added, waiting for dust to settle")] impl<'a, 'b> $imp<&'a $u> for &'b $t { type Output = <$t as $imp<$u>>::Output; @@ -178,19 +182,19 @@ macro_rules! forward_ref_binop { /// } /// ``` #[lang="add"] -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub trait Add<RHS=Self> { - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] type Output; /// The method for the `+` operator - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] fn add(self, rhs: RHS) -> Self::Output; } macro_rules! add_impl { ($($t:ty)*) => ($( - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] impl Add for $t { type Output = $t; @@ -231,19 +235,19 @@ add_impl! { uint u8 u16 u32 u64 int i8 i16 i32 i64 f32 f64 } /// } /// ``` #[lang="sub"] -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub trait Sub<RHS=Self> { - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] type Output; /// The method for the `-` operator - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] fn sub(self, rhs: RHS) -> Self::Output; } macro_rules! sub_impl { ($($t:ty)*) => ($( - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] impl Sub for $t { type Output = $t; @@ -284,19 +288,19 @@ sub_impl! { uint u8 u16 u32 u64 int i8 i16 i32 i64 f32 f64 } /// } /// ``` #[lang="mul"] -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub trait Mul<RHS=Self> { - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] type Output; /// The method for the `*` operator - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] fn mul(self, rhs: RHS) -> Self::Output; } macro_rules! mul_impl { ($($t:ty)*) => ($( - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] impl Mul for $t { type Output = $t; @@ -337,19 +341,19 @@ mul_impl! { uint u8 u16 u32 u64 int i8 i16 i32 i64 f32 f64 } /// } /// ``` #[lang="div"] -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub trait Div<RHS=Self> { - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] type Output; /// The method for the `/` operator - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] fn div(self, rhs: RHS) -> Self::Output; } macro_rules! div_impl { ($($t:ty)*) => ($( - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] impl Div for $t { type Output = $t; @@ -390,19 +394,19 @@ div_impl! { uint u8 u16 u32 u64 int i8 i16 i32 i64 f32 f64 } /// } /// ``` #[lang="rem"] -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub trait Rem<RHS=Self> { - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] type Output = Self; /// The method for the `%` operator - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] fn rem(self, rhs: RHS) -> Self::Output; } macro_rules! rem_impl { ($($t:ty)*) => ($( - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] impl Rem for $t { type Output = $t; @@ -416,7 +420,7 @@ macro_rules! rem_impl { macro_rules! rem_float_impl { ($t:ty, $fmod:ident) => { - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] impl Rem for $t { type Output = $t; @@ -462,25 +466,25 @@ rem_float_impl! { f64, fmod } /// } /// ``` #[lang="neg"] -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub trait Neg { - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] type Output; /// The method for the unary `-` operator - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] fn neg(self) -> Self::Output; } macro_rules! neg_impl { ($($t:ty)*) => ($( - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] impl Neg for $t { - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] type Output = $t; #[inline] - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] fn neg(self) -> $t { -self } } @@ -490,7 +494,7 @@ macro_rules! neg_impl { macro_rules! neg_uint_impl { ($t:ty, $t_signed:ty) => { - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] impl Neg for $t { type Output = $t; @@ -538,19 +542,19 @@ neg_uint_impl! { u64, i64 } /// } /// ``` #[lang="not"] -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub trait Not { - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] type Output; /// The method for the unary `!` operator - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] fn not(self) -> Self::Output; } macro_rules! not_impl { ($($t:ty)*) => ($( - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] impl Not for $t { type Output = $t; @@ -591,19 +595,19 @@ not_impl! { bool uint u8 u16 u32 u64 int i8 i16 i32 i64 } /// } /// ``` #[lang="bitand"] -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub trait BitAnd<RHS=Self> { - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] type Output; /// The method for the `&` operator - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] fn bitand(self, rhs: RHS) -> Self::Output; } macro_rules! bitand_impl { ($($t:ty)*) => ($( - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] impl BitAnd for $t { type Output = $t; @@ -644,19 +648,19 @@ bitand_impl! { bool uint u8 u16 u32 u64 int i8 i16 i32 i64 } /// } /// ``` #[lang="bitor"] -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub trait BitOr<RHS=Self> { - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] type Output; /// The method for the `|` operator - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] fn bitor(self, rhs: RHS) -> Self::Output; } macro_rules! bitor_impl { ($($t:ty)*) => ($( - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] impl BitOr for $t { type Output = $t; @@ -697,19 +701,19 @@ bitor_impl! { bool uint u8 u16 u32 u64 int i8 i16 i32 i64 } /// } /// ``` #[lang="bitxor"] -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub trait BitXor<RHS=Self> { - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] type Output; /// The method for the `^` operator - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] fn bitxor(self, rhs: RHS) -> Self::Output; } macro_rules! bitxor_impl { ($($t:ty)*) => ($( - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] impl BitXor for $t { type Output = $t; @@ -750,19 +754,19 @@ bitxor_impl! { bool uint u8 u16 u32 u64 int i8 i16 i32 i64 } /// } /// ``` #[lang="shl"] -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub trait Shl<RHS> { - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] type Output; /// The method for the `<<` operator - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] fn shl(self, rhs: RHS) -> Self::Output; } macro_rules! shl_impl { ($t:ty, $f:ty) => ( - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] impl Shl<$f> for $t { type Output = $t; @@ -821,13 +825,13 @@ shl_impl_all! { u8 u16 u32 u64 usize i8 i16 i32 i64 isize } /// } /// ``` #[lang="shr"] -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub trait Shr<RHS> { - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] type Output; /// The method for the `>>` operator - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] fn shr(self, rhs: RHS) -> Self::Output; } @@ -894,12 +898,12 @@ shr_impl_all! { u8 u16 u32 u64 usize i8 i16 i32 i64 isize } /// ``` #[lang="index"] #[rustc_on_unimplemented = "the type `{Self}` cannot be indexed by `{Index}`"] -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub trait Index<Index: ?Sized> { type Output: ?Sized; /// The method for the indexing (`Foo[Bar]`) operation - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] fn index<'a>(&'a self, index: &Index) -> &'a Self::Output; } @@ -933,22 +937,22 @@ pub trait Index<Index: ?Sized> { /// ``` #[lang="index_mut"] #[rustc_on_unimplemented = "the type `{Self}` cannot be mutably indexed by `{Index}`"] -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub trait IndexMut<Index: ?Sized> { type Output: ?Sized; /// The method for the indexing (`Foo[Bar]`) operation - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] fn index_mut<'a>(&'a mut self, index: &Index) -> &'a mut Self::Output; } /// An unbounded range. #[derive(Copy, Clone, PartialEq, Eq)] #[lang="full_range"] -#[unstable = "may be renamed to RangeFull"] +#[unstable(feature = "core", reason = "may be renamed to RangeFull")] pub struct FullRange; -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl fmt::Debug for FullRange { fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { fmt::Debug::fmt("..", fmt) @@ -958,7 +962,7 @@ impl fmt::Debug for FullRange { /// A (half-open) range which is bounded at both ends. #[derive(Copy, Clone, PartialEq, Eq)] #[lang="range"] -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub struct Range<Idx> { /// The lower bound of the range (inclusive). pub start: Idx, @@ -966,7 +970,7 @@ pub struct Range<Idx> { pub end: Idx, } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<Idx: fmt::Debug> fmt::Debug for Range<Idx> { fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { write!(fmt, "{:?}..{:?}", self.start, self.end) @@ -976,7 +980,7 @@ impl<Idx: fmt::Debug> fmt::Debug for Range<Idx> { /// A range which is only bounded below. #[derive(Copy, Clone, PartialEq, Eq)] #[lang="range_from"] -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub struct RangeFrom<Idx> { /// The lower bound of the range (inclusive). pub start: Idx, @@ -984,7 +988,7 @@ pub struct RangeFrom<Idx> { -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<Idx: fmt::Debug> fmt::Debug for RangeFrom<Idx> { fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { write!(fmt, "{:?}..", self.start) @@ -994,13 +998,13 @@ impl<Idx: fmt::Debug> fmt::Debug for RangeFrom<Idx> { /// A range which is only bounded above. #[derive(Copy, Clone, PartialEq, Eq)] #[lang="range_to"] -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub struct RangeTo<Idx> { /// The upper bound of the range (exclusive). pub end: Idx, } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<Idx: fmt::Debug> fmt::Debug for RangeTo<Idx> { fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { write!(fmt, "..{:?}", self.end) @@ -1037,24 +1041,24 @@ impl<Idx: fmt::Debug> fmt::Debug for RangeTo<Idx> { /// } /// ``` #[lang="deref"] -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub trait Deref { - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] type Target: ?Sized; /// The method called to dereference a value - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] fn deref<'a>(&'a self) -> &'a Self::Target; } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<'a, T: ?Sized> Deref for &'a T { type Target = T; fn deref(&self) -> &T { *self } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<'a, T: ?Sized> Deref for &'a mut T { type Target = T; @@ -1097,42 +1101,49 @@ impl<'a, T: ?Sized> Deref for &'a mut T { /// } /// ``` #[lang="deref_mut"] -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub trait DerefMut: Deref { /// The method called to mutably dereference a value - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] fn deref_mut<'a>(&'a mut self) -> &'a mut Self::Target; } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<'a, T: ?Sized> DerefMut for &'a mut T { fn deref_mut(&mut self) -> &mut T { *self } } /// A version of the call operator that takes an immutable receiver. #[lang="fn"] -#[unstable = "uncertain about variadic generics, input versus associated types"] -pub trait Fn<Args,Result> { +#[unstable(feature = "core", + reason = "uncertain about variadic generics, input versus associated types")] +#[cfg(stage0)] +pub trait Fn<Args,Output> { /// This is called when the call operator is used. - extern "rust-call" fn call(&self, args: Args) -> Result; + extern "rust-call" fn call(&self, args: Args) -> Output; } /// A version of the call operator that takes a mutable receiver. #[lang="fn_mut"] -#[unstable = "uncertain about variadic generics, input versus associated types"] -pub trait FnMut<Args,Result> { +#[unstable(feature = "core", + reason = "uncertain about variadic generics, input versus associated types")] +#[cfg(stage0)] +pub trait FnMut<Args,Output> { /// This is called when the call operator is used. - extern "rust-call" fn call_mut(&mut self, args: Args) -> Result; + extern "rust-call" fn call_mut(&mut self, args: Args) -> Output; } /// A version of the call operator that takes a by-value receiver. #[lang="fn_once"] -#[unstable = "uncertain about variadic generics, input versus associated types"] -pub trait FnOnce<Args,Result> { +#[unstable(feature = "core", + reason = "uncertain about variadic generics, input versus associated types")] +#[cfg(stage0)] +pub trait FnOnce<Args,Output> { /// This is called when the call operator is used. - extern "rust-call" fn call_once(self, args: Args) -> Result; + extern "rust-call" fn call_once(self, args: Args) -> Output; } +#[cfg(stage0)] impl<F: ?Sized, A, R> FnMut<A, R> for F where F : Fn<A, R> { @@ -1141,6 +1152,7 @@ impl<F: ?Sized, A, R> FnMut<A, R> for F } } +#[cfg(stage0)] impl<F,A,R> FnOnce<A,R> for F where F : FnMut<A,R> { @@ -1148,3 +1160,61 @@ impl<F,A,R> FnOnce<A,R> for F self.call_mut(args) } } + +/// A version of the call operator that takes an immutable receiver. +#[lang="fn"] +#[unstable(feature = "core", + reason = "uncertain about variadic generics, input versus associated types")] +#[cfg(not(stage0))] +pub trait Fn<Args> { + type Output; + + /// This is called when the call operator is used. + extern "rust-call" fn call(&self, args: Args) -> Self::Output; +} + +/// A version of the call operator that takes a mutable receiver. +#[lang="fn_mut"] +#[unstable(feature = "core", + reason = "uncertain about variadic generics, input versus associated types")] +#[cfg(not(stage0))] +pub trait FnMut<Args> { + type Output; + + /// This is called when the call operator is used. + extern "rust-call" fn call_mut(&mut self, args: Args) -> Self::Output; +} + +/// A version of the call operator that takes a by-value receiver. +#[lang="fn_once"] +#[unstable(feature = "core", + reason = "uncertain about variadic generics, input versus associated types")] +#[cfg(not(stage0))] +pub trait FnOnce<Args> { + type Output; + + /// This is called when the call operator is used. + extern "rust-call" fn call_once(self, args: Args) -> Self::Output; +} + +#[cfg(not(stage0))] +impl<F: ?Sized, A> FnMut<A> for F + where F : Fn<A> +{ + type Output = <F as Fn<A>>::Output; + + extern "rust-call" fn call_mut(&mut self, args: A) -> <F as Fn<A>>::Output { + self.call(args) + } +} + +#[cfg(not(stage0))] +impl<F,A> FnOnce<A> for F + where F : FnMut<A> +{ + type Output = <F as FnMut<A>>::Output; + + extern "rust-call" fn call_once(mut self, args: A) -> <F as FnMut<A>>::Output { + self.call_mut(args) + } +} diff --git a/src/libcore/option.rs b/src/libcore/option.rs index 3ee2aa678e9..c7266aa4f1a 100644 --- a/src/libcore/option.rs +++ b/src/libcore/option.rs @@ -141,7 +141,7 @@ //! } //! ``` -#![stable] +#![stable(feature = "rust1", since = "1.0.0")] use self::Option::*; @@ -164,13 +164,13 @@ use slice; /// The `Option` type. #[derive(Clone, Copy, PartialEq, PartialOrd, Eq, Ord, Show, Hash)] -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub enum Option<T> { /// No value - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] None, /// Some value `T` - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] Some(T) } @@ -195,7 +195,7 @@ impl<T> Option<T> { /// assert_eq!(x.is_some(), false); /// ``` #[inline] - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] pub fn is_some(&self) -> bool { match *self { Some(_) => true, @@ -215,7 +215,7 @@ impl<T> Option<T> { /// assert_eq!(x.is_none(), true); /// ``` #[inline] - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] pub fn is_none(&self) -> bool { !self.is_some() } @@ -241,7 +241,7 @@ impl<T> Option<T> { /// println!("still can print num_as_str: {:?}", num_as_str); /// ``` #[inline] - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] pub fn as_ref<'r>(&'r self) -> Option<&'r T> { match *self { Some(ref x) => Some(x), @@ -262,7 +262,7 @@ impl<T> Option<T> { /// assert_eq!(x, Some(42)); /// ``` #[inline] - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] pub fn as_mut<'r>(&'r mut self) -> Option<&'r mut T> { match *self { Some(ref mut x) => Some(x), @@ -285,7 +285,8 @@ impl<T> Option<T> { /// assert_eq!(x, Some("Dirt")); /// ``` #[inline] - #[unstable = "waiting for mut conventions"] + #[unstable(feature = "core", + reason = "waiting for mut conventions")] pub fn as_mut_slice<'r>(&'r mut self) -> &'r mut [T] { match *self { Some(ref mut x) => { @@ -322,7 +323,7 @@ impl<T> Option<T> { /// x.expect("the world is ending"); // panics with `world is ending` /// ``` #[inline] - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] pub fn expect(self, msg: &str) -> T { match self { Some(val) => val, @@ -354,7 +355,7 @@ impl<T> Option<T> { /// assert_eq!(x.unwrap(), "air"); // fails /// ``` #[inline] - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] pub fn unwrap(self) -> T { match self { Some(val) => val, @@ -371,7 +372,7 @@ impl<T> Option<T> { /// assert_eq!(None.unwrap_or("bike"), "bike"); /// ``` #[inline] - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] pub fn unwrap_or(self, def: T) -> T { match self { Some(x) => x, @@ -389,7 +390,7 @@ impl<T> Option<T> { /// assert_eq!(None.unwrap_or_else(|| 2 * k), 20); /// ``` #[inline] - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] pub fn unwrap_or_else<F: FnOnce() -> T>(self, f: F) -> T { match self { Some(x) => x, @@ -413,7 +414,7 @@ impl<T> Option<T> { /// let num_as_int: Option<uint> = num_as_str.map(|n| n.len()); /// ``` #[inline] - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] pub fn map<U, F: FnOnce(T) -> U>(self, f: F) -> Option<U> { match self { Some(x) => Some(f(x)), @@ -433,7 +434,7 @@ impl<T> Option<T> { /// assert_eq!(x.map_or(42, |v| v.len()), 42); /// ``` #[inline] - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] pub fn map_or<U, F: FnOnce(T) -> U>(self, def: U, f: F) -> U { match self { Some(t) => f(t), @@ -455,7 +456,7 @@ impl<T> Option<T> { /// assert_eq!(x.map_or_else(|| 2 * k, |v| v.len()), 42); /// ``` #[inline] - #[stable] + #[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 { match self { Some(t) => f(t), @@ -476,7 +477,7 @@ impl<T> Option<T> { /// assert_eq!(x.ok_or(0), Err(0)); /// ``` #[inline] - #[unstable] + #[unstable(feature = "core")] pub fn ok_or<E>(self, err: E) -> Result<T, E> { match self { Some(v) => Ok(v), @@ -497,7 +498,7 @@ impl<T> Option<T> { /// assert_eq!(x.ok_or_else(|| 0), Err(0)); /// ``` #[inline] - #[unstable] + #[unstable(feature = "core")] pub fn ok_or_else<E, F: FnOnce() -> E>(self, err: F) -> Result<T, E> { match self { Some(v) => Ok(v), @@ -521,7 +522,7 @@ impl<T> Option<T> { /// assert_eq!(x.iter().next(), None); /// ``` #[inline] - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] pub fn iter(&self) -> Iter<T> { Iter { inner: Item { opt: self.as_ref() } } } @@ -542,7 +543,8 @@ impl<T> Option<T> { /// assert_eq!(x.iter_mut().next(), None); /// ``` #[inline] - #[unstable = "waiting for iterator conventions"] + #[unstable(feature = "core", + reason = "waiting for iterator conventions")] pub fn iter_mut(&mut self) -> IterMut<T> { IterMut { inner: Item { opt: self.as_mut() } } } @@ -561,7 +563,7 @@ impl<T> Option<T> { /// assert!(v.is_empty()); /// ``` #[inline] - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] pub fn into_iter(self) -> IntoIter<T> { IntoIter { inner: Item { opt: self } } } @@ -592,7 +594,7 @@ impl<T> Option<T> { /// assert_eq!(x.and(y), None); /// ``` #[inline] - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] pub fn and<U>(self, optb: Option<U>) -> Option<U> { match self { Some(_) => optb, @@ -615,7 +617,7 @@ impl<T> Option<T> { /// assert_eq!(None.and_then(sq).and_then(sq), None); /// ``` #[inline] - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] pub fn and_then<U, F: FnOnce(T) -> Option<U>>(self, f: F) -> Option<U> { match self { Some(x) => f(x), @@ -645,7 +647,7 @@ impl<T> Option<T> { /// assert_eq!(x.or(y), None); /// ``` #[inline] - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] pub fn or(self, optb: Option<T>) -> Option<T> { match self { Some(_) => self, @@ -667,7 +669,7 @@ impl<T> Option<T> { /// assert_eq!(None.or_else(nobody), None); /// ``` #[inline] - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] pub fn or_else<F: FnOnce() -> Option<T>>(self, f: F) -> Option<T> { match self { Some(_) => self, @@ -693,7 +695,7 @@ impl<T> Option<T> { /// assert_eq!(x, None); /// ``` #[inline] - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] pub fn take(&mut self) -> Option<T> { mem::replace(self, None) } @@ -702,7 +704,8 @@ impl<T> Option<T> { impl<'a, T: Clone, D: Deref<Target=T>> Option<D> { /// Maps an Option<D> to an Option<T> by dereffing and cloning the contents of the Option. /// Useful for converting an Option<&T> to an Option<T>. - #[unstable = "recently added as part of collections reform"] + #[unstable(feature = "core", + reason = "recently added as part of collections reform")] pub fn cloned(self) -> Option<T> { self.map(|t| t.deref().clone()) } @@ -732,7 +735,7 @@ impl<T: Default> Option<T> { /// assert_eq!(0, bad_year); /// ``` #[inline] - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] pub fn unwrap_or_default(self) -> T { match self { Some(x) => x, @@ -745,7 +748,8 @@ impl<T: Default> Option<T> { // Trait implementations ///////////////////////////////////////////////////////////////////////////// -#[unstable = "waiting on the stability of the trait itself"] +#[unstable(feature = "core", + reason = "waiting on the stability of the trait itself")] impl<T> AsSlice<T> for Option<T> { /// Convert from `Option<T>` to `&[T]` (without copying) #[inline] @@ -760,10 +764,10 @@ impl<T> AsSlice<T> for Option<T> { } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<T> Default for Option<T> { #[inline] - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] fn default() -> Option<T> { None } } @@ -803,10 +807,10 @@ impl<A> DoubleEndedIterator for Item<A> { impl<A> ExactSizeIterator for Item<A> {} /// An iterator over a reference of the contained item in an Option. -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub struct Iter<'a, A: 'a> { inner: Item<&'a A> } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<'a, A> Iterator for Iter<'a, A> { type Item = &'a A; @@ -816,16 +820,16 @@ impl<'a, A> Iterator for Iter<'a, A> { fn size_hint(&self) -> (uint, Option<uint>) { self.inner.size_hint() } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<'a, A> DoubleEndedIterator for Iter<'a, A> { #[inline] fn next_back(&mut self) -> Option<&'a A> { self.inner.next_back() } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<'a, A> ExactSizeIterator for Iter<'a, A> {} -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<'a, A> Clone for Iter<'a, A> { fn clone(&self) -> Iter<'a, A> { Iter { inner: self.inner.clone() } @@ -833,10 +837,10 @@ impl<'a, A> Clone for Iter<'a, A> { } /// An iterator over a mutable reference of the contained item in an Option. -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub struct IterMut<'a, A: 'a> { inner: Item<&'a mut A> } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<'a, A> Iterator for IterMut<'a, A> { type Item = &'a mut A; @@ -846,20 +850,20 @@ impl<'a, A> Iterator for IterMut<'a, A> { fn size_hint(&self) -> (uint, Option<uint>) { self.inner.size_hint() } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<'a, A> DoubleEndedIterator for IterMut<'a, A> { #[inline] fn next_back(&mut self) -> Option<&'a mut A> { self.inner.next_back() } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<'a, A> ExactSizeIterator for IterMut<'a, A> {} /// An iterator over the item contained inside an Option. -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub struct IntoIter<A> { inner: Item<A> } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<A> Iterator for IntoIter<A> { type Item = A; @@ -869,20 +873,20 @@ impl<A> Iterator for IntoIter<A> { fn size_hint(&self) -> (uint, Option<uint>) { self.inner.size_hint() } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<A> DoubleEndedIterator for IntoIter<A> { #[inline] fn next_back(&mut self) -> Option<A> { self.inner.next_back() } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<A> ExactSizeIterator for IntoIter<A> {} ///////////////////////////////////////////////////////////////////////////// // FromIterator ///////////////////////////////////////////////////////////////////////////// -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<A, V: FromIterator<A>> FromIterator<Option<A>> for Option<V> { /// 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 @@ -902,7 +906,7 @@ impl<A, V: FromIterator<A>> FromIterator<Option<A>> for Option<V> { /// assert!(res == Some(vec!(2, 3))); /// ``` #[inline] - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] fn from_iter<I: Iterator<Item=Option<A>>>(iter: I) -> Option<V> { // FIXME(#11084): This could be replaced with Iterator::scan when this // performance bug is closed. diff --git a/src/libcore/ptr.rs b/src/libcore/ptr.rs index 0b89467d63b..9c18cd0f6d9 100644 --- a/src/libcore/ptr.rs +++ b/src/libcore/ptr.rs @@ -86,7 +86,7 @@ //! but C APIs hand out a lot of pointers generally, so are a common source //! of unsafe pointers in Rust. -#![stable] +#![stable(feature = "rust1", since = "1.0.0")] use mem; use clone::Clone; @@ -99,13 +99,14 @@ use cmp::Ordering::{self, Less, Equal, Greater}; // FIXME #19649: intrinsic docs don't render, so these have no docs :( -#[unstable] +#[unstable(feature = "core")] pub use intrinsics::copy_nonoverlapping_memory; -#[unstable] +#[unstable(feature = "core")] pub use intrinsics::copy_memory; -#[unstable = "uncertain about naming and semantics"] +#[unstable(feature = "core", + reason = "uncertain about naming and semantics")] pub use intrinsics::set_memory; @@ -120,7 +121,7 @@ pub use intrinsics::set_memory; /// assert!(p.is_null()); /// ``` #[inline] -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub fn null<T>() -> *const T { 0 as *const T } /// Creates a null mutable raw pointer. @@ -134,7 +135,7 @@ pub fn null<T>() -> *const T { 0 as *const T } /// assert!(p.is_null()); /// ``` #[inline] -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] 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 @@ -145,7 +146,8 @@ pub fn null_mut<T>() -> *mut T { 0 as *mut T } /// Beyond accepting a raw pointer, this is unsafe because it will not drop the /// contents of `dst`, and may be used to create invalid instances of `T`. #[inline] -#[unstable = "may play a larger role in std::ptr future extensions"] +#[unstable(feature = "core", + reason = "may play a larger role in std::ptr future extensions")] pub unsafe fn zero_memory<T>(dst: *mut T, count: uint) { set_memory(dst, 0, count); } @@ -158,7 +160,7 @@ pub unsafe fn zero_memory<T>(dst: *mut T, count: uint) { /// /// This is only unsafe because it accepts a raw pointer. #[inline] -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub unsafe fn swap<T>(x: *mut T, y: *mut T) { // Give ourselves some scratch space to work with let mut tmp: T = mem::uninitialized(); @@ -182,7 +184,7 @@ pub unsafe fn swap<T>(x: *mut T, y: *mut T) { /// This is only unsafe because it accepts a raw pointer. /// Otherwise, this operation is identical to `mem::replace`. #[inline] -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub unsafe fn replace<T>(dest: *mut T, mut src: T) -> T { mem::swap(mem::transmute(dest), &mut src); // cannot overlap src @@ -200,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 /// because it will attempt to drop the value previously at `*src`. #[inline(always)] -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub unsafe fn read<T>(src: *const T) -> T { let mut tmp: T = mem::uninitialized(); copy_nonoverlapping_memory(&mut tmp, src, 1); @@ -213,7 +215,8 @@ pub unsafe fn read<T>(src: *const T) -> T { /// /// This is unsafe for the same reasons that `read` is unsafe. #[inline(always)] -#[unstable = "may play a larger role in std::ptr future extensions"] +#[unstable(feature = "core", + reason = "may play a larger role in std::ptr future extensions")] pub unsafe fn read_and_zero<T>(dest: *mut T) -> T { // Copy the data out from `dest`: let tmp = read(&*dest); @@ -236,18 +239,18 @@ pub unsafe fn read_and_zero<T>(dest: *mut T) -> T { /// This is appropriate for initializing uninitialized memory, or overwriting /// memory that has previously been `read` from. #[inline] -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub unsafe fn write<T>(dst: *mut T, src: T) { intrinsics::move_val_init(&mut *dst, src) } /// Methods on raw pointers -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub trait PtrExt: Sized { type Target; /// Returns true if the pointer is null. - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] fn is_null(self) -> bool; /// Returns `None` if the pointer is null, or else returns a reference to @@ -259,8 +262,9 @@ pub trait PtrExt: Sized { /// null-safety, it is important to note that this is still an unsafe /// operation because the returned value could be pointing to invalid /// memory. - #[unstable = "Option is not clearly the right return type, and we may want \ - to tie the return lifetime to a borrow of the raw pointer"] + #[unstable(feature = "core", + reason = "Option is not clearly the right return type, and we may want \ + to tie the return lifetime to a borrow of the raw pointer")] unsafe fn as_ref<'a>(&self) -> Option<&'a Self::Target>; /// Calculates the offset from a pointer. `count` is in units of T; e.g. a @@ -271,12 +275,12 @@ pub trait PtrExt: Sized { /// The offset must be in-bounds of the object, or one-byte-past-the-end. /// Otherwise `offset` invokes Undefined Behaviour, regardless of whether /// the pointer is used. - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] unsafe fn offset(self, count: int) -> Self; } /// Methods on mutable raw pointers -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub trait MutPtrExt { type Target; @@ -287,28 +291,30 @@ pub trait MutPtrExt { /// /// As with `as_ref`, this is unsafe because it cannot verify the validity /// of the returned pointer. - #[unstable = "Option is not clearly the right return type, and we may want \ - to tie the return lifetime to a borrow of the raw pointer"] + #[unstable(feature = "core", + reason = "Option is not clearly the right return type, and we may want \ + to tie the return lifetime to a borrow of the raw pointer")] unsafe fn as_mut<'a>(&self) -> Option<&'a mut Self::Target>; } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<T> PtrExt for *const T { type Target = T; #[inline] - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] fn is_null(self) -> bool { self as uint == 0 } #[inline] - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] unsafe fn offset(self, count: int) -> *const T { intrinsics::offset(self, count) } #[inline] - #[unstable = "return value does not necessarily convey all possible \ - information"] + #[unstable(feature = "core", + reason = "return value does not necessarily convey all possible \ + information")] unsafe fn as_ref<'a>(&self) -> Option<&'a T> { if self.is_null() { None @@ -318,23 +324,24 @@ impl<T> PtrExt for *const T { } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<T> PtrExt for *mut T { type Target = T; #[inline] - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] fn is_null(self) -> bool { self as uint == 0 } #[inline] - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] unsafe fn offset(self, count: int) -> *mut T { intrinsics::offset(self, count) as *mut T } #[inline] - #[unstable = "return value does not necessarily convey all possible \ - information"] + #[unstable(feature = "core", + reason = "return value does not necessarily convey all possible \ + information")] unsafe fn as_ref<'a>(&self) -> Option<&'a T> { if self.is_null() { None @@ -344,13 +351,14 @@ impl<T> PtrExt for *mut T { } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<T> MutPtrExt for *mut T { type Target = T; #[inline] - #[unstable = "return value does not necessarily convey all possible \ - information"] + #[unstable(feature = "core", + reason = "return value does not necessarily convey all possible \ + information")] unsafe fn as_mut<'a>(&self) -> Option<&'a mut T> { if self.is_null() { None @@ -361,7 +369,7 @@ impl<T> MutPtrExt for *mut T { } // Equality for pointers -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<T> PartialEq for *const T { #[inline] fn eq(&self, other: &*const T) -> bool { @@ -371,10 +379,10 @@ impl<T> PartialEq for *const T { fn ne(&self, other: &*const T) -> bool { !self.eq(other) } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<T> Eq for *const T {} -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<T> PartialEq for *mut T { #[inline] fn eq(&self, other: &*mut T) -> bool { @@ -384,10 +392,10 @@ impl<T> PartialEq for *mut T { fn ne(&self, other: &*mut T) -> bool { !self.eq(other) } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<T> Eq for *mut T {} -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<T> Clone for *const T { #[inline] fn clone(&self) -> *const T { @@ -395,7 +403,7 @@ impl<T> Clone for *const T { } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<T> Clone for *mut T { #[inline] fn clone(&self) -> *mut T { @@ -408,7 +416,7 @@ mod externfnpointers { use mem; use cmp::PartialEq; - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] impl<_R> PartialEq for extern "C" fn() -> _R { #[inline] fn eq(&self, other: &extern "C" fn() -> _R) -> bool { @@ -419,7 +427,7 @@ mod externfnpointers { } macro_rules! fnptreq { ($($p:ident),*) => { - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] impl<_R,$($p),*> PartialEq for extern "C" fn($($p),*) -> _R { #[inline] fn eq(&self, other: &extern "C" fn($($p),*) -> _R) -> bool { @@ -439,7 +447,7 @@ mod externfnpointers { } // Comparison for pointers -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<T> Ord for *const T { #[inline] fn cmp(&self, other: &*const T) -> Ordering { @@ -453,7 +461,7 @@ impl<T> Ord for *const T { } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<T> PartialOrd for *const T { #[inline] fn partial_cmp(&self, other: &*const T) -> Option<Ordering> { @@ -473,7 +481,7 @@ impl<T> PartialOrd for *const T { fn ge(&self, other: &*const T) -> bool { *self >= *other } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<T> Ord for *mut T { #[inline] fn cmp(&self, other: &*mut T) -> Ordering { @@ -487,7 +495,7 @@ impl<T> Ord for *mut T { } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<T> PartialOrd for *mut T { #[inline] fn partial_cmp(&self, other: &*mut T) -> Option<Ordering> { @@ -513,32 +521,34 @@ impl<T> PartialOrd for *mut T { /// raw `*mut T` (which conveys no particular ownership semantics). /// Useful for building abstractions like `Vec<T>` or `Box<T>`, which /// internally use raw pointers to manage the memory that they own. -#[unstable = "recently added to this module"] +#[unstable(feature = "core", reason = "recently added to this module")] pub struct Unique<T>(pub *mut T); /// `Unique` pointers are `Send` if `T` is `Send` because the data they /// reference is unaliased. Note that this aliasing invariant is /// unenforced by the type system; the abstraction using the /// `Unique` must enforce it. -#[unstable = "recently added to this module"] +#[unstable(feature = "core", reason = "recently added to this module")] unsafe impl<T:Send> Send for Unique<T> { } /// `Unique` pointers are `Sync` if `T` is `Sync` because the data they /// reference is unaliased. Note that this aliasing invariant is /// unenforced by the type system; the abstraction using the /// `Unique` must enforce it. -#[unstable = "recently added to this module"] +#[unstable(feature = "core", reason = "recently added to this module")] unsafe impl<T:Sync> Sync for Unique<T> { } impl<T> Unique<T> { /// Returns a null Unique. - #[unstable = "recently added to this module"] + #[unstable(feature = "core", + reason = "recently added to this module")] pub fn null() -> Unique<T> { Unique(null_mut()) } /// Return an (unsafe) pointer into the memory owned by `self`. - #[unstable = "recently added to this module"] + #[unstable(feature = "core", + reason = "recently added to this module")] pub unsafe fn offset(self, offset: int) -> *mut T { self.0.offset(offset) } diff --git a/src/libcore/raw.rs b/src/libcore/raw.rs index 13a387c7cb0..3fd244b46e3 100644 --- a/src/libcore/raw.rs +++ b/src/libcore/raw.rs @@ -9,7 +9,7 @@ // except according to those terms. #![allow(missing_docs)] -#![unstable] +#![unstable(feature = "core")] //! Contains struct definitions for the layout of compiler built-in types. //! diff --git a/src/libcore/result.rs b/src/libcore/result.rs index 28463c0f04c..ade257165c6 100644 --- a/src/libcore/result.rs +++ b/src/libcore/result.rs @@ -224,7 +224,7 @@ //! //! `try!` is imported by the prelude, and is available everywhere. -#![stable] +#![stable(feature = "rust1", since = "1.0.0")] use self::Result::{Ok, Err}; @@ -241,14 +241,14 @@ use slice; /// See the [`std::result`](index.html) module documentation for details. #[derive(Clone, Copy, PartialEq, PartialOrd, Eq, Ord, Show, Hash)] #[must_use] -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub enum Result<T, E> { /// Contains the success value - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] Ok(T), /// Contains the error value - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] Err(E) } @@ -256,7 +256,7 @@ pub enum Result<T, E> { // Type implementation ///////////////////////////////////////////////////////////////////////////// -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<T, E> Result<T, E> { ///////////////////////////////////////////////////////////////////////// // Querying the contained values @@ -274,7 +274,7 @@ impl<T, E> Result<T, E> { /// assert_eq!(x.is_ok(), false); /// ``` #[inline] - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] pub fn is_ok(&self) -> bool { match *self { Ok(_) => true, @@ -294,7 +294,7 @@ impl<T, E> Result<T, E> { /// assert_eq!(x.is_err(), true); /// ``` #[inline] - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] pub fn is_err(&self) -> bool { !self.is_ok() } @@ -318,7 +318,7 @@ impl<T, E> Result<T, E> { /// assert_eq!(x.ok(), None); /// ``` #[inline] - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] pub fn ok(self) -> Option<T> { match self { Ok(x) => Some(x), @@ -341,7 +341,7 @@ impl<T, E> Result<T, E> { /// assert_eq!(x.err(), Some("Nothing here")); /// ``` #[inline] - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] pub fn err(self) -> Option<E> { match self { Ok(_) => None, @@ -366,7 +366,7 @@ impl<T, E> Result<T, E> { /// assert_eq!(x.as_ref(), Err(&"Error")); /// ``` #[inline] - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] pub fn as_ref(&self) -> Result<&T, &E> { match *self { Ok(ref x) => Ok(x), @@ -393,7 +393,7 @@ impl<T, E> Result<T, E> { /// assert_eq!(x.unwrap_err(), 0); /// ``` #[inline] - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] pub fn as_mut(&mut self) -> Result<&mut T, &mut E> { match *self { Ok(ref mut x) => Ok(x), @@ -417,7 +417,8 @@ impl<T, E> Result<T, E> { /// assert!(x.as_mut_slice().is_empty()); /// ``` #[inline] - #[unstable = "waiting for mut conventions"] + #[unstable(feature = "core", + reason = "waiting for mut conventions")] pub fn as_mut_slice(&mut self) -> &mut [T] { match *self { Ok(ref mut x) => slice::mut_ref_slice(x), @@ -463,7 +464,7 @@ impl<T, E> Result<T, E> { /// assert!(sum == 10); /// ``` #[inline] - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] pub fn map<U, F: FnOnce(T) -> U>(self, op: F) -> Result<U,E> { match self { Ok(t) => Ok(op(t)), @@ -489,7 +490,7 @@ impl<T, E> Result<T, E> { /// assert_eq!(x.map_err(stringify), Err("error code: 13".to_string())); /// ``` #[inline] - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] pub fn map_err<F, O: FnOnce(E) -> F>(self, op: O) -> Result<T,F> { match self { Ok(t) => Ok(t), @@ -513,7 +514,7 @@ impl<T, E> Result<T, E> { /// assert_eq!(x.iter().next(), None); /// ``` #[inline] - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] pub fn iter(&self) -> Iter<T> { Iter { inner: self.as_ref().ok() } } @@ -534,7 +535,7 @@ impl<T, E> Result<T, E> { /// assert_eq!(x.iter_mut().next(), None); /// ``` #[inline] - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] pub fn iter_mut(&mut self) -> IterMut<T> { IterMut { inner: self.as_mut().ok() } } @@ -553,7 +554,7 @@ impl<T, E> Result<T, E> { /// assert_eq!(v, vec![]); /// ``` #[inline] - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] pub fn into_iter(self) -> IntoIter<T> { IntoIter { inner: self.ok() } } @@ -584,7 +585,7 @@ impl<T, E> Result<T, E> { /// assert_eq!(x.and(y), Ok("different result type")); /// ``` #[inline] - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] pub fn and<U>(self, res: Result<U, E>) -> Result<U, E> { match self { Ok(_) => res, @@ -608,7 +609,7 @@ impl<T, E> Result<T, E> { /// assert_eq!(Err(3).and_then(sq).and_then(sq), Err(3)); /// ``` #[inline] - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] pub fn and_then<U, F: FnOnce(T) -> Result<U, E>>(self, op: F) -> Result<U, E> { match self { Ok(t) => op(t), @@ -638,7 +639,7 @@ impl<T, E> Result<T, E> { /// assert_eq!(x.or(y), Ok(2)); /// ``` #[inline] - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] pub fn or(self, res: Result<T, E>) -> Result<T, E> { match self { Ok(_) => self, @@ -662,7 +663,7 @@ impl<T, E> Result<T, E> { /// assert_eq!(Err(3).or_else(err).or_else(err), Err(3)); /// ``` #[inline] - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] pub fn or_else<F, O: FnOnce(E) -> Result<T, F>>(self, op: O) -> Result<T, F> { match self { Ok(t) => Ok(t), @@ -684,7 +685,7 @@ impl<T, E> Result<T, E> { /// assert_eq!(x.unwrap_or(optb), optb); /// ``` #[inline] - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] pub fn unwrap_or(self, optb: T) -> T { match self { Ok(t) => t, @@ -704,7 +705,7 @@ impl<T, E> Result<T, E> { /// assert_eq!(Err("foo").unwrap_or_else(count), 3); /// ``` #[inline] - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] pub fn unwrap_or_else<F: FnOnce(E) -> T>(self, op: F) -> T { match self { Ok(t) => t, @@ -713,7 +714,7 @@ impl<T, E> Result<T, E> { } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<T, E: Debug> Result<T, E> { /// Unwraps a result, yielding the content of an `Ok`. /// @@ -734,7 +735,7 @@ impl<T, E: Debug> Result<T, E> { /// x.unwrap(); // panics with `emergency failure` /// ``` #[inline] - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] pub fn unwrap(self) -> T { match self { Ok(t) => t, @@ -744,7 +745,7 @@ impl<T, E: Debug> Result<T, E> { } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<T: Debug, E> Result<T, E> { /// Unwraps a result, yielding the content of an `Err`. /// @@ -765,7 +766,7 @@ impl<T: Debug, E> Result<T, E> { /// assert_eq!(x.unwrap_err(), "emergency failure"); /// ``` #[inline] - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] pub fn unwrap_err(self) -> E { match self { Ok(t) => @@ -782,7 +783,7 @@ impl<T: Debug, E> Result<T, E> { impl<T, E> AsSlice<T> for Result<T, E> { /// Convert from `Result<T, E>` to `&[T]` (without copying) #[inline] - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] fn as_slice<'a>(&'a self) -> &'a [T] { match *self { Ok(ref x) => slice::ref_slice(x), @@ -800,10 +801,10 @@ impl<T, E> AsSlice<T> for Result<T, E> { ///////////////////////////////////////////////////////////////////////////// /// An iterator over a reference to the `Ok` variant of a `Result`. -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub struct Iter<'a, T: 'a> { inner: Option<&'a T> } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<'a, T> Iterator for Iter<'a, T> { type Item = &'a T; @@ -816,13 +817,13 @@ impl<'a, T> Iterator for Iter<'a, T> { } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<'a, T> DoubleEndedIterator for Iter<'a, T> { #[inline] fn next_back(&mut self) -> Option<&'a T> { self.inner.take() } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<'a, T> ExactSizeIterator for Iter<'a, T> {} impl<'a, T> Clone for Iter<'a, T> { @@ -830,10 +831,10 @@ impl<'a, T> Clone for Iter<'a, T> { } /// An iterator over a mutable reference to the `Ok` variant of a `Result`. -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub struct IterMut<'a, T: 'a> { inner: Option<&'a mut T> } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<'a, T> Iterator for IterMut<'a, T> { type Item = &'a mut T; @@ -846,20 +847,20 @@ impl<'a, T> Iterator for IterMut<'a, T> { } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<'a, T> DoubleEndedIterator for IterMut<'a, T> { #[inline] fn next_back(&mut self) -> Option<&'a mut T> { self.inner.take() } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<'a, T> ExactSizeIterator for IterMut<'a, T> {} /// An iterator over the value in a `Ok` variant of a `Result`. -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub struct IntoIter<T> { inner: Option<T> } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<T> Iterator for IntoIter<T> { type Item = T; @@ -872,20 +873,20 @@ impl<T> Iterator for IntoIter<T> { } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<T> DoubleEndedIterator for IntoIter<T> { #[inline] fn next_back(&mut self) -> Option<T> { self.inner.take() } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<T> ExactSizeIterator for IntoIter<T> {} ///////////////////////////////////////////////////////////////////////////// // FromIterator ///////////////////////////////////////////////////////////////////////////// -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] 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 /// elements are taken, and the `Err` is returned. Should no `Err` occur, a @@ -949,7 +950,7 @@ impl<A, E, V: FromIterator<A>> FromIterator<Result<A, E>> for Result<V, E> { /// If an `Err` is encountered, it is immediately returned. /// Otherwise, the folded value is returned. #[inline] -#[unstable] +#[unstable(feature = "core")] pub fn fold<T, V, E, diff --git a/src/libcore/simd.rs b/src/libcore/simd.rs index b73910d7c06..4a1c123668f 100644 --- a/src/libcore/simd.rs +++ b/src/libcore/simd.rs @@ -19,7 +19,6 @@ //! provided beyond this module. //! //! ```rust -//! #[allow(unstable)]; //! //! fn main() { //! use std::simd::f32x4; @@ -37,7 +36,7 @@ #![allow(non_camel_case_types)] #![allow(missing_docs)] -#[unstable] +#[unstable(feature = "core")] #[simd] #[derive(Copy, Show)] #[repr(C)] @@ -46,26 +45,26 @@ pub struct i8x16(pub i8, pub i8, pub i8, pub i8, pub i8, pub i8, pub i8, pub i8, pub i8, pub i8, pub i8, pub i8); -#[unstable] +#[unstable(feature = "core")] #[simd] #[derive(Copy, Show)] #[repr(C)] pub struct i16x8(pub i16, pub i16, pub i16, pub i16, pub i16, pub i16, pub i16, pub i16); -#[unstable] +#[unstable(feature = "core")] #[simd] #[derive(Copy, Show)] #[repr(C)] pub struct i32x4(pub i32, pub i32, pub i32, pub i32); -#[unstable] +#[unstable(feature = "core")] #[simd] #[derive(Copy, Show)] #[repr(C)] pub struct i64x2(pub i64, pub i64); -#[unstable] +#[unstable(feature = "core")] #[simd] #[derive(Copy, Show)] #[repr(C)] @@ -74,32 +73,32 @@ pub struct u8x16(pub u8, pub u8, pub u8, pub u8, pub u8, pub u8, pub u8, pub u8, pub u8, pub u8, pub u8, pub u8); -#[unstable] +#[unstable(feature = "core")] #[simd] #[derive(Copy, Show)] #[repr(C)] pub struct u16x8(pub u16, pub u16, pub u16, pub u16, pub u16, pub u16, pub u16, pub u16); -#[unstable] +#[unstable(feature = "core")] #[simd] #[derive(Copy, Show)] #[repr(C)] pub struct u32x4(pub u32, pub u32, pub u32, pub u32); -#[unstable] +#[unstable(feature = "core")] #[simd] #[derive(Copy, Show)] #[repr(C)] pub struct u64x2(pub u64, pub u64); -#[unstable] +#[unstable(feature = "core")] #[simd] #[derive(Copy, Show)] #[repr(C)] pub struct f32x4(pub f32, pub f32, pub f32, pub f32); -#[unstable] +#[unstable(feature = "core")] #[simd] #[derive(Copy, Show)] #[repr(C)] diff --git a/src/libcore/slice.rs b/src/libcore/slice.rs index f08978db8fe..a113a34ef35 100644 --- a/src/libcore/slice.rs +++ b/src/libcore/slice.rs @@ -12,7 +12,7 @@ //! //! For more details `std::slice`. -#![stable] +#![stable(feature = "rust1", since = "1.0.0")] #![doc(primitive = "slice")] // How this module is organized. @@ -125,7 +125,7 @@ pub trait SliceExt { fn clone_from_slice(&mut self, &[Self::Item]) -> uint where Self::Item: Clone; } -#[unstable] +#[unstable(feature = "core")] impl<T> SliceExt for [T] { type Item = T; @@ -230,7 +230,7 @@ impl<T> SliceExt for [T] { self.repr().data } - #[unstable] + #[unstable(feature = "core")] fn binary_search_by<F>(&self, mut f: F) -> Result<uint, uint> where F: FnMut(&T) -> Ordering { @@ -410,12 +410,12 @@ impl<T> SliceExt for [T] { m >= n && needle == &self[m-n..] } - #[unstable] + #[unstable(feature = "core")] fn binary_search(&self, x: &T) -> Result<uint, uint> where T: Ord { self.binary_search_by(|p| p.cmp(x)) } - #[unstable] + #[unstable(feature = "core")] fn next_permutation(&mut self) -> bool where T: Ord { // These cases only have 1 permutation each, so we can't do anything. if self.len() < 2 { return false; } @@ -446,7 +446,7 @@ impl<T> SliceExt for [T] { true } - #[unstable] + #[unstable(feature = "core")] fn prev_permutation(&mut self) -> bool where T: Ord { // These cases only have 1 permutation each, so we can't do anything. if self.len() < 2 { return false; } @@ -489,7 +489,7 @@ impl<T> SliceExt for [T] { } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<T> ops::Index<uint> for [T] { type Output = T; @@ -500,7 +500,7 @@ impl<T> ops::Index<uint> for [T] { } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<T> ops::IndexMut<uint> for [T] { type Output = T; @@ -511,7 +511,7 @@ impl<T> ops::IndexMut<uint> for [T] { } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<T> ops::Index<ops::Range<uint>> for [T] { type Output = [T]; #[inline] @@ -526,7 +526,7 @@ impl<T> ops::Index<ops::Range<uint>> for [T] { } } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<T> ops::Index<ops::RangeTo<uint>> for [T] { type Output = [T]; #[inline] @@ -534,7 +534,7 @@ impl<T> ops::Index<ops::RangeTo<uint>> for [T] { self.index(&ops::Range{ start: 0, end: index.end }) } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<T> ops::Index<ops::RangeFrom<uint>> for [T] { type Output = [T]; #[inline] @@ -542,7 +542,7 @@ impl<T> ops::Index<ops::RangeFrom<uint>> for [T] { self.index(&ops::Range{ start: index.start, end: self.len() }) } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<T> ops::Index<ops::FullRange> for [T] { type Output = [T]; #[inline] @@ -551,7 +551,7 @@ impl<T> ops::Index<ops::FullRange> for [T] { } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<T> ops::IndexMut<ops::Range<uint>> for [T] { type Output = [T]; #[inline] @@ -566,7 +566,7 @@ impl<T> ops::IndexMut<ops::Range<uint>> for [T] { } } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<T> ops::IndexMut<ops::RangeTo<uint>> for [T] { type Output = [T]; #[inline] @@ -574,7 +574,7 @@ impl<T> ops::IndexMut<ops::RangeTo<uint>> for [T] { self.index_mut(&ops::Range{ start: 0, end: index.end }) } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<T> ops::IndexMut<ops::RangeFrom<uint>> for [T] { type Output = [T]; #[inline] @@ -583,7 +583,7 @@ impl<T> ops::IndexMut<ops::RangeFrom<uint>> for [T] { self.index_mut(&ops::Range{ start: index.start, end: len }) } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<T> ops::IndexMut<ops::FullRange> for [T] { type Output = [T]; #[inline] @@ -598,33 +598,34 @@ impl<T> ops::IndexMut<ops::FullRange> for [T] { //////////////////////////////////////////////////////////////////////////////// /// Data that is viewable as a slice. -#[unstable = "will be replaced by slice syntax"] +#[unstable(feature = "core", + reason = "will be replaced by slice syntax")] pub trait AsSlice<T> { /// Work with `self` as a slice. fn as_slice<'a>(&'a self) -> &'a [T]; } -#[unstable = "trait is experimental"] +#[unstable(feature = "core", reason = "trait is experimental")] impl<T> AsSlice<T> for [T] { #[inline(always)] fn as_slice<'a>(&'a self) -> &'a [T] { self } } -#[unstable = "trait is experimental"] +#[unstable(feature = "core", reason = "trait is experimental")] impl<'a, T, U: ?Sized + AsSlice<T>> AsSlice<T> for &'a U { #[inline(always)] fn as_slice(&self) -> &[T] { AsSlice::as_slice(*self) } } -#[unstable = "trait is experimental"] +#[unstable(feature = "core", reason = "trait is experimental")] impl<'a, T, U: ?Sized + AsSlice<T>> AsSlice<T> for &'a mut U { #[inline(always)] fn as_slice(&self) -> &[T] { AsSlice::as_slice(*self) } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<'a, T> Default for &'a [T] { - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] fn default() -> &'a [T] { &[] } } @@ -635,7 +636,7 @@ impl<'a, T> Default for &'a [T] { // The shared definition of the `Iter` and `IterMut` iterators macro_rules! iterator { (struct $name:ident -> $ptr:ty, $elem:ty) => { - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] impl<'a, T> Iterator for $name<'a, T> { type Item = $elem; @@ -673,7 +674,7 @@ macro_rules! iterator { } } - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] impl<'a, T> DoubleEndedIterator for $name<'a, T> { #[inline] fn next_back(&mut self) -> Option<$elem> { @@ -715,14 +716,14 @@ macro_rules! make_slice { } /// Immutable slice iterator -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub struct Iter<'a, T: 'a> { ptr: *const T, end: *const T, marker: marker::ContravariantLifetime<'a> } -#[unstable] +#[unstable(feature = "core")] impl<'a, T> ops::Index<ops::Range<uint>> for Iter<'a, T> { type Output = [T]; #[inline] @@ -731,7 +732,7 @@ impl<'a, T> ops::Index<ops::Range<uint>> for Iter<'a, T> { } } -#[unstable] +#[unstable(feature = "core")] impl<'a, T> ops::Index<ops::RangeTo<uint>> for Iter<'a, T> { type Output = [T]; #[inline] @@ -740,7 +741,7 @@ impl<'a, T> ops::Index<ops::RangeTo<uint>> for Iter<'a, T> { } } -#[unstable] +#[unstable(feature = "core")] impl<'a, T> ops::Index<ops::RangeFrom<uint>> for Iter<'a, T> { type Output = [T]; #[inline] @@ -749,7 +750,7 @@ impl<'a, T> ops::Index<ops::RangeFrom<uint>> for Iter<'a, T> { } } -#[unstable] +#[unstable(feature = "core")] impl<'a, T> ops::Index<ops::FullRange> for Iter<'a, T> { type Output = [T]; #[inline] @@ -763,7 +764,7 @@ impl<'a, T> Iter<'a, T> { /// /// This has the same lifetime as the original slice, and so the /// iterator can continue to be used while this exists. - #[unstable] + #[unstable(feature = "core")] pub fn as_slice(&self) -> &'a [T] { make_slice!(T => &'a [T]: self.ptr, self.end) } @@ -773,15 +774,15 @@ impl<'a,T> Copy for Iter<'a,T> {} iterator!{struct Iter -> *const T, &'a T} -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<'a, T> ExactSizeIterator for Iter<'a, T> {} -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<'a, T> Clone for Iter<'a, T> { fn clone(&self) -> Iter<'a, T> { *self } } -#[unstable = "trait is experimental"] +#[unstable(feature = "core", reason = "trait is experimental")] impl<'a, T> RandomAccessIterator for Iter<'a, T> { #[inline] fn indexable(&self) -> uint { @@ -807,7 +808,7 @@ impl<'a, T> RandomAccessIterator for Iter<'a, T> { } /// Mutable slice iterator. -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub struct IterMut<'a, T: 'a> { ptr: *mut T, end: *mut T, @@ -815,7 +816,7 @@ pub struct IterMut<'a, T: 'a> { } -#[unstable] +#[unstable(feature = "core")] impl<'a, T> ops::Index<ops::Range<uint>> for IterMut<'a, T> { type Output = [T]; #[inline] @@ -823,7 +824,7 @@ impl<'a, T> ops::Index<ops::Range<uint>> for IterMut<'a, T> { self.index(&ops::FullRange).index(index) } } -#[unstable] +#[unstable(feature = "core")] impl<'a, T> ops::Index<ops::RangeTo<uint>> for IterMut<'a, T> { type Output = [T]; #[inline] @@ -831,7 +832,7 @@ impl<'a, T> ops::Index<ops::RangeTo<uint>> for IterMut<'a, T> { self.index(&ops::FullRange).index(index) } } -#[unstable] +#[unstable(feature = "core")] impl<'a, T> ops::Index<ops::RangeFrom<uint>> for IterMut<'a, T> { type Output = [T]; #[inline] @@ -839,7 +840,7 @@ impl<'a, T> ops::Index<ops::RangeFrom<uint>> for IterMut<'a, T> { self.index(&ops::FullRange).index(index) } } -#[unstable] +#[unstable(feature = "core")] impl<'a, T> ops::Index<ops::FullRange> for IterMut<'a, T> { type Output = [T]; #[inline] @@ -848,7 +849,7 @@ impl<'a, T> ops::Index<ops::FullRange> for IterMut<'a, T> { } } -#[unstable] +#[unstable(feature = "core")] impl<'a, T> ops::IndexMut<ops::Range<uint>> for IterMut<'a, T> { type Output = [T]; #[inline] @@ -856,7 +857,7 @@ impl<'a, T> ops::IndexMut<ops::Range<uint>> for IterMut<'a, T> { self.index_mut(&ops::FullRange).index_mut(index) } } -#[unstable] +#[unstable(feature = "core")] impl<'a, T> ops::IndexMut<ops::RangeTo<uint>> for IterMut<'a, T> { type Output = [T]; #[inline] @@ -864,7 +865,7 @@ impl<'a, T> ops::IndexMut<ops::RangeTo<uint>> for IterMut<'a, T> { self.index_mut(&ops::FullRange).index_mut(index) } } -#[unstable] +#[unstable(feature = "core")] impl<'a, T> ops::IndexMut<ops::RangeFrom<uint>> for IterMut<'a, T> { type Output = [T]; #[inline] @@ -872,7 +873,7 @@ impl<'a, T> ops::IndexMut<ops::RangeFrom<uint>> for IterMut<'a, T> { self.index_mut(&ops::FullRange).index_mut(index) } } -#[unstable] +#[unstable(feature = "core")] impl<'a, T> ops::IndexMut<ops::FullRange> for IterMut<'a, T> { type Output = [T]; #[inline] @@ -889,7 +890,7 @@ impl<'a, T> IterMut<'a, T> { /// to consume the iterator. Consider using the `Slice` and /// `SliceMut` implementations for obtaining slices with more /// restricted lifetimes that do not consume the iterator. - #[unstable] + #[unstable(feature = "core")] pub fn into_slice(self) -> &'a mut [T] { make_slice!(T => &'a mut [T]: self.ptr, self.end) } @@ -897,7 +898,7 @@ impl<'a, T> IterMut<'a, T> { iterator!{struct IterMut -> *mut T, &'a mut T} -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<'a, T> ExactSizeIterator for IterMut<'a, T> {} /// An internal abstraction over the splitting iterators, so that @@ -910,7 +911,7 @@ trait SplitIter: DoubleEndedIterator { /// An iterator over subslices separated by elements that match a predicate /// function. -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub struct Split<'a, T:'a, P> where P: FnMut(&T) -> bool { v: &'a [T], pred: P, @@ -918,7 +919,7 @@ pub struct Split<'a, T:'a, P> where P: FnMut(&T) -> bool { } // FIXME(#19839) Remove in favor of `#[derive(Clone)]` -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<'a, T, P> Clone for Split<'a, T, P> where P: Clone + FnMut(&T) -> bool { fn clone(&self) -> Split<'a, T, P> { Split { @@ -929,7 +930,7 @@ impl<'a, T, P> Clone for Split<'a, T, P> where P: Clone + FnMut(&T) -> bool { } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<'a, T, P> Iterator for Split<'a, T, P> where P: FnMut(&T) -> bool { type Item = &'a [T]; @@ -957,7 +958,7 @@ impl<'a, T, P> Iterator for Split<'a, T, P> where P: FnMut(&T) -> bool { } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<'a, T, P> DoubleEndedIterator for Split<'a, T, P> where P: FnMut(&T) -> bool { #[inline] fn next_back(&mut self) -> Option<&'a [T]> { @@ -983,7 +984,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 /// by elements that match `pred`. -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub struct SplitMut<'a, T:'a, P> where P: FnMut(&T) -> bool { v: &'a mut [T], pred: P, @@ -1002,7 +1003,7 @@ impl<'a, T, P> SplitIter for SplitMut<'a, T, P> where P: FnMut(&T) -> bool { } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<'a, T, P> Iterator for SplitMut<'a, T, P> where P: FnMut(&T) -> bool { type Item = &'a mut [T]; @@ -1037,7 +1038,7 @@ impl<'a, T, P> Iterator for SplitMut<'a, T, P> where P: FnMut(&T) -> bool { } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<'a, T, P> DoubleEndedIterator for SplitMut<'a, T, P> where P: FnMut(&T) -> bool, { @@ -1092,7 +1093,7 @@ impl<T, I: SplitIter<Item=T>> Iterator for GenericSplitN<I> { /// An iterator over subslices separated by elements that match a predicate /// function, limited to a given number of splits. -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub struct SplitN<'a, T: 'a, P> where P: FnMut(&T) -> bool { inner: GenericSplitN<Split<'a, T, P>> } @@ -1100,14 +1101,14 @@ pub struct SplitN<'a, T: 'a, P> where P: FnMut(&T) -> bool { /// An iterator over subslices separated by elements that match a /// predicate function, limited to a given number of splits, starting /// from the end of the slice. -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub struct RSplitN<'a, T: 'a, P> where P: FnMut(&T) -> bool { inner: GenericSplitN<Split<'a, T, P>> } /// An iterator over subslices separated by elements that match a predicate /// function, limited to a given number of splits. -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub struct SplitNMut<'a, T: 'a, P> where P: FnMut(&T) -> bool { inner: GenericSplitN<SplitMut<'a, T, P>> } @@ -1115,14 +1116,14 @@ pub struct SplitNMut<'a, T: 'a, P> where P: FnMut(&T) -> bool { /// An iterator over subslices separated by elements that match a /// predicate function, limited to a given number of splits, starting /// from the end of the slice. -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub struct RSplitNMut<'a, T: 'a, P> where P: FnMut(&T) -> bool { inner: GenericSplitN<SplitMut<'a, T, P>> } macro_rules! forward_iterator { ($name:ident: $elem:ident, $iter_of:ty) => { - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] impl<'a, $elem, P> Iterator for $name<'a, $elem, P> where P: FnMut(&T) -> bool { @@ -1148,13 +1149,13 @@ forward_iterator! { RSplitNMut: T, &'a mut [T] } /// An iterator over overlapping subslices of length `size`. #[derive(Clone)] -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub struct Windows<'a, T:'a> { v: &'a [T], size: uint } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<'a, T> Iterator for Windows<'a, T> { type Item = &'a [T]; @@ -1186,13 +1187,13 @@ impl<'a, T> Iterator for Windows<'a, T> { /// When the slice len is not evenly divided by the chunk size, the last slice /// of the iteration will be the remainder. #[derive(Clone)] -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub struct Chunks<'a, T:'a> { v: &'a [T], size: uint } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<'a, T> Iterator for Chunks<'a, T> { type Item = &'a [T]; @@ -1221,7 +1222,7 @@ impl<'a, T> Iterator for Chunks<'a, T> { } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<'a, T> DoubleEndedIterator for Chunks<'a, T> { #[inline] fn next_back(&mut self) -> Option<&'a [T]> { @@ -1237,10 +1238,10 @@ impl<'a, T> DoubleEndedIterator for Chunks<'a, T> { } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<'a, T> ExactSizeIterator for Chunks<'a, T> {} -#[unstable = "trait is experimental"] +#[unstable(feature = "core", reason = "trait is experimental")] impl<'a, T> RandomAccessIterator for Chunks<'a, T> { #[inline] fn indexable(&self) -> uint { @@ -1264,13 +1265,13 @@ impl<'a, T> RandomAccessIterator for Chunks<'a, T> { /// 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 /// size, the last slice of the iteration will be the remainder. -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub struct ChunksMut<'a, T:'a> { v: &'a mut [T], chunk_size: uint } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<'a, T> Iterator for ChunksMut<'a, T> { type Item = &'a mut [T]; @@ -1300,7 +1301,7 @@ impl<'a, T> Iterator for ChunksMut<'a, T> { } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<'a, T> DoubleEndedIterator for ChunksMut<'a, T> { #[inline] fn next_back(&mut self) -> Option<&'a mut [T]> { @@ -1318,7 +1319,7 @@ impl<'a, T> DoubleEndedIterator for ChunksMut<'a, T> { } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<'a, T> ExactSizeIterator for ChunksMut<'a, T> {} // @@ -1326,7 +1327,7 @@ impl<'a, T> ExactSizeIterator for ChunksMut<'a, T> {} // /// Converts a pointer to A into a slice of length 1 (without copying). -#[unstable] +#[unstable(feature = "core")] pub fn ref_slice<'a, A>(s: &'a A) -> &'a [A] { unsafe { transmute(RawSlice { data: s, len: 1 }) @@ -1334,7 +1335,7 @@ pub fn ref_slice<'a, A>(s: &'a A) -> &'a [A] { } /// Converts a pointer to A into a slice of length 1 (without copying). -#[unstable] +#[unstable(feature = "core")] pub fn mut_ref_slice<'a, A>(s: &'a mut A) -> &'a mut [A] { unsafe { let ptr: *const A = transmute(s); @@ -1368,7 +1369,8 @@ pub fn mut_ref_slice<'a, A>(s: &'a mut A) -> &'a mut [A] { /// } /// ``` #[inline] -#[unstable = "should be renamed to from_raw_parts"] +#[unstable(feature = "core", + reason = "should be renamed to from_raw_parts")] pub unsafe fn from_raw_buf<'a, T>(p: &'a *const T, len: uint) -> &'a [T] { transmute(RawSlice { data: *p, len: len }) } @@ -1380,7 +1382,8 @@ pub unsafe fn from_raw_buf<'a, T>(p: &'a *const T, len: uint) -> &'a [T] { /// not being able to provide a non-aliasing guarantee of the returned mutable /// slice. #[inline] -#[unstable = "should be renamed to from_raw_parts_mut"] +#[unstable(feature = "core", + reason = "should be renamed to from_raw_parts_mut")] pub unsafe fn from_raw_mut_buf<'a, T>(p: &'a *mut T, len: uint) -> &'a mut [T] { transmute(RawSlice { data: *p, len: len }) } @@ -1390,7 +1393,7 @@ pub unsafe fn from_raw_mut_buf<'a, T>(p: &'a *mut T, len: uint) -> &'a mut [T] { // /// Operations on `[u8]`. -#[unstable = "needs review"] +#[unstable(feature = "core", reason = "needs review")] pub mod bytes { use ptr; use slice::SliceExt; @@ -1403,7 +1406,6 @@ pub mod bytes { impl MutableByteVector for [u8] { #[inline] - #[allow(unstable)] fn set_memory(&mut self, value: u8) { unsafe { ptr::set_memory(self.as_mut_ptr(), value, self.len()) }; } @@ -1432,7 +1434,7 @@ pub mod bytes { // Boilerplate traits // -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<A, B> PartialEq<[B]> for [A] where A: PartialEq<B> { fn eq(&self, other: &[B]) -> bool { self.len() == other.len() && @@ -1444,17 +1446,17 @@ impl<A, B> PartialEq<[B]> for [A] where A: PartialEq<B> { } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<T: Eq> Eq for [T] {} -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<T: Ord> Ord for [T] { fn cmp(&self, other: &[T]) -> Ordering { order::cmp(self.iter(), other.iter()) } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<T: PartialOrd> PartialOrd for [T] { #[inline] fn partial_cmp(&self, other: &[T]) -> Option<Ordering> { @@ -1479,7 +1481,7 @@ impl<T: PartialOrd> PartialOrd for [T] { } /// Extension methods for slices containing integers. -#[unstable] +#[unstable(feature = "core")] pub trait IntSliceExt<U, S> { /// Converts the slice to an immutable slice of unsigned integers with the same width. fn as_unsigned<'a>(&'a self) -> &'a [U]; @@ -1494,7 +1496,7 @@ pub trait IntSliceExt<U, S> { macro_rules! impl_int_slice { ($u:ty, $s:ty, $t:ty) => { - #[unstable] + #[unstable(feature = "core")] impl IntSliceExt<$u, $s> for [$t] { #[inline] fn as_unsigned(&self) -> &[$u] { unsafe { transmute(self) } } diff --git a/src/libcore/str/mod.rs b/src/libcore/str/mod.rs index b0227c749cc..101d349c351 100644 --- a/src/libcore/str/mod.rs +++ b/src/libcore/str/mod.rs @@ -47,7 +47,7 @@ macro_rules! delegate_iter { } }; ($te:ty : $ti:ty) => { - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] impl<'a> Iterator for $ti { type Item = $te; @@ -60,7 +60,7 @@ macro_rules! delegate_iter { self.0.size_hint() } } - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] impl<'a> DoubleEndedIterator for $ti { #[inline] fn next_back(&mut self) -> Option<$te> { @@ -69,7 +69,7 @@ macro_rules! delegate_iter { } }; (pattern $te:ty : $ti:ty) => { - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] impl<'a, P: CharEq> Iterator for $ti { type Item = $te; @@ -82,7 +82,7 @@ macro_rules! delegate_iter { self.0.size_hint() } } - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] impl<'a, P: CharEq> DoubleEndedIterator for $ti { #[inline] fn next_back(&mut self) -> Option<$te> { @@ -91,7 +91,7 @@ macro_rules! delegate_iter { } }; (pattern forward $te:ty : $ti:ty) => { - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] impl<'a, P: CharEq> Iterator for $ti { type Item = $te; @@ -110,7 +110,8 @@ macro_rules! delegate_iter { /// A trait to abstract the idea of creating a new instance of a type from a /// string. // FIXME(#17307): there should be an `E` associated type for a `Result` return -#[unstable = "will return a Result once associated types are working"] +#[unstable(feature = "core", + reason = "will return a Result once associated types are working")] pub trait FromStr { /// Parses a string `s` to return an optional value of this type. If the /// string is ill-formatted, the None is returned. @@ -145,7 +146,8 @@ Section: Creating a string /// Errors which can occur when attempting to interpret a byte slice as a `str`. #[derive(Copy, Eq, PartialEq, Clone, Show)] -#[unstable = "error enumeration recently added and definitions may be refined"] +#[unstable(feature = "core", + reason = "error enumeration recently added and definitions may be refined")] pub enum Utf8Error { /// An invalid byte was detected at the byte offset given. /// @@ -169,7 +171,7 @@ pub enum Utf8Error { /// /// Returns `Err` if the slice is not utf-8 with a description as to why the /// provided slice is not utf-8. -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub fn from_utf8(v: &[u8]) -> Result<&str, Utf8Error> { try!(run_utf8_validation_iterator(&mut v.iter())); Ok(unsafe { from_utf8_unchecked(v) }) @@ -177,7 +179,7 @@ pub fn from_utf8(v: &[u8]) -> Result<&str, Utf8Error> { /// Converts a slice of bytes to a string slice without checking /// that the string contains valid UTF-8. -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub unsafe fn from_utf8_unchecked<'a>(v: &'a [u8]) -> &'a str { mem::transmute(v) } @@ -195,7 +197,9 @@ pub unsafe fn from_utf8_unchecked<'a>(v: &'a [u8]) -> &'a str { /// # Panics /// /// This function will panic if the string pointed to by `s` is not valid UTF-8. -#[deprecated = "use std::ffi::c_str_to_bytes + str::from_utf8"] +#[unstable(feature = "core")] +#[deprecated(since = "1.0.0", + reason = "use std::ffi::c_str_to_bytes + str::from_utf8")] pub unsafe fn from_c_str(s: *const i8) -> &'static str { let s = s as *const u8; let mut len = 0; @@ -207,7 +211,8 @@ pub unsafe fn from_c_str(s: *const i8) -> &'static str { } /// Something that can be used to compare against a character -#[unstable = "definition may change as pattern-related methods are stabilized"] +#[unstable(feature = "core", + reason = "definition may change as pattern-related methods are stabilized")] pub trait CharEq { /// Determine if the splitter should split at the given character fn matches(&mut self, char) -> bool; @@ -244,7 +249,7 @@ impl<'a> CharEq for &'a [char] { } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl Error for Utf8Error { fn description(&self) -> &str { match *self { @@ -254,7 +259,7 @@ impl Error for Utf8Error { } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl fmt::Display for Utf8Error { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { match *self { @@ -276,7 +281,7 @@ Section: Iterators /// /// Created with the method `.chars()`. #[derive(Clone, Copy)] -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub struct Chars<'a> { iter: slice::Iter<'a, u8> } @@ -307,7 +312,7 @@ fn unwrap_or_0(opt: Option<&u8>) -> u8 { /// Reads the next code point out of a byte iterator (assuming a /// UTF-8-like encoding). -#[unstable] +#[unstable(feature = "core")] pub fn next_code_point(bytes: &mut slice::Iter<u8>) -> Option<u32> { // Decode UTF-8 let x = match bytes.next() { @@ -339,7 +344,7 @@ pub fn next_code_point(bytes: &mut slice::Iter<u8>) -> Option<u32> { Some(ch) } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<'a> Iterator for Chars<'a> { type Item = char; @@ -360,7 +365,7 @@ impl<'a> Iterator for Chars<'a> { } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<'a> DoubleEndedIterator for Chars<'a> { #[inline] fn next_back(&mut self) -> Option<char> { @@ -397,13 +402,13 @@ impl<'a> DoubleEndedIterator for Chars<'a> { /// External iterator for a string's characters and their byte offsets. /// Use with the `std::iter` module. #[derive(Clone)] -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub struct CharIndices<'a> { front_offset: uint, iter: Chars<'a>, } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<'a> Iterator for CharIndices<'a> { type Item = (uint, char); @@ -427,7 +432,7 @@ impl<'a> Iterator for CharIndices<'a> { } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<'a> DoubleEndedIterator for CharIndices<'a> { #[inline] fn next_back(&mut self) -> Option<(uint, char)> { @@ -446,7 +451,7 @@ impl<'a> DoubleEndedIterator for CharIndices<'a> { /// Use with the `std::iter` module. /// /// Created with `StrExt::bytes` -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] #[derive(Clone)] pub struct Bytes<'a>(Map<&'a u8, u8, slice::Iter<'a, u8>, BytesDeref>); delegate_iter!{exact u8 : Bytes<'a>} @@ -456,6 +461,7 @@ delegate_iter!{exact u8 : Bytes<'a>} #[derive(Copy, Clone)] struct BytesDeref; +#[cfg(stage0)] impl<'a> Fn(&'a u8) -> u8 for BytesDeref { #[inline] extern "rust-call" fn call(&self, (ptr,): (&'a u8,)) -> u8 { @@ -463,6 +469,16 @@ impl<'a> Fn(&'a u8) -> u8 for BytesDeref { } } +#[cfg(not(stage0))] +impl<'a> Fn<(&'a u8,)> for BytesDeref { + type Output = u8; + + #[inline] + extern "rust-call" fn call(&self, (ptr,): (&'a u8,)) -> u8 { + *ptr + } +} + /// An iterator over the substrings of a string, separated by `sep`. #[derive(Clone)] struct CharSplits<'a, Sep> { @@ -486,13 +502,13 @@ struct CharSplitsN<'a, Sep> { } /// An iterator over the lines of a string, separated by `\n`. -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub struct Lines<'a> { inner: CharSplits<'a, char>, } /// An iterator over the lines of a string, separated by either `\n` or (`\r\n`). -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub struct LinesAny<'a> { inner: Map<&'a str, &'a str, Lines<'a>, fn(&str) -> &str>, } @@ -509,7 +525,7 @@ impl<'a, Sep> CharSplits<'a, Sep> { } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<'a, Sep: CharEq> Iterator for CharSplits<'a, Sep> { type Item = &'a str; @@ -544,7 +560,7 @@ impl<'a, Sep: CharEq> Iterator for CharSplits<'a, Sep> { } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<'a, Sep: CharEq> DoubleEndedIterator for CharSplits<'a, Sep> { #[inline] fn next_back(&mut self) -> Option<&'a str> { @@ -586,7 +602,7 @@ impl<'a, Sep: CharEq> DoubleEndedIterator for CharSplits<'a, Sep> { } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<'a, Sep: CharEq> Iterator for CharSplitsN<'a, Sep> { type Item = &'a str; @@ -892,7 +908,7 @@ impl Searcher { /// An iterator over the start and end indices of the matches of a /// substring within a larger string #[derive(Clone)] -#[unstable = "type may be removed"] +#[unstable(feature = "core", reason = "type may be removed")] pub struct MatchIndices<'a> { // constants haystack: &'a str, @@ -903,14 +919,14 @@ pub struct MatchIndices<'a> { /// An iterator over the substrings of a string separated by a given /// search string #[derive(Clone)] -#[unstable = "type may be removed"] +#[unstable(feature = "core", reason = "type may be removed")] pub struct SplitStr<'a> { it: MatchIndices<'a>, last_end: uint, finished: bool } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<'a> Iterator for MatchIndices<'a> { type Item = (uint, uint); @@ -927,7 +943,7 @@ impl<'a> Iterator for MatchIndices<'a> { } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<'a> Iterator for SplitStr<'a> { type Item = &'a str; @@ -1087,7 +1103,8 @@ static UTF8_CHAR_WIDTH: [u8; 256] = [ /// the next `char` in a string. This can be used as a data structure /// for iterating over the UTF-8 bytes of a string. #[derive(Copy)] -#[unstable = "naming is uncertain with container conventions"] +#[unstable(feature = "core", + reason = "naming is uncertain with container conventions")] pub struct CharRange { /// Current `char` pub ch: char, @@ -1113,7 +1130,7 @@ mod traits { use ops; use str::{StrExt, eq_slice}; - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] impl Ord for str { #[inline] fn cmp(&self, other: &str) -> Ordering { @@ -1129,7 +1146,7 @@ mod traits { } } - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] impl PartialEq for str { #[inline] fn eq(&self, other: &str) -> bool { @@ -1139,10 +1156,10 @@ mod traits { fn ne(&self, other: &str) -> bool { !(*self).eq(other) } } - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] impl Eq for str {} - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] impl PartialOrd for str { #[inline] fn partial_cmp(&self, other: &str) -> Option<Ordering> { @@ -1176,7 +1193,7 @@ mod traits { /// // byte 100 is outside the string /// // &s[3 .. 100]; /// ``` - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] impl ops::Index<ops::Range<uint>> for str { type Output = str; #[inline] @@ -1199,7 +1216,7 @@ mod traits { /// /// Panics when `end` does not point to a valid character, or is /// out of bounds. - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] impl ops::Index<ops::RangeTo<uint>> for str { type Output = str; #[inline] @@ -1219,7 +1236,7 @@ mod traits { /// /// Panics when `begin` does not point to a valid character, or is /// out of bounds. - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] impl ops::Index<ops::RangeFrom<uint>> for str { type Output = str; #[inline] @@ -1233,7 +1250,7 @@ mod traits { } } - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] impl ops::Index<ops::FullRange> for str { type Output = str; #[inline] @@ -1244,9 +1261,10 @@ mod traits { } /// Any string that can be represented as a slice -#[unstable = "Instead of taking this bound generically, this trait will be \ - replaced with one of slicing syntax (&foo[]), deref coercions, or \ - a more generic conversion trait"] +#[unstable(feature = "core", + reason = "Instead of taking this bound generically, this trait will be \ + replaced with one of slicing syntax (&foo[]), deref coercions, or \ + a more generic conversion trait")] pub trait Str { /// Work with `self` as a slice. fn as_slice<'a>(&'a self) -> &'a str; @@ -1264,25 +1282,26 @@ impl<'a, S: ?Sized> Str for &'a S where S: Str { /// Return type of `StrExt::split` #[derive(Clone)] -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub struct Split<'a, P>(CharSplits<'a, P>); delegate_iter!{pattern &'a str : Split<'a, P>} /// Return type of `StrExt::split_terminator` #[derive(Clone)] -#[unstable = "might get removed in favour of a constructor method on Split"] +#[unstable(feature = "core", + reason = "might get removed in favour of a constructor method on Split")] pub struct SplitTerminator<'a, P>(CharSplits<'a, P>); delegate_iter!{pattern &'a str : SplitTerminator<'a, P>} /// Return type of `StrExt::splitn` #[derive(Clone)] -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub struct SplitN<'a, P>(CharSplitsN<'a, P>); delegate_iter!{pattern forward &'a str : SplitN<'a, P>} /// Return type of `StrExt::rsplitn` #[derive(Clone)] -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub struct RSplitN<'a, P>(CharSplitsN<'a, P>); delegate_iter!{pattern forward &'a str : RSplitN<'a, P>} @@ -1648,7 +1667,7 @@ impl StrExt for str { /// Pluck a code point out of a UTF-8-like byte slice and return the /// index of the next code point. #[inline] -#[unstable] +#[unstable(feature = "core")] pub fn char_range_at_raw(bytes: &[u8], i: uint) -> (u32, usize) { if bytes[i] < 128u8 { return (bytes[i] as u32, i + 1); @@ -1671,13 +1690,13 @@ pub fn char_range_at_raw(bytes: &[u8], i: uint) -> (u32, usize) { multibyte_char_range_at(bytes, i) } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<'a> Default for &'a str { - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] fn default() -> &'a str { "" } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<'a> Iterator for Lines<'a> { type Item = &'a str; @@ -1687,13 +1706,13 @@ impl<'a> Iterator for Lines<'a> { fn size_hint(&self) -> (uint, Option<uint>) { self.inner.size_hint() } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<'a> DoubleEndedIterator for Lines<'a> { #[inline] fn next_back(&mut self) -> Option<&'a str> { self.inner.next_back() } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<'a> Iterator for LinesAny<'a> { type Item = &'a str; @@ -1703,7 +1722,7 @@ impl<'a> Iterator for LinesAny<'a> { fn size_hint(&self) -> (uint, Option<uint>) { self.inner.size_hint() } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<'a> DoubleEndedIterator for LinesAny<'a> { #[inline] fn next_back(&mut self) -> Option<&'a str> { self.inner.next_back() } diff --git a/src/libcore/tuple.rs b/src/libcore/tuple.rs index 5baeae236b3..64c2964eb7c 100644 --- a/src/libcore/tuple.rs +++ b/src/libcore/tuple.rs @@ -33,7 +33,7 @@ //! * `Ord` //! * `Default` -#![stable] +#![stable(feature = "rust1", since = "1.0.0")] use clone::Clone; use cmp::*; @@ -55,14 +55,14 @@ macro_rules! tuple_impls { } )+) => { $( - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] impl<$($T:Clone),+> Clone for ($($T,)+) { fn clone(&self) -> ($($T,)+) { ($(e!(self.$idx.clone()),)+) } } - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] impl<$($T:PartialEq),+> PartialEq for ($($T,)+) { #[inline] fn eq(&self, other: &($($T,)+)) -> bool { @@ -74,10 +74,10 @@ macro_rules! tuple_impls { } } - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] impl<$($T:Eq),+> Eq for ($($T,)+) {} - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] impl<$($T:PartialOrd + PartialEq),+> PartialOrd for ($($T,)+) { #[inline] fn partial_cmp(&self, other: &($($T,)+)) -> Option<Ordering> { @@ -101,7 +101,7 @@ macro_rules! tuple_impls { } } - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] impl<$($T:Ord),+> Ord for ($($T,)+) { #[inline] fn cmp(&self, other: &($($T,)+)) -> Ordering { @@ -109,9 +109,9 @@ macro_rules! tuple_impls { } } - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] impl<$($T:Default),+> Default for ($($T,)+) { - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] #[inline] fn default() -> ($($T,)+) { ($({ let x: $T = Default::default(); x},)+) |
