From c14d86fd3ff3ba2d01a6e859290b30e74081313b Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Tue, 9 Jun 2015 11:18:03 -0700 Subject: [PATCH] core: Split apart the global `core` feature This commit shards the broad `core` feature of the libcore library into finer grained features. This split groups together similar APIs and enables tracking each API separately, giving a better sense of where each feature is within the stabilization process. A few minor APIs were deprecated along the way: * Iterator::reverse_in_place * marker::NoCopy --- src/liballoc/boxed.rs | 18 +++++---- src/liballoc/lib.rs | 22 ++++++---- src/libarena/lib.rs | 4 +- src/libcollections/lib.rs | 30 ++++++++++---- src/libcore/any.rs | 2 +- src/libcore/array.rs | 11 ++--- src/libcore/cell.rs | 50 +++++++++++++---------- src/libcore/char.rs | 7 ++++ src/libcore/clone.rs | 9 ++--- src/libcore/cmp.rs | 38 +++++++++--------- src/libcore/convert.rs | 9 +++-- src/libcore/fmt/mod.rs | 20 +++++----- src/libcore/fmt/num.rs | 6 +-- src/libcore/fmt/rt/v1.rs | 2 - src/libcore/hash/mod.rs | 27 +++++++------ src/libcore/intrinsics.rs | 13 +++--- src/libcore/iter.rs | 73 ++++++++++++++++++---------------- src/libcore/lib.rs | 8 +++- src/libcore/macros.rs | 1 + src/libcore/marker.rs | 8 +++- src/libcore/mem.rs | 4 +- src/libcore/nonzero.rs | 3 +- src/libcore/num/f32.rs | 4 +- src/libcore/num/f64.rs | 4 +- src/libcore/num/flt2dec/mod.rs | 2 + src/libcore/num/int_macros.rs | 6 ++- src/libcore/num/mod.rs | 33 ++++++++------- src/libcore/num/uint_macros.rs | 6 ++- src/libcore/num/wrapping.rs | 2 +- src/libcore/ops.rs | 30 ++++++-------- src/libcore/option.rs | 2 +- src/libcore/panicking.rs | 3 ++ src/libcore/prelude.rs | 5 ++- src/libcore/ptr.rs | 26 ++++++------ src/libcore/raw.rs | 2 +- src/libcore/result.rs | 5 ++- src/libcore/simd.rs | 13 ++---- src/libcore/slice.rs | 27 ++++++------- src/libcore/str/mod.rs | 13 +++--- src/libcore/str/pattern.rs | 3 ++ src/libcore/ty.rs | 13 ------ src/liblog/lib.rs | 3 +- src/librand/lib.rs | 4 ++ src/librbml/lib.rs | 2 +- src/librustc/lib.rs | 9 ++++- src/librustc_back/lib.rs | 10 ++--- src/librustc_lint/lib.rs | 5 ++- src/librustc_trans/lib.rs | 14 +++++-- src/librustc_typeck/lib.rs | 4 +- src/librustc_unicode/lib.rs | 16 +++++--- src/libserialize/lib.rs | 5 ++- src/libstd/error.rs | 2 +- src/libstd/lib.rs | 26 +++++++++--- src/libsyntax/lib.rs | 3 +- 54 files changed, 379 insertions(+), 288 deletions(-) delete mode 100644 src/libcore/ty.rs diff --git a/src/liballoc/boxed.rs b/src/liballoc/boxed.rs index 4ee500faa22..91cbd3915d0 100644 --- a/src/liballoc/boxed.rs +++ b/src/liballoc/boxed.rs @@ -10,9 +10,9 @@ //! A pointer type for heap allocation. //! -//! `Box`, casually referred to as a 'box', provides the simplest form of heap allocation in -//! Rust. Boxes provide ownership for this allocation, and drop their contents when they go out of -//! scope. +//! `Box`, casually referred to as a 'box', provides the simplest form of +//! heap allocation in Rust. Boxes provide ownership for this allocation, and +//! drop their contents when they go out of scope. //! //! # Examples //! @@ -39,15 +39,17 @@ //! //! This will print `Cons(1, Cons(2, Nil))`. //! -//! Recursive structures must be boxed, because if the definition of `Cons` looked like this: +//! Recursive structures must be boxed, because if the definition of `Cons` +//! looked like this: //! //! ```rust,ignore //! Cons(T, List), //! ``` //! -//! It wouldn't work. This is because the size of a `List` depends on how many elements are in the -//! list, and so we don't know how much memory to allocate for a `Cons`. By introducing a `Box`, -//! which has a defined size, we know how big `Cons` needs to be. +//! It wouldn't work. This is because the size of a `List` depends on how many +//! elements are in the list, and so we don't know how much memory to allocate +//! for a `Cons`. By introducing a `Box`, which has a defined size, we know how +//! big `Cons` needs to be. #![stable(feature = "rust1", since = "1.0.0")] @@ -355,7 +357,7 @@ impl ExactSizeIterator for Box {} /// } /// ``` #[rustc_paren_sugar] -#[unstable(feature = "core", reason = "Newly introduced")] +#[unstable(feature = "fnbox", reason = "Newly introduced")] pub trait FnBox { type Output; diff --git a/src/liballoc/lib.rs b/src/liballoc/lib.rs index 5541a5f34c4..91585c3cb6c 100644 --- a/src/liballoc/lib.rs +++ b/src/liballoc/lib.rs @@ -60,26 +60,32 @@ #![cfg_attr(stage0, feature(custom_attribute))] #![crate_name = "alloc"] #![unstable(feature = "alloc")] -#![feature(staged_api)] #![staged_api] #![crate_type = "rlib"] #![doc(html_logo_url = "http://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png", html_favicon_url = "https://doc.rust-lang.org/favicon.ico", - html_root_url = "http://doc.rust-lang.org/nightly/")] -#![doc(test(no_crate_inject))] - -#![feature(no_std)] + html_root_url = "http://doc.rust-lang.org/nightly/", + test(no_crate_inject))] #![no_std] + #![feature(allocator)] +#![feature(box_syntax)] +#![feature(coerce_unsized)] +#![feature(core)] +#![feature(core_intrinsics)] +#![feature(core_prelude)] #![feature(custom_attribute)] #![feature(fundamental)] #![feature(lang_items)] -#![feature(box_syntax)] +#![feature(no_std)] +#![feature(nonzero)] #![feature(optin_builtin_traits)] +#![feature(raw)] +#![feature(staged_api)] #![feature(unboxed_closures)] -#![feature(unsafe_no_drop_flag, filling_drop)] -#![feature(core)] #![feature(unique)] +#![feature(unsafe_no_drop_flag, filling_drop)] +#![feature(unsize)] #![cfg_attr(test, feature(test, alloc, rustc_private))] #![cfg_attr(all(not(feature = "external_funcs"), not(feature = "external_crate")), feature(libc))] diff --git a/src/libarena/lib.rs b/src/libarena/lib.rs index 9bd23494da3..73641647bf4 100644 --- a/src/libarena/lib.rs +++ b/src/libarena/lib.rs @@ -32,7 +32,9 @@ #![feature(alloc)] #![feature(box_syntax)] -#![feature(core)] +#![feature(core_intrinsics)] +#![feature(ptr_as_ref)] +#![feature(raw)] #![feature(staged_api)] #![feature(unboxed_closures)] #![cfg_attr(test, feature(test))] diff --git a/src/libcollections/lib.rs b/src/libcollections/lib.rs index 6c233a31149..0c1349bc2e6 100644 --- a/src/libcollections/lib.rs +++ b/src/libcollections/lib.rs @@ -21,26 +21,42 @@ #![doc(html_logo_url = "http://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png", html_favicon_url = "https://doc.rust-lang.org/favicon.ico", html_root_url = "http://doc.rust-lang.org/nightly/", - html_playground_url = "http://play.rust-lang.org/")] -#![doc(test(no_crate_inject))] + html_playground_url = "http://play.rust-lang.org/", + test(no_crate_inject))] #![allow(trivial_casts)] +#![cfg_attr(test, allow(deprecated))] // rand + #![feature(alloc)] -#![feature(box_syntax)] #![feature(box_patterns)] +#![feature(box_syntax)] +#![feature(copy_lifetime)] #![feature(core)] +#![feature(core_intrinsics)] +#![feature(core_prelude)] +#![feature(core_slice_ext)] +#![feature(core_str_ext)] +#![feature(iter_cmp)] +#![feature(iter_idx)] +#![feature(iter_order)] +#![feature(iter_product)] +#![feature(iter_sum)] #![feature(lang_items)] +#![feature(num_bits_bytes)] +#![feature(pattern)] +#![feature(ptr_as_ref)] +#![feature(raw)] +#![feature(slice_patterns)] #![feature(staged_api)] +#![feature(step_by)] +#![feature(str_char)] +#![feature(str_internals)] #![feature(unboxed_closures)] #![feature(unicode)] #![feature(unique)] #![feature(unsafe_no_drop_flag, filling_drop)] -#![feature(step_by)] -#![feature(str_char)] -#![feature(slice_patterns)] #![feature(utf8_error)] #![cfg_attr(test, feature(rand, test))] -#![cfg_attr(test, allow(deprecated))] // rand #![cfg_attr(not(test), feature(str_words))] #![feature(no_std)] diff --git a/src/libcore/any.rs b/src/libcore/any.rs index a65394f5268..f0c77ae866d 100644 --- a/src/libcore/any.rs +++ b/src/libcore/any.rs @@ -92,7 +92,7 @@ #[stable(feature = "rust1", since = "1.0.0")] pub trait Any: Reflect + 'static { /// Gets the `TypeId` of `self`. - #[unstable(feature = "core", + #[unstable(feature = "get_type_id", reason = "this method will likely be replaced by an associated static")] fn get_type_id(&self) -> TypeId; } diff --git a/src/libcore/array.rs b/src/libcore/array.rs index 91301ee558c..a9b240de30b 100644 --- a/src/libcore/array.rs +++ b/src/libcore/array.rs @@ -12,9 +12,10 @@ //! up to a certain length. Eventually we should able to generalize //! to all lengths. -#![unstable(feature = "core")] // not yet reviewed - #![doc(primitive = "array")] +#![unstable(feature = "fixed_size_array", + reason = "traits and impls are better expressed through generic \ + integer constants")] use clone::Clone; use cmp::{PartialEq, Eq, PartialOrd, Ord, Ordering}; @@ -30,7 +31,6 @@ /// /// This trait can be used to implement other traits on fixed-size arrays /// without causing much metadata bloat. -#[unstable(feature = "core")] pub trait FixedSizeArray { /// Converts the array to immutable slice fn as_slice(&self) -> &[T]; @@ -42,7 +42,6 @@ pub trait FixedSizeArray { macro_rules! array_impls { ($($N:expr)+) => { $( - #[unstable(feature = "core")] impl FixedSizeArray for [T; $N] { #[inline] fn as_slice(&self) -> &[T] { @@ -54,8 +53,6 @@ fn as_mut_slice(&mut self) -> &mut [T] { } } - #[unstable(feature = "array_as_ref", - reason = "should ideally be implemented for all fixed-sized arrays")] impl AsRef<[T]> for [T; $N] { #[inline] fn as_ref(&self) -> &[T] { @@ -63,8 +60,6 @@ fn as_ref(&self) -> &[T] { } } - #[unstable(feature = "array_as_ref", - reason = "should ideally be implemented for all fixed-sized arrays")] impl AsMut<[T]> for [T; $N] { #[inline] fn as_mut(&mut self) -> &mut [T] { diff --git a/src/libcore/cell.rs b/src/libcore/cell.rs index 175dabaf1d2..56dfd922dc1 100644 --- a/src/libcore/cell.rs +++ b/src/libcore/cell.rs @@ -229,7 +229,7 @@ pub fn set(&self, value: T) { /// let uc = unsafe { c.as_unsafe_cell() }; /// ``` #[inline] - #[unstable(feature = "core")] + #[unstable(feature = "as_unsafe_cell")] pub unsafe fn as_unsafe_cell<'a>(&'a self) -> &'a UnsafeCell { &self.value } @@ -277,7 +277,7 @@ pub struct RefCell { /// An enumeration of values returned from the `state` method on a `RefCell`. #[derive(Copy, Clone, PartialEq, Eq, Debug)] -#[unstable(feature = "std_misc")] +#[unstable(feature = "borrow_state")] pub enum BorrowState { /// The cell is currently being read, there is at least one active `borrow`. Reading, @@ -339,7 +339,7 @@ impl RefCell { /// /// The returned value can be dispatched on to determine if a call to /// `borrow` or `borrow_mut` would succeed. - #[unstable(feature = "std_misc")] + #[unstable(feature = "borrow_state")] #[inline] pub fn borrow_state(&self) -> BorrowState { match self.borrow.get() { @@ -448,7 +448,7 @@ pub fn borrow_mut<'a>(&'a self) -> RefMut<'a, T> { /// /// This function is `unsafe` because `UnsafeCell`'s field is public. #[inline] - #[unstable(feature = "core")] + #[unstable(feature = "as_unsafe_cell")] pub unsafe fn as_unsafe_cell<'a>(&'a self) -> &'a UnsafeCell { &self.value } @@ -564,9 +564,10 @@ impl<'b, T: ?Sized> Ref<'b, T> { /// /// The `RefCell` is already immutably borrowed, so this cannot fail. /// - /// This is an associated function that needs to be used as `Ref::clone(...)`. - /// A `Clone` implementation or a method would interfere with the widespread - /// use of `r.borrow().clone()` to clone the contents of a `RefCell`. + /// This is an associated function that needs to be used as + /// `Ref::clone(...)`. A `Clone` implementation or a method would interfere + /// with the widespread use of `r.borrow().clone()` to clone the contents of + /// a `RefCell`. #[unstable(feature = "cell_extras", reason = "likely to be moved to a method, pending language changes")] #[inline] @@ -582,8 +583,8 @@ pub fn clone(orig: &Ref<'b, T>) -> Ref<'b, T> { /// The `RefCell` is already immutably borrowed, so this cannot fail. /// /// This is an associated function that needs to be used as `Ref::map(...)`. - /// A method would interfere with methods of the same name on the contents of a `RefCell` - /// used through `Deref`. + /// A method would interfere with methods of the same name on the contents + /// of a `RefCell` used through `Deref`. /// /// # Example /// @@ -607,13 +608,14 @@ pub fn map(orig: Ref<'b, T>, f: F) -> Ref<'b, U> } } - /// Make a new `Ref` for a optional component of the borrowed data, e.g. an enum variant. + /// Make a new `Ref` for a optional component of the borrowed data, e.g. an + /// enum variant. /// /// The `RefCell` is already immutably borrowed, so this cannot fail. /// - /// This is an associated function that needs to be used as `Ref::filter_map(...)`. - /// A method would interfere with methods of the same name on the contents of a `RefCell` - /// used through `Deref`. + /// This is an associated function that needs to be used as + /// `Ref::filter_map(...)`. A method would interfere with methods of the + /// same name on the contents of a `RefCell` used through `Deref`. /// /// # Example /// @@ -639,13 +641,14 @@ pub fn filter_map(orig: Ref<'b, T>, f: F) -> Option> } impl<'b, T: ?Sized> RefMut<'b, T> { - /// Make a new `RefMut` for a component of the borrowed data, e.g. an enum variant. + /// Make a new `RefMut` for a component of the borrowed data, e.g. an enum + /// variant. /// /// The `RefCell` is already mutably borrowed, so this cannot fail. /// - /// This is an associated function that needs to be used as `RefMut::map(...)`. - /// A method would interfere with methods of the same name on the contents of a `RefCell` - /// used through `Deref`. + /// This is an associated function that needs to be used as + /// `RefMut::map(...)`. A method would interfere with methods of the same + /// name on the contents of a `RefCell` used through `Deref`. /// /// # Example /// @@ -673,13 +676,14 @@ pub fn map(orig: RefMut<'b, T>, f: F) -> RefMut<'b, U> } } - /// Make a new `RefMut` for a optional component of the borrowed data, e.g. an enum variant. + /// Make a new `RefMut` for a optional component of the borrowed data, e.g. + /// an enum variant. /// /// The `RefCell` is already mutably borrowed, so this cannot fail. /// - /// This is an associated function that needs to be used as `RefMut::filter_map(...)`. - /// A method would interfere with methods of the same name on the contents of a `RefCell` - /// used through `Deref`. + /// This is an associated function that needs to be used as + /// `RefMut::filter_map(...)`. A method would interfere with methods of the + /// same name on the contents of a `RefCell` used through `Deref`. /// /// # Example /// @@ -690,7 +694,9 @@ pub fn map(orig: RefMut<'b, T>, f: F) -> RefMut<'b, U> /// let c = RefCell::new(Ok(5)); /// { /// let b1: RefMut> = c.borrow_mut(); - /// let mut b2: RefMut = RefMut::filter_map(b1, |o| o.as_mut().ok()).unwrap(); + /// let mut b2: RefMut = RefMut::filter_map(b1, |o| { + /// o.as_mut().ok() + /// }).unwrap(); /// assert_eq!(*b2, 5); /// *b2 = 42; /// } diff --git a/src/libcore/char.rs b/src/libcore/char.rs index df371752b86..9f5944d3c9c 100644 --- a/src/libcore/char.rs +++ b/src/libcore/char.rs @@ -14,6 +14,7 @@ #![allow(non_snake_case)] #![doc(primitive = "char")] +#![stable(feature = "rust1", since = "1.0.0")] use iter::Iterator; use mem::transmute; @@ -131,6 +132,8 @@ pub fn from_digit(num: u32, radix: u32) -> Option { // unicode/char.rs, not here #[allow(missing_docs)] // docs in libunicode/u_char.rs #[doc(hidden)] +#[unstable(feature = "core_char_ext", + reason = "the stable interface is `impl char` in later crate")] pub trait CharExt { fn is_digit(self, radix: u32) -> bool; fn to_digit(self, radix: u32) -> Option; @@ -220,6 +223,8 @@ fn encode_utf16(self, dst: &mut [u16]) -> Option { /// If the buffer is not large enough, nothing will be written into it /// and a `None` will be returned. #[inline] +#[unstable(feature = "char_internals", + reason = "this function should not be exposed publicly")] pub fn encode_utf8_raw(code: u32, dst: &mut [u8]) -> Option { // Marked #[inline] to allow llvm optimizing it away if code < MAX_ONE_B && !dst.is_empty() { @@ -251,6 +256,8 @@ pub fn encode_utf8_raw(code: u32, dst: &mut [u8]) -> Option { /// If the buffer is not large enough, nothing will be written into it /// and a `None` will be returned. #[inline] +#[unstable(feature = "char_internals", + reason = "this function should not be exposed publicly")] pub fn encode_utf16_raw(mut ch: u32, dst: &mut [u16]) -> Option { // Marked #[inline] to allow llvm optimizing it away if (ch & 0xFFFF) == ch && !dst.is_empty() { diff --git a/src/libcore/clone.rs b/src/libcore/clone.rs index f11c01507dc..a13160b3a19 100644 --- a/src/libcore/clone.rs +++ b/src/libcore/clone.rs @@ -89,29 +89,28 @@ fn clone(&self) -> $t { *self } macro_rules! extern_fn_clone { ($($A:ident),*) => ( - #[unstable(feature = "core", - reason = "this may not be sufficient for fns with region parameters")] + #[stable(feature = "rust1", since = "1.0.0")] impl<$($A,)* ReturnType> Clone for extern "Rust" fn($($A),*) -> ReturnType { /// Returns a copy of a function pointer. #[inline] fn clone(&self) -> extern "Rust" fn($($A),*) -> ReturnType { *self } } - #[unstable(feature = "core", reason = "brand new")] + #[stable(feature = "rust1", since = "1.0.0")] impl<$($A,)* ReturnType> Clone for extern "C" fn($($A),*) -> ReturnType { /// Returns a copy of a function pointer. #[inline] fn clone(&self) -> extern "C" fn($($A),*) -> ReturnType { *self } } - #[unstable(feature = "core", reason = "brand new")] + #[stable(feature = "rust1", since = "1.0.0")] impl<$($A,)* ReturnType> Clone for unsafe extern "Rust" fn($($A),*) -> ReturnType { /// Returns a copy of a function pointer. #[inline] fn clone(&self) -> unsafe extern "Rust" fn($($A),*) -> ReturnType { *self } } - #[unstable(feature = "core", reason = "brand new")] + #[stable(feature = "rust1", since = "1.0.0")] impl<$($A,)* ReturnType> Clone for unsafe extern "C" fn($($A),*) -> ReturnType { /// Returns a copy of a function pointer. #[inline] diff --git a/src/libcore/cmp.rs b/src/libcore/cmp.rs index dab549f784c..b12b5976010 100644 --- a/src/libcore/cmp.rs +++ b/src/libcore/cmp.rs @@ -10,10 +10,10 @@ //! Functionality for ordering and comparison. //! -//! This module defines both `PartialOrd` and `PartialEq` traits which are used by the compiler to -//! implement comparison operators. Rust programs may implement `PartialOrd` to overload the `<`, -//! `<=`, `>`, and `>=` operators, and may implement `PartialEq` to overload the `==` and `!=` -//! operators. +//! This module defines both `PartialOrd` and `PartialEq` traits which are used +//! by the compiler to implement comparison operators. Rust programs may +//! implement `PartialOrd` to overload the `<`, `<=`, `>`, and `>=` operators, +//! and may implement `PartialEq` to overload the `==` and `!=` operators. #![stable(feature = "rust1", since = "1.0.0")] @@ -22,29 +22,31 @@ use marker::Sized; use option::Option::{self, Some, None}; -/// Trait for equality comparisons which are [partial equivalence relations]( -/// http://en.wikipedia.org/wiki/Partial_equivalence_relation). +/// Trait for equality comparisons which are [partial equivalence +/// relations](http://en.wikipedia.org/wiki/Partial_equivalence_relation). /// -/// This trait allows for partial equality, for types that do not have a full equivalence relation. -/// For example, in floating point numbers `NaN != NaN`, so floating point types implement -/// `PartialEq` but not `Eq`. +/// This trait allows for partial equality, for types that do not have a full +/// equivalence relation. For example, in floating point numbers `NaN != NaN`, +/// so floating point types implement `PartialEq` but not `Eq`. /// /// Formally, the equality must be (for all `a`, `b` and `c`): /// /// - symmetric: `a == b` implies `b == a`; and /// - transitive: `a == b` and `b == c` implies `a == c`. /// -/// Note that these requirements mean that the trait itself must be implemented symmetrically and -/// transitively: if `T: PartialEq` and `U: PartialEq` then `U: PartialEq` and `T: -/// PartialEq`. +/// Note that these requirements mean that the trait itself must be implemented +/// symmetrically and transitively: if `T: PartialEq` and `U: PartialEq` +/// then `U: PartialEq` and `T: PartialEq`. /// -/// PartialEq only requires the `eq` method to be implemented; `ne` is defined in terms of it by -/// default. Any manual implementation of `ne` *must* respect the rule that `eq` is a strict -/// inverse of `ne`; that is, `!(a == b)` if and only if `a != b`. +/// PartialEq only requires the `eq` method to be implemented; `ne` is defined +/// in terms of it by default. Any manual implementation of `ne` *must* respect +/// the rule that `eq` is a strict inverse of `ne`; that is, `!(a == b)` if and +/// only if `a != b`. #[lang = "eq"] #[stable(feature = "rust1", since = "1.0.0")] pub trait PartialEq { - /// This method tests for `self` and `other` values to be equal, and is used by `==`. + /// This method tests for `self` and `other` values to be equal, and is used + /// by `==`. #[stable(feature = "rust1", since = "1.0.0")] fn eq(&self, other: &Rhs) -> bool; @@ -396,7 +398,7 @@ pub fn max(v1: T, v2: T) -> T { /// assert_eq!(result, None); /// ``` #[inline] -#[unstable(feature = "core")] +#[unstable(feature = "cmp_partial")] pub fn partial_min(v1: T, v2: T) -> Option { match v1.partial_cmp(&v2) { Some(Less) | Some(Equal) => Some(v1), @@ -429,7 +431,7 @@ pub fn partial_min(v1: T, v2: T) -> Option { /// assert_eq!(result, None); /// ``` #[inline] -#[unstable(feature = "core")] +#[unstable(feature = "cmp_partial")] pub fn partial_max(v1: T, v2: T) -> Option { match v1.partial_cmp(&v2) { Some(Equal) | Some(Less) => Some(v2), diff --git a/src/libcore/convert.rs b/src/libcore/convert.rs index f6987c19664..70868805299 100644 --- a/src/libcore/convert.rs +++ b/src/libcore/convert.rs @@ -10,11 +10,12 @@ //! Traits for conversions between types. //! -//! The traits in this module provide a general way to talk about conversions from one type to -//! another. They follow the standard Rust conventions of `as`/`into`/`from`. +//! The traits in this module provide a general way to talk about conversions +//! from one type to another. They follow the standard Rust conventions of +//! `as`/`into`/`from`. //! -//! Like many traits, these are often used as bounds for generic functions, to support arguments of -//! multiple types. +//! Like many traits, these are often used as bounds for generic functions, to +//! support arguments of multiple types. //! //! See each trait for usage examples. diff --git a/src/libcore/fmt/mod.rs b/src/libcore/fmt/mod.rs index 76a40dc8a52..cbbb186af76 100644 --- a/src/libcore/fmt/mod.rs +++ b/src/libcore/fmt/mod.rs @@ -33,7 +33,7 @@ mod num; mod builders; -#[unstable(feature = "core", reason = "internal to format_args!")] +#[unstable(feature = "fmt_internals", reason = "internal to format_args!")] #[doc(hidden)] pub mod rt { pub mod v1; @@ -146,7 +146,7 @@ enum Void {} /// 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. #[derive(Copy)] -#[unstable(feature = "core", reason = "internal to format_args!")] +#[unstable(feature = "fmt_internals", reason = "internal to format_args!")] #[doc(hidden)] pub struct ArgumentV1<'a> { value: &'a Void, @@ -166,7 +166,7 @@ fn show_usize(x: &usize, f: &mut Formatter) -> Result { } #[doc(hidden)] - #[unstable(feature = "core", reason = "internal to format_args!")] + #[unstable(feature = "fmt_internals", reason = "internal to format_args!")] pub fn new<'b, T>(x: &'b T, f: fn(&T, &mut Formatter) -> Result) -> ArgumentV1<'b> { unsafe { @@ -178,7 +178,7 @@ pub fn new<'b, T>(x: &'b T, } #[doc(hidden)] - #[unstable(feature = "core", reason = "internal to format_args!")] + #[unstable(feature = "fmt_internals", reason = "internal to format_args!")] pub fn from_usize(x: &usize) -> ArgumentV1 { ArgumentV1::new(x, ArgumentV1::show_usize) } @@ -201,7 +201,7 @@ impl<'a> Arguments<'a> { /// When using the format_args!() macro, this function is used to generate the /// Arguments structure. #[doc(hidden)] #[inline] - #[unstable(feature = "core", reason = "internal to format_args!")] + #[unstable(feature = "fmt_internals", reason = "internal to format_args!")] pub fn new_v1(pieces: &'a [&'a str], args: &'a [ArgumentV1<'a>]) -> Arguments<'a> { Arguments { @@ -218,7 +218,7 @@ pub fn new_v1(pieces: &'a [&'a str], /// created with `argumentusize`. However, failing to do so doesn't cause /// unsafety, but will ignore invalid . #[doc(hidden)] #[inline] - #[unstable(feature = "core", reason = "internal to format_args!")] + #[unstable(feature = "fmt_internals", reason = "internal to format_args!")] pub fn new_v1_formatted(pieces: &'a [&'a str], args: &'a [ArgumentV1<'a>], fmt: &'a [rt::v1::Argument]) -> Arguments<'a> { @@ -742,19 +742,19 @@ pub fn write_fmt(&mut self, fmt: Arguments) -> Result { pub fn flags(&self) -> u32 { self.flags } /// Character used as 'fill' whenever there is alignment - #[unstable(feature = "core", reason = "method was just created")] + #[unstable(feature = "fmt_flags", reason = "method was just created")] pub fn fill(&self) -> char { self.fill } /// Flag indicating what form of alignment was requested - #[unstable(feature = "core", reason = "method was just created")] + #[unstable(feature = "fmt_flags", reason = "method was just created")] pub fn align(&self) -> Alignment { self.align } /// Optionally specified integer width that the output should be - #[unstable(feature = "core", reason = "method was just created")] + #[unstable(feature = "fmt_flags", reason = "method was just created")] pub fn width(&self) -> Option { self.width } /// Optionally specified precision for numeric types - #[unstable(feature = "core", reason = "method was just created")] + #[unstable(feature = "fmt_flags", reason = "method was just created")] pub fn precision(&self) -> Option { self.precision } /// Creates a `DebugStruct` builder designed to assist with creation of diff --git a/src/libcore/fmt/num.rs b/src/libcore/fmt/num.rs index 122fffc5959..6aaec20382e 100644 --- a/src/libcore/fmt/num.rs +++ b/src/libcore/fmt/num.rs @@ -127,7 +127,7 @@ fn digit(&self, x: u8) -> u8 { /// A radix with in the range of `2..36`. #[derive(Clone, Copy, PartialEq)] -#[unstable(feature = "core", +#[unstable(feature = "fmt_radix", reason = "may be renamed or move to a different module")] pub struct Radix { base: u8, @@ -152,7 +152,7 @@ fn digit(&self, x: u8) -> u8 { } /// A helper type for formatting radixes. -#[unstable(feature = "core", +#[unstable(feature = "fmt_radix", reason = "may be renamed or move to a different module")] #[derive(Copy, Clone)] pub struct RadixFmt(T, R); @@ -166,7 +166,7 @@ fn digit(&self, x: u8) -> u8 { /// use std::fmt::radix; /// assert_eq!(format!("{}", radix(55, 36)), "1j".to_string()); /// ``` -#[unstable(feature = "core", +#[unstable(feature = "fmt_radix", reason = "may be renamed or move to a different module")] pub fn radix(x: T, base: u8) -> RadixFmt { RadixFmt(x, Radix::new(base)) diff --git a/src/libcore/fmt/rt/v1.rs b/src/libcore/fmt/rt/v1.rs index 2afd8abeb31..033834dd5aa 100644 --- a/src/libcore/fmt/rt/v1.rs +++ b/src/libcore/fmt/rt/v1.rs @@ -14,8 +14,6 @@ //! 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(feature = "core", reason = "internal to format_args!")] - #[derive(Copy, Clone)] pub struct Argument { pub position: Position, diff --git a/src/libcore/hash/mod.rs b/src/libcore/hash/mod.rs index e848a44e01c..cbf2828a7dc 100644 --- a/src/libcore/hash/mod.rs +++ b/src/libcore/hash/mod.rs @@ -89,7 +89,8 @@ pub trait Hash { fn hash(&self, state: &mut H); /// Feeds a slice of this type into the state provided. - #[unstable(feature = "hash", reason = "module was recently redesigned")] + #[unstable(feature = "hash_slice", + reason = "module was recently redesigned")] fn hash_slice(data: &[Self], state: &mut H) where Self: Sized { for piece in data { piece.hash(state); @@ -110,29 +111,29 @@ pub trait Hasher { /// Write a single `u8` into this hasher #[inline] - #[unstable(feature = "hash", reason = "module was recently redesigned")] + #[unstable(feature = "hasher_write", reason = "module was recently redesigned")] fn write_u8(&mut self, i: u8) { self.write(&[i]) } /// Write a single `u16` into this hasher. #[inline] - #[unstable(feature = "hash", reason = "module was recently redesigned")] + #[unstable(feature = "hasher_write", reason = "module was recently redesigned")] fn write_u16(&mut self, i: u16) { self.write(&unsafe { mem::transmute::<_, [u8; 2]>(i) }) } /// Write a single `u32` into this hasher. #[inline] - #[unstable(feature = "hash", reason = "module was recently redesigned")] + #[unstable(feature = "hasher_write", reason = "module was recently redesigned")] fn write_u32(&mut self, i: u32) { self.write(&unsafe { mem::transmute::<_, [u8; 4]>(i) }) } /// Write a single `u64` into this hasher. #[inline] - #[unstable(feature = "hash", reason = "module was recently redesigned")] + #[unstable(feature = "hasher_write", reason = "module was recently redesigned")] fn write_u64(&mut self, i: u64) { self.write(&unsafe { mem::transmute::<_, [u8; 8]>(i) }) } /// Write a single `usize` into this hasher. #[inline] - #[unstable(feature = "hash", reason = "module was recently redesigned")] + #[unstable(feature = "hasher_write", reason = "module was recently redesigned")] fn write_usize(&mut self, i: usize) { if cfg!(target_pointer_width = "32") { self.write_u32(i as u32) @@ -143,23 +144,23 @@ fn write_usize(&mut self, i: usize) { /// Write a single `i8` into this hasher. #[inline] - #[unstable(feature = "hash", reason = "module was recently redesigned")] + #[unstable(feature = "hasher_write", reason = "module was recently redesigned")] fn write_i8(&mut self, i: i8) { self.write_u8(i as u8) } /// Write a single `i16` into this hasher. #[inline] - #[unstable(feature = "hash", reason = "module was recently redesigned")] + #[unstable(feature = "hasher_write", reason = "module was recently redesigned")] fn write_i16(&mut self, i: i16) { self.write_u16(i as u16) } /// Write a single `i32` into this hasher. #[inline] - #[unstable(feature = "hash", reason = "module was recently redesigned")] + #[unstable(feature = "hasher_write", reason = "module was recently redesigned")] fn write_i32(&mut self, i: i32) { self.write_u32(i as u32) } /// Write a single `i64` into this hasher. #[inline] - #[unstable(feature = "hash", reason = "module was recently redesigned")] + #[unstable(feature = "hasher_write", reason = "module was recently redesigned")] fn write_i64(&mut self, i: i64) { self.write_u64(i as u64) } /// Write a single `isize` into this hasher. #[inline] - #[unstable(feature = "hash", reason = "module was recently redesigned")] + #[unstable(feature = "hasher_write", reason = "module was recently redesigned")] fn write_isize(&mut self, i: isize) { self.write_usize(i as usize) } } @@ -167,7 +168,9 @@ fn write_isize(&mut self, i: isize) { self.write_usize(i as usize) } /// /// The specified value will be hashed with this hasher and then the resulting /// hash will be returned. -#[unstable(feature = "hash", reason = "module was recently redesigned")] +#[unstable(feature = "hash_default", + reason = "not the most ergonomic interface unless `H` is defaulted \ + to SipHasher, but perhaps not ready to commit to that")] pub fn hash(value: &T) -> u64 { let mut h: H = Default::default(); value.hash(&mut h); diff --git a/src/libcore/intrinsics.rs b/src/libcore/intrinsics.rs index 774f86563d7..455928077da 100644 --- a/src/libcore/intrinsics.rs +++ b/src/libcore/intrinsics.rs @@ -39,7 +39,10 @@ //! guaranteed to happen in order. This is the standard mode for working //! with atomic types and is equivalent to Java's `volatile`. -#![unstable(feature = "core")] +#![unstable(feature = "core_intrinsics", + reason = "intrinsics are unlikely to ever be stabilized, instead \ + they should be used through stabilized interfaces \ + in the rest of the standard library")] #![allow(missing_docs)] use marker::Sized; @@ -141,10 +144,10 @@ /// A compiler-only memory barrier. /// - /// Memory accesses will never be reordered across this barrier by the compiler, - /// but no instructions will be emitted for it. This is appropriate for operations - /// on the same thread that may be preempted, such as when interacting with signal - /// handlers. + /// Memory accesses will never be reordered across this barrier by the + /// compiler, but no instructions will be emitted for it. This is + /// appropriate for operations on the same thread that may be preempted, + /// such as when interacting with signal handlers. pub fn atomic_singlethreadfence(); pub fn atomic_singlethreadfence_acq(); pub fn atomic_singlethreadfence_rel(); diff --git a/src/libcore/iter.rs b/src/libcore/iter.rs index ae2248206c4..da714671c57 100644 --- a/src/libcore/iter.rs +++ b/src/libcore/iter.rs @@ -51,8 +51,8 @@ //! } //! ``` //! -//! Because `Iterator`s implement `IntoIterator`, this `for` loop syntax can be applied to any -//! iterator over any type. +//! Because `Iterator`s implement `IntoIterator`, this `for` loop syntax can be +//! applied to any iterator over any type. #![stable(feature = "rust1", since = "1.0.0")] @@ -837,7 +837,9 @@ fn min(self) -> Option where Self: Sized, Self::Item: Ord /// let a = [1, 1, 1, 1]; /// assert_eq!(a.iter().min_max(), MinMax(&1, &1)); /// ``` - #[unstable(feature = "core", reason = "return type may change")] + #[unstable(feature = "iter_min_max", + reason = "return type may change or may wish to have a closure \ + based version as well")] fn min_max(mut self) -> MinMaxResult where Self: Sized, Self::Item: Ord { let (mut min, mut max) = match self.next() { @@ -897,7 +899,7 @@ fn min_max(mut self) -> MinMaxResult where Self: Sized, Self::Item: /// assert_eq!(*a.iter().max_by(|x| x.abs()).unwrap(), -10); /// ``` #[inline] - #[unstable(feature = "core", + #[unstable(feature = "iter_cmp", reason = "may want to produce an Ordering directly; see #15311")] fn max_by(self, f: F) -> Option where Self: Sized, @@ -925,7 +927,7 @@ fn max_by(self, f: F) -> Option where /// assert_eq!(*a.iter().min_by(|x| x.abs()).unwrap(), 0); /// ``` #[inline] - #[unstable(feature = "core", + #[unstable(feature = "iter_cmp", reason = "may want to produce an Ordering directly; see #15311")] fn min_by(self, f: F) -> Option where Self: Sized, @@ -1041,6 +1043,8 @@ fn cycle(self) -> Cycle where Self: Sized + Clone { /// Use an iterator to reverse a container in place. #[unstable(feature = "core", reason = "uncertain about placement or widespread use")] + #[deprecated(since = "1.2.0", + reason = "not performant enough to justify inclusion")] fn reverse_in_place<'a, T: 'a>(&mut self) where Self: Sized + Iterator + DoubleEndedIterator { @@ -1062,7 +1066,7 @@ fn reverse_in_place<'a, T: 'a>(&mut self) where /// let it = a.iter(); /// assert_eq!(it.sum::(), 15); /// ``` - #[unstable(feature="core")] + #[unstable(feature="iter_sum", reason = "bounds recently changed")] fn sum::Item>(self) -> S where S: Add + Zero, Self: Sized, @@ -1083,7 +1087,7 @@ fn sum::Item>(self) -> S where /// assert_eq!(factorial(1), 1); /// assert_eq!(factorial(5), 120); /// ``` - #[unstable(feature="core")] + #[unstable(feature="iter_product", reason = "bounds recently changed")] fn product::Item>(self) -> P where P: Mul + One, Self: Sized, @@ -1223,7 +1227,7 @@ fn next_back(&mut self) -> Option { (**self).next_back() } /// `DoubleEndedIterator`. 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(feature = "core", +#[unstable(feature = "iter_idx", reason = "not widely used, may be better decomposed into Index \ and ExactSizeIterator")] pub trait RandomAccessIterator: Iterator { @@ -1304,7 +1308,7 @@ impl DoubleEndedIterator for Rev where I: DoubleEndedIterator { fn next_back(&mut self) -> Option<::Item> { self.iter.next() } } -#[unstable(feature = "core", reason = "trait is experimental")] +#[unstable(feature = "iter_idx", reason = "trait is experimental")] impl RandomAccessIterator for Rev where I: DoubleEndedIterator + RandomAccessIterator { @@ -1324,7 +1328,7 @@ fn idx(&mut self, index: usize) -> Option<::Item> { /// `MinMaxResult` is an enum returned by `min_max`. See `Iterator::min_max` for /// more detail. #[derive(Clone, PartialEq, Debug)] -#[unstable(feature = "core", +#[unstable(feature = "iter_min_max", reason = "unclear whether such a fine-grained result is widely useful")] pub enum MinMaxResult { /// Empty iterator @@ -1338,6 +1342,7 @@ pub enum MinMaxResult { MinMax(T, T) } +#[unstable(feature = "iter_min_max", reason = "type is unstable")] impl MinMaxResult { /// `into_option` creates an `Option` of type `(T,T)`. The returned `Option` /// has variant `None` if and only if the `MinMaxResult` has variant @@ -1360,7 +1365,6 @@ impl MinMaxResult { /// let r = MinMax(1, 2); /// assert_eq!(r.into_option(), Some((1, 2))); /// ``` - #[unstable(feature = "core", reason = "type is unstable")] pub fn into_option(self) -> Option<(T,T)> { match self { NoElements => None, @@ -1407,7 +1411,7 @@ impl<'a, I, T: 'a> ExactSizeIterator for Cloned where I: ExactSizeIterator, T: Clone {} -#[unstable(feature = "core", reason = "trait is experimental")] +#[unstable(feature = "iter_idx", reason = "trait is experimental")] impl<'a, I, T: 'a> RandomAccessIterator for Cloned where I: RandomAccessIterator, T: Clone { @@ -1454,7 +1458,7 @@ fn size_hint(&self) -> (usize, Option) { } } -#[unstable(feature = "core", reason = "trait is experimental")] +#[unstable(feature = "iter_idx", reason = "trait is experimental")] impl RandomAccessIterator for Cycle where I: Clone + RandomAccessIterator, { @@ -1568,7 +1572,7 @@ fn next_back(&mut self) -> Option { } } -#[unstable(feature = "core", reason = "trait is experimental")] +#[unstable(feature = "iter_idx", reason = "trait is experimental")] impl RandomAccessIterator for Chain where A: RandomAccessIterator, B: RandomAccessIterator, @@ -1656,7 +1660,7 @@ fn next_back(&mut self) -> Option<(A::Item, B::Item)> { } } -#[unstable(feature = "core", reason = "trait is experimental")] +#[unstable(feature = "iter_idx", reason = "trait is experimental")] impl RandomAccessIterator for Zip where A: RandomAccessIterator, B: RandomAccessIterator @@ -1710,7 +1714,7 @@ fn next_back(&mut self) -> Option { } } -#[unstable(feature = "core", reason = "trait is experimental")] +#[unstable(feature = "iter_idx", reason = "trait is experimental")] impl RandomAccessIterator for Map where F: FnMut(I::Item) -> B, { @@ -1884,7 +1888,7 @@ fn next_back(&mut self) -> Option<(usize, ::Item)> { } } -#[unstable(feature = "core", reason = "trait is experimental")] +#[unstable(feature = "iter_idx", reason = "trait is experimental")] impl RandomAccessIterator for Enumerate where I: RandomAccessIterator { #[inline] fn indexable(&self) -> usize { @@ -2134,7 +2138,7 @@ fn size_hint(&self) -> (usize, Option) { } } -#[unstable(feature = "core", reason = "trait is experimental")] +#[unstable(feature = "iter_idx", reason = "trait is experimental")] impl RandomAccessIterator for Skip where I: RandomAccessIterator{ #[inline] fn indexable(&self) -> usize { @@ -2206,7 +2210,7 @@ fn size_hint(&self) -> (usize, Option) { } } -#[unstable(feature = "core", reason = "trait is experimental")] +#[unstable(feature = "iter_idx", reason = "trait is experimental")] impl RandomAccessIterator for Take where I: RandomAccessIterator{ #[inline] fn indexable(&self) -> usize { @@ -2236,7 +2240,8 @@ pub struct Scan { f: F, /// The current internal state to be passed to the closure next. - #[unstable(feature = "core")] + #[unstable(feature = "scan_state", + reason = "public fields are otherwise rare in the stdlib")] pub state: St, } @@ -2406,7 +2411,7 @@ fn next_back(&mut self) -> Option<::Item> { } // Allow RandomAccessIterators to be fused without affecting random-access behavior -#[unstable(feature = "core", reason = "trait is experimental")] +#[unstable(feature = "iter_idx", reason = "trait is experimental")] impl RandomAccessIterator for Fuse where I: RandomAccessIterator { #[inline] fn indexable(&self) -> usize { @@ -2427,7 +2432,7 @@ impl Fuse { /// `.next_back()` will call the underlying iterator again even if it /// previously returned `None`. #[inline] - #[unstable(feature = "core", reason = "seems marginal")] + #[unstable(feature = "iter_reset_fuse", reason = "seems marginal")] pub fn reset_fuse(&mut self) { self.done = false } @@ -2481,7 +2486,7 @@ fn next_back(&mut self) -> Option { } } -#[unstable(feature = "core", reason = "trait is experimental")] +#[unstable(feature = "iter_idx", reason = "trait is experimental")] impl RandomAccessIterator for Inspect where F: FnMut(&I::Item), { @@ -2531,16 +2536,16 @@ fn idx(&mut self, index: usize) -> Option { /// println!("{}", i); /// } /// ``` -#[unstable(feature = "core")] +#[unstable(feature = "iter_unfold")] #[derive(Clone)] pub struct Unfold { f: F, /// Internal state that will be passed to the closure on the next iteration - #[unstable(feature = "core")] + #[unstable(feature = "iter_unfold")] pub state: St, } -#[unstable(feature = "core")] +#[unstable(feature = "iter_unfold")] impl Unfold where F: FnMut(&mut St) -> Option { /// Creates a new iterator with the specified closure as the "iterator /// function" and an initial state to eventually pass to the closure @@ -2767,7 +2772,7 @@ fn size_hint(&self) -> (usize, Option) { /// An iterator over the range [start, stop] #[derive(Clone)] -#[unstable(feature = "core", +#[unstable(feature = "range_inclusive", reason = "likely to be replaced by range notation and adapters")] pub struct RangeInclusive { range: ops::Range, @@ -2776,7 +2781,7 @@ pub struct RangeInclusive { /// Returns an iterator over the range [start, stop]. #[inline] -#[unstable(feature = "core", +#[unstable(feature = "range_inclusive", reason = "likely to be replaced by range notation and adapters")] pub fn range_inclusive(start: A, stop: A) -> RangeInclusive where A: Step + One + Clone @@ -2787,7 +2792,7 @@ pub fn range_inclusive(start: A, stop: A) -> RangeInclusive } } -#[unstable(feature = "core", +#[unstable(feature = "range_inclusive", reason = "likely to be replaced by range notation and adapters")] impl Iterator for RangeInclusive where A: PartialEq + Step + One + Clone, @@ -2820,7 +2825,7 @@ fn size_hint(&self) -> (usize, Option) { } } -#[unstable(feature = "core", +#[unstable(feature = "range_inclusive", reason = "likely to be replaced by range notation and adapters")] impl DoubleEndedIterator for RangeInclusive where A: PartialEq + Step + One + Clone, @@ -2973,7 +2978,7 @@ impl DoubleEndedIterator for Repeat { fn next_back(&mut self) -> Option { self.idx(0) } } -#[unstable(feature = "core", reason = "trait is experimental")] +#[unstable(feature = "iter_idx", reason = "trait is experimental")] impl RandomAccessIterator for Repeat { #[inline] fn indexable(&self) -> usize { usize::MAX } @@ -2985,12 +2990,12 @@ fn idx(&mut self, _: usize) -> Option { Some(self.element.clone()) } /// An iterator that repeatedly applies a given function, starting /// from a given seed value. -#[unstable(feature = "core")] +#[unstable(feature = "iter_iterate")] pub type Iterate = Unfold, fn(&mut IterateState) -> Option>; /// Creates a new iterator that produces an infinite sequence of /// repeated applications of the given function `f`. -#[unstable(feature = "core")] +#[unstable(feature = "iter_iterate")] pub fn iterate(seed: T, f: F) -> Iterate where T: Clone, F: FnMut(T) -> T, @@ -3123,7 +3128,7 @@ pub fn once(value: T) -> Once { /// /// If two sequences are equal up until the point where one ends, /// the shorter sequence compares less. -#[unstable(feature = "core", reason = "needs review and revision")] +#[unstable(feature = "iter_order", 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 9dfaec0095a..030d2a33f8f 100644 --- a/src/libcore/lib.rs +++ b/src/libcore/lib.rs @@ -49,7 +49,9 @@ // Do not remove on snapshot creation. Needed for bootstrap. (Issue #22364) #![cfg_attr(stage0, feature(custom_attribute))] #![crate_name = "core"] -#![unstable(feature = "core")] +#![unstable(feature = "core", + reason = "the libcore library has not yet been scrutinized for \ + stabilization in terms of structure and naming")] #![staged_api] #![crate_type = "rlib"] #![doc(html_logo_url = "http://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png", @@ -63,7 +65,8 @@ #![allow(raw_pointer_derive)] #![deny(missing_docs)] -#![feature(intrinsics, lang_items)] +#![feature(intrinsics)] +#![feature(lang_items)] #![feature(on_unimplemented)] #![feature(simd)] #![feature(staged_api)] @@ -75,6 +78,7 @@ #![feature(reflect)] #![feature(custom_attribute)] #![feature(const_fn)] +#![feature(allow_internal_unstable)] #[macro_use] mod macros; diff --git a/src/libcore/macros.rs b/src/libcore/macros.rs index b5555fa5119..14bb82dff7d 100644 --- a/src/libcore/macros.rs +++ b/src/libcore/macros.rs @@ -10,6 +10,7 @@ /// Entry point of thread panic, for details, see std::macros #[macro_export] +#[allow_internal_unstable] macro_rules! panic { () => ( panic!("explicit panic") diff --git a/src/libcore/marker.rs b/src/libcore/marker.rs index 7c20722b26d..dc3b06977d6 100644 --- a/src/libcore/marker.rs +++ b/src/libcore/marker.rs @@ -54,7 +54,7 @@ pub trait Sized { } /// Types that can be "unsized" to a dynamically sized type. -#[unstable(feature = "core")] +#[unstable(feature = "unsize")] #[lang="unsize"] pub trait Unsize { // Empty. @@ -223,7 +223,10 @@ impl !Sync for *mut T { } /// ensure that they are never copied, even if they lack a destructor. #[unstable(feature = "core", reason = "likely to change with new variance strategy")] +#[deprecated(since = "1.2.0", + reason = "structs are by default not copyable")] #[lang = "no_copy_bound"] +#[allow(deprecated)] #[derive(Clone, PartialEq, Eq, PartialOrd, Ord)] pub struct NoCopy; @@ -410,7 +413,8 @@ unsafe impl<'a, T: Send + ?Sized> Send for &'a mut T {} /// /// [1]: http://en.wikipedia.org/wiki/Parametricity #[rustc_reflect_like] -#[unstable(feature = "core", reason = "requires RFC and more experience")] +#[unstable(feature = "reflect_marker", + reason = "requires RFC and more experience")] #[allow(deprecated)] #[rustc_on_unimplemented = "`{Self}` does not implement `Any`; \ ensure all type parameters are bounded by `Any`"] diff --git a/src/libcore/mem.rs b/src/libcore/mem.rs index 26c6e899df1..4e9613454ab 100644 --- a/src/libcore/mem.rs +++ b/src/libcore/mem.rs @@ -459,7 +459,7 @@ pub unsafe fn transmute_copy(src: &T) -> U { /// Transforms lifetime of the second pointer to match the first. #[inline] -#[unstable(feature = "core", +#[unstable(feature = "copy_lifetime", 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, @@ -469,7 +469,7 @@ 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(feature = "core", +#[unstable(feature = "copy_lifetime", 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 S, diff --git a/src/libcore/nonzero.rs b/src/libcore/nonzero.rs index 32522794254..1b5fa4e0e95 100644 --- a/src/libcore/nonzero.rs +++ b/src/libcore/nonzero.rs @@ -9,6 +9,8 @@ // except according to those terms. //! Exposes the NonZero lang item which provides optimization hints. +#![unstable(feature = "nonzero", + reason = "needs an RFC to flesh out the design")] use marker::Sized; use ops::{CoerceUnsized, Deref}; @@ -33,7 +35,6 @@ unsafe impl Zeroable for u64 {} /// NULL or 0 that might allow certain optimizations. #[lang = "non_zero"] #[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Debug, Hash)] -#[unstable(feature = "core")] pub struct NonZero(T); impl NonZero { diff --git a/src/libcore/num/f32.rs b/src/libcore/num/f32.rs index 50dd3f1661a..229414fe766 100644 --- a/src/libcore/num/f32.rs +++ b/src/libcore/num/f32.rs @@ -71,7 +71,8 @@ pub mod consts { pub const PI: f32 = 3.14159265358979323846264338327950288_f32; /// pi * 2.0 - #[unstable(feature = "core", reason = "unclear naming convention/usefulness")] + #[unstable(feature = "float_consts", + reason = "unclear naming convention/usefulness")] pub const PI_2: f32 = 6.28318530717958647692528676655900576_f32; /// pi/2.0 @@ -135,7 +136,6 @@ pub mod consts { pub const LN_10: f32 = 2.30258509299404568401799145468436421_f32; } -#[unstable(feature = "core", reason = "trait is unstable")] impl Float for f32 { #[inline] fn nan() -> f32 { NAN } diff --git a/src/libcore/num/f64.rs b/src/libcore/num/f64.rs index 62b566e7eb4..bbc1bdacde7 100644 --- a/src/libcore/num/f64.rs +++ b/src/libcore/num/f64.rs @@ -71,7 +71,8 @@ pub mod consts { pub const PI: f64 = 3.14159265358979323846264338327950288_f64; /// pi * 2.0 - #[unstable(feature = "core", reason = "unclear naming convention/usefulness")] + #[unstable(feature = "float_consts", + reason = "unclear naming convention/usefulness")] pub const PI_2: f64 = 6.28318530717958647692528676655900576_f64; /// pi/2.0 @@ -135,7 +136,6 @@ pub mod consts { pub const LN_10: f64 = 2.30258509299404568401799145468436421_f64; } -#[unstable(feature = "core", reason = "trait is unstable")] impl Float for f64 { #[inline] fn nan() -> f64 { NAN } diff --git a/src/libcore/num/flt2dec/mod.rs b/src/libcore/num/flt2dec/mod.rs index f51dcf54a19..f3a7e8f09a9 100644 --- a/src/libcore/num/flt2dec/mod.rs +++ b/src/libcore/num/flt2dec/mod.rs @@ -126,6 +126,8 @@ // while this is extensively documented, this is in principle private which is // only made public for testing. do not expose us. #![doc(hidden)] +#![unstable(feature = "flt2dec", + reason = "internal routines only exposed for testing")] use prelude::*; use i16; diff --git a/src/libcore/num/int_macros.rs b/src/libcore/num/int_macros.rs index 3113521e0af..efc91238809 100644 --- a/src/libcore/num/int_macros.rs +++ b/src/libcore/num/int_macros.rs @@ -14,11 +14,13 @@ 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(feature = "core")] +#[unstable(feature = "num_bits_bytes", + reason = "may want to be an associated function")] pub const BITS : usize = $bits; // FIXME(#11621): Should be deprecated once CTFE is implemented in favour of // calling the `mem::size_of` function. -#[unstable(feature = "core")] +#[unstable(feature = "num_bits_bytes", + reason = "may want to be an associated function")] pub const BYTES : usize = ($bits / 8); // FIXME(#11621): Should be deprecated once CTFE is implemented in favour of diff --git a/src/libcore/num/mod.rs b/src/libcore/num/mod.rs index bf26022692d..c8a0ae47637 100644 --- a/src/libcore/num/mod.rs +++ b/src/libcore/num/mod.rs @@ -41,10 +41,7 @@ #[derive(PartialEq, Eq, PartialOrd, Ord, Clone, Copy, Debug)] pub struct Wrapping(#[stable(feature = "rust1", since = "1.0.0")] pub T); -#[unstable(feature = "core", reason = "may be removed or relocated")] pub mod wrapping; - -#[unstable(feature = "core", reason = "internal routines only exposed for testing")] pub mod flt2dec; /// Types that have a "zero" value. @@ -471,7 +468,7 @@ pub fn wrapping_mul(self, rhs: Self) -> Self { /// to `-MIN`, a positive value that is too large to represent /// in the type. In such a case, this function returns `MIN` /// itself.. - #[unstable(feature = "core", since = "1.0.0")] + #[unstable(feature = "num_wrapping")] #[inline(always)] pub fn wrapping_div(self, rhs: Self) -> Self { self.overflowing_div(rhs).0 @@ -484,7 +481,7 @@ pub fn wrapping_div(self, rhs: Self) -> Self { /// implementation artifacts make `x % y` illegal for `MIN / /// -1` on a signed type illegal (where `MIN` is the negative /// minimal value). In such a case, this function returns `0`. - #[unstable(feature = "core", since = "1.0.0")] + #[unstable(feature = "num_wrapping")] #[inline(always)] pub fn wrapping_rem(self, rhs: Self) -> Self { self.overflowing_rem(rhs).0 @@ -498,7 +495,7 @@ pub fn wrapping_rem(self, rhs: Self) -> Self { /// negative minimal value for the type); this is a positive /// value that is too large to represent in the type. In such /// a case, this function returns `MIN` itself. - #[unstable(feature = "core", since = "1.0.0")] + #[unstable(feature = "num_wrapping")] #[inline(always)] pub fn wrapping_neg(self) -> Self { self.overflowing_neg().0 @@ -507,7 +504,7 @@ pub fn wrapping_neg(self) -> Self { /// Panic-free bitwise shift-left; yields `self << mask(rhs)`, /// where `mask` removes any high-order bits of `rhs` that /// would cause the shift to exceed the bitwidth of the type. - #[unstable(feature = "core", since = "1.0.0")] + #[unstable(feature = "num_wrapping")] #[inline(always)] pub fn wrapping_shl(self, rhs: u32) -> Self { self.overflowing_shl(rhs).0 @@ -516,7 +513,7 @@ pub fn wrapping_shl(self, rhs: u32) -> Self { /// Panic-free bitwise shift-left; yields `self >> mask(rhs)`, /// where `mask` removes any high-order bits of `rhs` that /// would cause the shift to exceed the bitwidth of the type. - #[unstable(feature = "core", since = "1.0.0")] + #[unstable(feature = "num_wrapping")] #[inline(always)] pub fn wrapping_shr(self, rhs: u32) -> Self { self.overflowing_shr(rhs).0 @@ -1041,7 +1038,7 @@ pub fn wrapping_mul(self, rhs: Self) -> Self { /// to `-MIN`, a positive value that is too large to represent /// in the type. In such a case, this function returns `MIN` /// itself.. - #[unstable(feature = "core", since = "1.0.0")] + #[unstable(feature = "num_wrapping")] #[inline(always)] pub fn wrapping_div(self, rhs: Self) -> Self { self.overflowing_div(rhs).0 @@ -1054,7 +1051,7 @@ pub fn wrapping_div(self, rhs: Self) -> Self { /// implementation artifacts make `x % y` illegal for `MIN / /// -1` on a signed type illegal (where `MIN` is the negative /// minimal value). In such a case, this function returns `0`. - #[unstable(feature = "core", since = "1.0.0")] + #[unstable(feature = "num_wrapping")] #[inline(always)] pub fn wrapping_rem(self, rhs: Self) -> Self { self.overflowing_rem(rhs).0 @@ -1068,7 +1065,7 @@ pub fn wrapping_rem(self, rhs: Self) -> Self { /// negative minimal value for the type); this is a positive /// value that is too large to represent in the type. In such /// a case, this function returns `MIN` itself. - #[unstable(feature = "core", since = "1.0.0")] + #[unstable(feature = "num_wrapping")] #[inline(always)] pub fn wrapping_neg(self) -> Self { self.overflowing_neg().0 @@ -1077,7 +1074,7 @@ pub fn wrapping_neg(self) -> Self { /// Panic-free bitwise shift-left; yields `self << mask(rhs)`, /// where `mask` removes any high-order bits of `rhs` that /// would cause the shift to exceed the bitwidth of the type. - #[unstable(feature = "core", since = "1.0.0")] + #[unstable(feature = "num_wrapping")] #[inline(always)] pub fn wrapping_shl(self, rhs: u32) -> Self { self.overflowing_shl(rhs).0 @@ -1086,7 +1083,7 @@ pub fn wrapping_shl(self, rhs: u32) -> Self { /// Panic-free bitwise shift-left; yields `self >> mask(rhs)`, /// where `mask` removes any high-order bits of `rhs` that /// would cause the shift to exceed the bitwidth of the type. - #[unstable(feature = "core", since = "1.0.0")] + #[unstable(feature = "num_wrapping")] #[inline(always)] pub fn wrapping_shr(self, rhs: u32) -> Self { self.overflowing_shr(rhs).0 @@ -1262,6 +1259,8 @@ pub enum FpCategory { /// A built-in floating point number. #[doc(hidden)] +#[unstable(feature = "core_float", + reason = "stable interface is via `impl f{32,64}` in later crates")] pub trait Float { /// Returns the NaN value. fn nan() -> Self; @@ -1512,7 +1511,9 @@ enum IntErrorKind { } impl ParseIntError { - #[unstable(feature = "core", reason = "available through Error trait")] + #[unstable(feature = "int_error_internals", + reason = "available through Error trait and this method should \ + not be exposed publicly")] pub fn description(&self) -> &str { match self.kind { IntErrorKind::Empty => "cannot parse integer from empty string", @@ -1535,10 +1536,14 @@ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { #[stable(feature = "rust1", since = "1.0.0")] pub struct ParseFloatError { #[doc(hidden)] + #[unstable(feature = "float_error_internals", + reason = "should not be exposed publicly")] pub __kind: FloatErrorKind } #[derive(Debug, Clone, PartialEq)] +#[unstable(feature = "float_error_internals", + reason = "should not be exposed publicly")] pub enum FloatErrorKind { Empty, Invalid, diff --git a/src/libcore/num/uint_macros.rs b/src/libcore/num/uint_macros.rs index 86782950745..0719d7c17cc 100644 --- a/src/libcore/num/uint_macros.rs +++ b/src/libcore/num/uint_macros.rs @@ -12,9 +12,11 @@ macro_rules! uint_module { ($T:ty, $T_SIGNED:ty, $bits:expr) => ( -#[unstable(feature = "core")] +#[unstable(feature = "num_bits_bytes", + reason = "may want to be an associated function")] pub const BITS : usize = $bits; -#[unstable(feature = "core")] +#[unstable(feature = "num_bits_bytes", + reason = "may want to be an associated function")] pub const BYTES : usize = ($bits / 8); #[stable(feature = "rust1", since = "1.0.0")] diff --git a/src/libcore/num/wrapping.rs b/src/libcore/num/wrapping.rs index 69c22229490..748ed29e3a3 100644 --- a/src/libcore/num/wrapping.rs +++ b/src/libcore/num/wrapping.rs @@ -10,6 +10,7 @@ #![allow(missing_docs)] #![allow(deprecated)] +#![unstable(feature = "wrapping", reason = "may be removed or relocated")] use super::Wrapping; @@ -30,7 +31,6 @@ use ::{i8,i16,i32,i64}; -#[unstable(feature = "core", reason = "may be removed, renamed, or relocated")] pub trait OverflowingOps { fn overflowing_add(self, rhs: Self) -> (Self, bool); fn overflowing_sub(self, rhs: Self) -> (Self, bool); diff --git a/src/libcore/ops.rs b/src/libcore/ops.rs index c52f4de732f..48b1cbeef4f 100644 --- a/src/libcore/ops.rs +++ b/src/libcore/ops.rs @@ -29,8 +29,8 @@ //! //! # Examples //! -//! This example creates a `Point` struct that implements `Add` and `Sub`, and then -//! demonstrates adding and subtracting two `Point`s. +//! This example creates a `Point` struct that implements `Add` and `Sub`, and +//! then demonstrates adding and subtracting two `Point`s. //! //! ```rust //! use std::ops::{Add, Sub}; @@ -62,21 +62,21 @@ //! } //! ``` //! -//! See the documentation for each trait for a minimum implementation that prints -//! something to the screen. +//! See the documentation for each trait for a minimum implementation that +//! prints something to the screen. #![stable(feature = "rust1", since = "1.0.0")] use marker::{Sized, Unsize}; use fmt; -/// The `Drop` trait is used to run some code when a value goes out of scope. This -/// is sometimes called a 'destructor'. +/// The `Drop` trait is used to run some code when a value goes out of scope. +/// This is sometimes called a 'destructor'. /// /// # Examples /// -/// A trivial implementation of `Drop`. The `drop` method is called when `_x` goes -/// out of scope, and therefore `main` prints `Dropping!`. +/// A trivial implementation of `Drop`. The `drop` method is called when `_x` +/// goes out of scope, and therefore `main` prints `Dropping!`. /// /// ``` /// struct HasDrop; @@ -103,8 +103,7 @@ 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(feature = "core", - reason = "recently added, waiting for dust to settle")] + #[stable(feature = "rust1", since = "1.0.0")] impl<'a> $imp for &'a $t { type Output = <$t as $imp>::Output; @@ -120,8 +119,7 @@ fn $method(self) -> <$t as $imp>::Output { // 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(feature = "core", - reason = "recently added, waiting for dust to settle")] + #[stable(feature = "rust1", since = "1.0.0")] impl<'a> $imp<$u> for &'a $t { type Output = <$t as $imp<$u>>::Output; @@ -131,8 +129,7 @@ fn $method(self, other: $u) -> <$t as $imp<$u>>::Output { } } - #[unstable(feature = "core", - reason = "recently added, waiting for dust to settle")] + #[stable(feature = "rust1", since = "1.0.0")] impl<'a> $imp<&'a $u> for $t { type Output = <$t as $imp<$u>>::Output; @@ -142,8 +139,7 @@ fn $method(self, other: &'a $u) -> <$t as $imp<$u>>::Output { } } - #[unstable(feature = "core", - reason = "recently added, waiting for dust to settle")] + #[stable(feature = "rust1", since = "1.0.0")] impl<'a, 'b> $imp<&'a $u> for &'b $t { type Output = <$t as $imp<$u>>::Output; @@ -1210,7 +1206,7 @@ extern "rust-call" fn call_once(mut self, args: A) -> F::Output { /// Trait that indicates that this is a pointer or a wrapper for one, /// where unsizing can be performed on the pointee. -#[unstable(feature = "core")] +#[unstable(feature = "coerce_unsized")] #[lang="coerce_unsized"] pub trait CoerceUnsized { // Empty. diff --git a/src/libcore/option.rs b/src/libcore/option.rs index 593c5e79d34..9a00d107147 100644 --- a/src/libcore/option.rs +++ b/src/libcore/option.rs @@ -285,7 +285,7 @@ pub fn as_mut<'r>(&'r mut self) -> Option<&'r mut T> { /// assert_eq!(x, Some("Dirt")); /// ``` #[inline] - #[unstable(feature = "core", + #[unstable(feature = "as_slice", reason = "waiting for mut conventions")] pub fn as_mut_slice<'r>(&'r mut self) -> &'r mut [T] { match *self { diff --git a/src/libcore/panicking.rs b/src/libcore/panicking.rs index 635150c0886..8133db097df 100644 --- a/src/libcore/panicking.rs +++ b/src/libcore/panicking.rs @@ -29,6 +29,9 @@ //! library, but the location of this may change over time. #![allow(dead_code, missing_docs)] +#![unstable(feature = "core_panic", + reason = "internal details of the implementation of the `panic!` \ + and related macros")] use fmt; diff --git a/src/libcore/prelude.rs b/src/libcore/prelude.rs index a4d529ad47d..ac153d64ab2 100644 --- a/src/libcore/prelude.rs +++ b/src/libcore/prelude.rs @@ -24,6 +24,10 @@ //! use core::prelude::*; //! ``` +#![unstable(feature = "core_prelude", + reason = "the libcore prelude has not been scrutinized and \ + stabilized yet")] + // Reexported core operators pub use marker::{Copy, Send, Sized, Sync}; pub use ops::{Drop, Fn, FnMut, FnOnce}; @@ -32,7 +36,6 @@ pub use mem::drop; // Reexported types and traits - pub use char::CharExt; pub use clone::Clone; pub use cmp::{PartialEq, PartialOrd, Eq, Ord}; diff --git a/src/libcore/ptr.rs b/src/libcore/ptr.rs index 9ca9b4fc46c..0f1831e8314 100644 --- a/src/libcore/ptr.rs +++ b/src/libcore/ptr.rs @@ -204,7 +204,7 @@ pub unsafe fn read(src: *const T) -> T { /// /// This is unsafe for the same reasons that `read` is unsafe. #[inline(always)] -#[unstable(feature = "core", +#[unstable(feature = "read_and_zero", reason = "may play a larger role in std::ptr future extensions")] pub unsafe fn read_and_zero(dest: *mut T) -> T { // Copy the data out from `dest`: @@ -219,7 +219,7 @@ pub unsafe fn read_and_zero(dest: *mut T) -> T { /// Variant of read_and_zero that writes the specific drop-flag byte /// (which may be more appropriate than zero). #[inline(always)] -#[unstable(feature = "core", +#[unstable(feature = "filling_drop", reason = "may play a larger role in std::ptr future extensions")] pub unsafe fn read_and_drop(dest: *mut T) -> T { // Copy the data out from `dest`: @@ -267,9 +267,10 @@ pub fn is_null(self) -> bool where T: 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(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")] + #[unstable(feature = "ptr_as_ref", + 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")] #[inline] pub unsafe fn as_ref<'a>(&self) -> Option<&'a T> where T: Sized { if self.is_null() { @@ -314,9 +315,10 @@ pub fn is_null(self) -> bool where T: 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(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")] + #[unstable(feature = "ptr_as_ref", + 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")] #[inline] pub unsafe fn as_ref<'a>(&self) -> Option<&'a T> where T: Sized { if self.is_null() { @@ -347,7 +349,7 @@ pub unsafe fn offset(self, count: isize) -> *mut T where T: Sized { /// /// As with `as_ref`, this is unsafe because it cannot verify the validity /// of the returned pointer. - #[unstable(feature = "core", + #[unstable(feature = "ptr_as_ref", reason = "return value does not necessarily convey all possible \ information")] #[inline] @@ -507,7 +509,7 @@ fn ge(&self, other: &*mut T) -> bool { *self >= *other } /// modified without a unique path to the `Unique` reference. Useful /// for building abstractions like `Vec` or `Box`, which /// internally use raw pointers to manage the memory that they own. -#[unstable(feature = "unique")] +#[unstable(feature = "unique", reason = "needs an RFC to flesh out design")] pub struct Unique { pointer: NonZero<*const T>, _marker: PhantomData, @@ -527,21 +529,19 @@ unsafe impl Send for Unique { } #[unstable(feature = "unique")] unsafe impl Sync for Unique { } +#[unstable(feature = "unique")] impl Unique { /// Creates a new `Unique`. - #[unstable(feature = "unique")] pub unsafe fn new(ptr: *mut T) -> Unique { Unique { pointer: NonZero::new(ptr), _marker: PhantomData } } /// Dereferences the content. - #[unstable(feature = "unique")] pub unsafe fn get(&self) -> &T { &**self.pointer } /// Mutably dereferences the content. - #[unstable(feature = "unique")] pub unsafe fn get_mut(&mut self) -> &mut T { &mut ***self } diff --git a/src/libcore/raw.rs b/src/libcore/raw.rs index ec84ef7986a..85e1318d7a1 100644 --- a/src/libcore/raw.rs +++ b/src/libcore/raw.rs @@ -9,7 +9,7 @@ // except according to those terms. #![allow(missing_docs)] -#![unstable(feature = "core")] +#![unstable(feature = "raw")] //! Contains struct definitions for the layout of compiler built-in types. //! diff --git a/src/libcore/result.rs b/src/libcore/result.rs index 772831b1a58..998657a236d 100644 --- a/src/libcore/result.rs +++ b/src/libcore/result.rs @@ -434,7 +434,7 @@ pub fn as_slice(&self) -> &[T] { /// assert!(x.as_mut_slice().is_empty()); /// ``` #[inline] - #[unstable(feature = "core", + #[unstable(feature = "as_slice", reason = "waiting for mut conventions")] pub fn as_mut_slice(&mut self) -> &mut [T] { match *self { @@ -966,7 +966,8 @@ fn next(&mut self) -> Option { /// If an `Err` is encountered, it is immediately returned. /// Otherwise, the folded value is returned. #[inline] -#[unstable(feature = "core")] +#[unstable(feature = "result_fold", + reason = "unclear if this function should exist")] pub fn fold SliceExt for [T] { type Item = T; @@ -256,7 +257,6 @@ fn as_ptr(&self) -> *const T { self.repr().data } - #[unstable(feature = "core")] fn binary_search_by(&self, mut f: F) -> Result where F: FnMut(&T) -> Ordering { @@ -437,12 +437,10 @@ fn ends_with(&self, needle: &[T]) -> bool where T: PartialEq { m >= n && needle == &self[m-n..] } - #[unstable(feature = "core")] fn binary_search(&self, x: &T) -> Result where T: Ord { self.binary_search_by(|p| p.cmp(x)) } - #[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; } @@ -473,7 +471,6 @@ fn next_permutation(&mut self) -> bool where T: Ord { true } - #[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; } @@ -774,7 +771,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(feature = "core")] + #[unstable(feature = "iter_to_slice")] pub fn as_slice(&self) -> &'a [T] { make_slice!(self.ptr, self.end) } @@ -804,7 +801,7 @@ impl<'a, T> Clone for Iter<'a, T> { fn clone(&self) -> Iter<'a, T> { Iter { ptr: self.ptr, end: self.end, _marker: self._marker } } } -#[unstable(feature = "core", reason = "trait is experimental")] +#[unstable(feature = "iter_idx", reason = "trait is experimental")] impl<'a, T> RandomAccessIterator for Iter<'a, T> { #[inline] fn indexable(&self) -> usize { @@ -842,7 +839,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(feature = "core")] + #[unstable(feature = "iter_to_slice")] pub fn into_slice(self) -> &'a mut [T] { make_mut_slice!(self.ptr, self.end) } @@ -1176,7 +1173,7 @@ fn next_back(&mut self) -> Option<&'a [T]> { #[stable(feature = "rust1", since = "1.0.0")] impl<'a, T> ExactSizeIterator for Windows<'a, T> {} -#[unstable(feature = "core", reason = "trait is experimental")] +#[unstable(feature = "iter_idx", reason = "trait is experimental")] impl<'a, T> RandomAccessIterator for Windows<'a, T> { #[inline] fn indexable(&self) -> usize { @@ -1263,7 +1260,7 @@ fn next_back(&mut self) -> Option<&'a [T]> { #[stable(feature = "rust1", since = "1.0.0")] impl<'a, T> ExactSizeIterator for Chunks<'a, T> {} -#[unstable(feature = "core", reason = "trait is experimental")] +#[unstable(feature = "iter_idx", reason = "trait is experimental")] impl<'a, T> RandomAccessIterator for Chunks<'a, T> { #[inline] fn indexable(&self) -> usize { @@ -1349,7 +1346,7 @@ impl<'a, T> ExactSizeIterator for ChunksMut<'a, T> {} // /// Converts a pointer to A into a slice of length 1 (without copying). -#[unstable(feature = "core")] +#[unstable(feature = "ref_slice")] pub fn ref_slice<'a, A>(s: &'a A) -> &'a [A] { unsafe { from_raw_parts(s, 1) @@ -1357,7 +1354,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(feature = "core")] +#[unstable(feature = "ref_slice")] pub fn mut_ref_slice<'a, A>(s: &'a mut A) -> &'a mut [A] { unsafe { from_raw_parts_mut(s, 1) @@ -1415,7 +1412,7 @@ pub unsafe fn from_raw_parts_mut<'a, T>(p: *mut T, len: usize) -> &'a mut [T] { // /// Operations on `[u8]`. -#[unstable(feature = "core", reason = "needs review")] +#[unstable(feature = "slice_bytes", reason = "needs review")] pub mod bytes { use ptr; use slice::SliceExt; @@ -1503,7 +1500,7 @@ fn gt(&self, other: &[T]) -> bool { } /// Extension methods for slices containing integers. -#[unstable(feature = "core")] +#[unstable(feature = "int_slice")] pub trait IntSliceExt { /// Converts the slice to an immutable slice of unsigned integers with the same width. fn as_unsigned<'a>(&'a self) -> &'a [U]; @@ -1518,7 +1515,7 @@ pub trait IntSliceExt { macro_rules! impl_int_slice { ($u:ty, $s:ty, $t:ty) => { - #[unstable(feature = "core")] + #[unstable(feature = "int_slice")] 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 ef8b371f061..13c6ad36725 100644 --- a/src/libcore/str/mod.rs +++ b/src/libcore/str/mod.rs @@ -13,6 +13,7 @@ //! For more details, see std::str #![doc(primitive = "str")] +#![stable(feature = "rust1", since = "1.0.0")] use self::OldSearcher::{TwoWay, TwoWayLong}; use self::pattern::Pattern; @@ -191,7 +192,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(feature = "core")] +#[unstable(feature = "str_internals")] #[inline] pub fn next_code_point(bytes: &mut slice::Iter) -> Option { // Decode UTF-8 @@ -226,7 +227,7 @@ pub fn next_code_point(bytes: &mut slice::Iter) -> Option { /// Reads the last code point out of a byte iterator (assuming a /// UTF-8-like encoding). -#[unstable(feature = "core")] +#[unstable(feature = "str_internals")] #[inline] pub fn next_code_point_reverse(bytes: &mut slice::Iter) -> Option { // Decode UTF-8 @@ -738,7 +739,7 @@ fn next_back(&mut self) -> Option<(usize, usize)> #[doc="Created with the method `.rmatch_indices()`."] struct RMatchIndices; stability: - #[unstable(feature = "core", + #[unstable(feature = "str_internals", reason = "type may be removed or have its iterator impl changed")] internal: MatchIndicesInternal yielding ((usize, usize)); @@ -779,7 +780,7 @@ fn next_back(&mut self) -> Option<&'a str> #[doc="Created with the method `.rmatches()`."] struct RMatches; stability: - #[unstable(feature = "core", reason = "type got recently added")] + #[unstable(feature = "str_internals", reason = "type got recently added")] internal: MatchesInternal yielding (&'a str); delegate double ended; @@ -1470,6 +1471,8 @@ fn index(&self, _index: ops::RangeFull) -> &str { /// Methods for string slices #[allow(missing_docs)] #[doc(hidden)] +#[unstable(feature = "core_str_ext", + reason = "stable interface provided by `impl str` in later crates")] pub trait StrExt { // NB there are no docs here are they're all located on the StrExt trait in // libcollections, not here. @@ -1870,7 +1873,7 @@ fn as_ref(&self) -> &[u8] { /// Pluck a code point out of a UTF-8-like byte slice and return the /// index of the next code point. #[inline] -#[unstable(feature = "core")] +#[unstable(feature = "str_internals")] pub fn char_range_at_raw(bytes: &[u8], i: usize) -> (u32, usize) { if bytes[i] < 128 { return (bytes[i] as u32, i + 1); diff --git a/src/libcore/str/pattern.rs b/src/libcore/str/pattern.rs index 9a96612195c..8bdbab55211 100644 --- a/src/libcore/str/pattern.rs +++ b/src/libcore/str/pattern.rs @@ -13,6 +13,9 @@ //! For more details, see the traits `Pattern`, `Searcher`, //! `ReverseSearcher` and `DoubleEndedSearcher`. +#![unstable(feature = "pattern", + reason = "API not fully fleshed out and ready to be stabilized")] + use prelude::*; // Pattern diff --git a/src/libcore/ty.rs b/src/libcore/ty.rs deleted file mode 100644 index 35c1cb09281..00000000000 --- a/src/libcore/ty.rs +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -//! Types dealing with unsafe actions. - -use marker; diff --git a/src/liblog/lib.rs b/src/liblog/lib.rs index 15767024ba8..0760ccb723b 100644 --- a/src/liblog/lib.rs +++ b/src/liblog/lib.rs @@ -172,8 +172,7 @@ #![feature(alloc)] #![feature(staged_api)] #![feature(box_syntax)] -#![feature(core)] -#![feature(const_fn)] +#![feature(iter_cmp)] #![feature(std_misc)] use std::boxed; diff --git a/src/librand/lib.rs b/src/librand/lib.rs index 7ade4ef1c46..6a6adb0db6b 100644 --- a/src/librand/lib.rs +++ b/src/librand/lib.rs @@ -29,7 +29,11 @@ #![unstable(feature = "rand", reason = "use `rand` from crates.io")] #![feature(core)] +#![feature(core_float)] +#![feature(core_prelude)] +#![feature(core_slice_ext)] #![feature(no_std)] +#![feature(num_bits_bytes)] #![feature(staged_api)] #![feature(step_by)] diff --git a/src/librbml/lib.rs b/src/librbml/lib.rs index 41ae0f2d5e2..18b1d39ea82 100644 --- a/src/librbml/lib.rs +++ b/src/librbml/lib.rs @@ -123,9 +123,9 @@ html_root_url = "http://doc.rust-lang.org/nightly/", html_playground_url = "http://play.rust-lang.org/")] -#![feature(core)] #![feature(rustc_private)] #![feature(staged_api)] +#![feature(slice_bytes)] #![cfg_attr(test, feature(test))] diff --git a/src/librustc/lib.rs b/src/librustc/lib.rs index 8b46e2fe2e9..944af19a443 100644 --- a/src/librustc/lib.rs +++ b/src/librustc/lib.rs @@ -30,21 +30,26 @@ #![feature(box_syntax)] #![feature(collections)] #![feature(const_fn)] -#![feature(core)] #![feature(duration)] #![feature(duration_span)] #![feature(fs_canonicalize)] -#![feature(hash)] +#![feature(hash_default)] #![feature(into_cow)] +#![feature(iter_sum)] #![feature(libc)] +#![feature(num_bits_bytes)] #![feature(path_ext)] #![feature(quote)] +#![feature(range_inclusive)] +#![feature(ref_slice)] #![feature(rustc_diagnostic_macros)] #![feature(rustc_private)] +#![feature(slice_bytes)] #![feature(slice_patterns)] #![feature(staged_api)] #![feature(std_misc)] #![feature(str_char)] +#![feature(wrapping)] #![cfg_attr(test, feature(test))] #![allow(trivial_casts)] diff --git a/src/librustc_back/lib.rs b/src/librustc_back/lib.rs index 7d46cc84fd6..e4d0c9aa15f 100644 --- a/src/librustc_back/lib.rs +++ b/src/librustc_back/lib.rs @@ -34,14 +34,14 @@ #![feature(box_syntax)] #![feature(collections)] -#![feature(core)] +#![feature(fs_canonicalize)] +#![feature(libc)] +#![feature(path_ext)] +#![feature(rand)] #![feature(rustc_private)] +#![feature(slice_bytes)] #![feature(staged_api)] -#![feature(rand)] -#![feature(path_ext)] #![feature(step_by)] -#![feature(libc)] -#![feature(fs_canonicalize)] #![cfg_attr(test, feature(test, rand))] extern crate syntax; diff --git a/src/librustc_lint/lib.rs b/src/librustc_lint/lib.rs index 1737de827e3..88d30761020 100644 --- a/src/librustc_lint/lib.rs +++ b/src/librustc_lint/lib.rs @@ -32,9 +32,10 @@ #![feature(box_patterns)] #![feature(box_syntax)] -#![cfg_attr(stage0, feature(collections))] -#![feature(core)] +#![feature(collections)] +#![feature(num_bits_bytes)] #![feature(quote)] +#![feature(ref_slice)] #![feature(rustc_diagnostic_macros)] #![feature(rustc_private)] #![feature(staged_api)] diff --git a/src/librustc_trans/lib.rs b/src/librustc_trans/lib.rs index 9f25c8d5fee..6173e3c8205 100644 --- a/src/librustc_trans/lib.rs +++ b/src/librustc_trans/lib.rs @@ -29,17 +29,23 @@ #![feature(box_patterns)] #![feature(box_syntax)] #![feature(collections)] -#![feature(core)] #![feature(const_fn)] +#![feature(fs)] +#![feature(iter_cmp)] +#![feature(iter_sum)] +#![feature(iter_unfold)] #![feature(libc)] +#![feature(path_ext)] +#![feature(path_ext)] +#![feature(path_relative_from)] +#![feature(path_relative_from)] #![feature(quote)] #![feature(rustc_diagnostic_macros)] #![feature(rustc_private)] #![feature(staged_api)] -#![feature(unicode)] -#![feature(path_ext)] -#![feature(path_relative_from)] #![feature(std_misc)] +#![feature(unicode)] +#![feature(unicode)] #![allow(trivial_casts)] diff --git a/src/librustc_typeck/lib.rs b/src/librustc_typeck/lib.rs index 67101a69b57..f5a7ec4dbd2 100644 --- a/src/librustc_typeck/lib.rs +++ b/src/librustc_typeck/lib.rs @@ -78,8 +78,10 @@ #![feature(box_patterns)] #![feature(box_syntax)] #![feature(collections, collections_drain)] -#![feature(core)] +#![feature(iter_cmp)] +#![feature(iter_sum)] #![feature(quote)] +#![feature(ref_slice)] #![feature(rustc_diagnostic_macros)] #![feature(rustc_private)] #![feature(staged_api)] diff --git a/src/librustc_unicode/lib.rs b/src/librustc_unicode/lib.rs index a9456cb487c..750df19047d 100644 --- a/src/librustc_unicode/lib.rs +++ b/src/librustc_unicode/lib.rs @@ -24,18 +24,24 @@ #![cfg_attr(stage0, feature(custom_attribute))] #![crate_name = "rustc_unicode"] #![unstable(feature = "unicode")] -#![feature(lang_items)] -#![feature(staged_api)] #![staged_api] #![crate_type = "rlib"] #![doc(html_logo_url = "http://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png", html_favicon_url = "https://doc.rust-lang.org/favicon.ico", html_root_url = "http://doc.rust-lang.org/nightly/", - html_playground_url = "http://play.rust-lang.org/")] -#![feature(no_std)] + html_playground_url = "http://play.rust-lang.org/", + test(no_crate_inject))] #![no_std] + #![feature(core)] -#![doc(test(no_crate_inject))] +#![feature(core_char_ext)] +#![feature(core_prelude)] +#![feature(core_slice_ext)] +#![feature(core_str_ext)] +#![feature(iter_sum)] +#![feature(lang_items)] +#![feature(no_std)] +#![feature(staged_api)] extern crate core; diff --git a/src/libserialize/lib.rs b/src/libserialize/lib.rs index 31790ce6290..8170dd95730 100644 --- a/src/libserialize/lib.rs +++ b/src/libserialize/lib.rs @@ -29,12 +29,13 @@ #![feature(box_syntax)] #![feature(collections)] -#![feature(core)] +#![feature(num_bits_bytes)] +#![feature(num_wrapping)] #![feature(rustc_private)] #![feature(staged_api)] #![feature(std_misc)] -#![feature(unicode)] #![feature(str_char)] +#![feature(unicode)] #![cfg_attr(test, feature(test))] // test harness access diff --git a/src/libstd/error.rs b/src/libstd/error.rs index 328c75b6d9e..1677f95ca90 100644 --- a/src/libstd/error.rs +++ b/src/libstd/error.rs @@ -77,7 +77,7 @@ fn cause(&self) -> Option<&Error> { None } /// Get the `TypeId` of `self` #[doc(hidden)] - #[unstable(feature = "core", + #[unstable(feature = "error_type_id", reason = "unclear whether to commit to this public implementation detail")] fn type_id(&self) -> TypeId where Self: 'static { TypeId::of::() diff --git a/src/libstd/lib.rs b/src/libstd/lib.rs index 8305088057c..8f7ed6388f5 100644 --- a/src/libstd/lib.rs +++ b/src/libstd/lib.rs @@ -99,38 +99,52 @@ #![doc(html_logo_url = "http://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png", html_favicon_url = "https://doc.rust-lang.org/favicon.ico", html_root_url = "http://doc.rust-lang.org/nightly/", - html_playground_url = "http://play.rust-lang.org/")] -#![doc(test(no_crate_inject, attr(deny(warnings))))] -#![doc(test(attr(allow(dead_code, deprecated, unused_variables, unused_mut))))] + html_playground_url = "http://play.rust-lang.org/", + test(no_crate_inject, attr(deny(warnings))), + test(attr(allow(dead_code, deprecated, unused_variables, unused_mut))))] #![feature(alloc)] #![feature(allow_internal_unstable)] #![feature(associated_consts)] +#![feature(borrow_state)] #![feature(box_syntax)] +#![feature(char_internals)] #![feature(collections)] -#![feature(core)] #![feature(const_fn)] +#![feature(core)] +#![feature(core_float)] +#![feature(core_intrinsics)] +#![feature(core_prelude)] +#![feature(core_simd)] +#![feature(fnbox)] +#![feature(int_error_internals)] #![feature(into_cow)] +#![feature(iter_order)] #![feature(lang_items)] #![feature(libc)] #![feature(linkage, thread_local, asm)] #![feature(macro_reexport)] +#![feature(no_std)] +#![feature(num_bits_bytes)] #![feature(optin_builtin_traits)] #![feature(rand)] +#![feature(raw)] +#![feature(reflect_marker)] +#![feature(slice_bytes)] #![feature(slice_patterns)] #![feature(staged_api)] -#![feature(std_misc)] #![feature(str_char)] +#![feature(str_internals)] #![feature(unboxed_closures)] #![feature(unicode)] #![feature(unique)] #![feature(unsafe_no_drop_flag, filling_drop)] +#![feature(wrapping)] #![feature(zero_one)] #![cfg_attr(test, feature(float_from_str_radix))] #![cfg_attr(test, feature(test, rustc_private, std_misc))] // Don't link to std. We are std. -#![feature(no_std)] #![no_std] #![allow(trivial_casts)] diff --git a/src/libsyntax/lib.rs b/src/libsyntax/lib.rs index 11c4b0f1261..432cdbdfef0 100644 --- a/src/libsyntax/lib.rs +++ b/src/libsyntax/lib.rs @@ -28,8 +28,9 @@ #![feature(associated_consts)] #![feature(collections)] #![feature(collections_drain)] -#![feature(core)] +#![feature(filling_drop)] #![feature(libc)] +#![feature(ref_slice)] #![feature(rustc_private)] #![feature(staged_api)] #![feature(str_char)] -- 2.44.0