From c14d86fd3ff3ba2d01a6e859290b30e74081313b Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Tue, 9 Jun 2015 11:18:03 -0700 Subject: [PATCH 01/31] 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 4ee500faa22c4..91cbd3915d006 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 5541a5f34c41c..91585c3cb6cf7 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 9bd23494da3d9..73641647bf426 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 6c233a31149e7..0c1349bc2e6c8 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 a65394f52682c..f0c77ae866d59 100644 --- a/src/libcore/any.rs +++ b/src/libcore/any.rs @@ -92,7 +92,7 @@ use marker::{Reflect, Sized}; #[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 91301ee558ca5..a9b240de30bef 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 @@ use slice::{Iter, IterMut, SliceExt}; /// /// 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 @@ macro_rules! array_impls { } } - #[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 @@ macro_rules! array_impls { } } - #[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 175dabaf1d2cb..56dfd922dc188 100644 --- a/src/libcore/cell.rs +++ b/src/libcore/cell.rs @@ -229,7 +229,7 @@ impl Cell { /// 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 @@ impl RefCell { /// /// 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 @@ 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::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 @@ impl<'b, T: ?Sized> Ref<'b, T> { } } - /// 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 @@ impl<'b, T: ?Sized> Ref<'b, T> { } 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 @@ impl<'b, T: ?Sized> RefMut<'b, T> { } } - /// 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 @@ impl<'b, T: ?Sized> RefMut<'b, T> { /// 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 df371752b8651..9f5944d3c9c71 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 @@ 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(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 f11c01507dcd8..a13160b3a19ee 100644 --- a/src/libcore/clone.rs +++ b/src/libcore/clone.rs @@ -89,29 +89,28 @@ clone_impl! { char } 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 dab549f784cf8..b12b59760106a 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 self::Ordering::*; 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 f6987c1966493..70868805299f3 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 76a40dc8a528a..cbbb186af7609 100644 --- a/src/libcore/fmt/mod.rs +++ b/src/libcore/fmt/mod.rs @@ -33,7 +33,7 @@ pub use self::builders::{DebugStruct, DebugTuple, DebugSet, DebugList, DebugMap} 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 @@ impl<'a> ArgumentV1<'a> { } #[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 @@ impl<'a> ArgumentV1<'a> { } #[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 @@ impl<'a> Arguments<'a> { /// 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 @@ impl<'a> Formatter<'a> { 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 122fffc595905..6aaec20382ecf 100644 --- a/src/libcore/fmt/num.rs +++ b/src/libcore/fmt/num.rs @@ -127,7 +127,7 @@ radix! { UpperHex, 16, "0x", x @ 0 ... 9 => b'0' + x, /// 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 @@ impl GenericRadix for Radix { } /// 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 @@ pub struct RadixFmt(T, R); /// 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 2afd8abeb31aa..033834dd5aaaa 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 e848a44e01ce0..cbf2828a7dc18 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 @@ pub trait Hasher { /// 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 @@ pub trait Hasher { /// /// 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 774f86563d79c..455928077da46 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 @@ extern "rust-intrinsic" { /// 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 ae2248206c40d..da714671c5723 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 @@ pub trait Iterator { /// 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 @@ pub trait Iterator { /// 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 @@ pub trait Iterator { /// 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 @@ pub trait Iterator { /// 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 @@ pub trait Iterator { /// 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 @@ pub trait Iterator { /// 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 @@ impl<'a, I: DoubleEndedIterator + ?Sized> DoubleEndedIterator for &'a mut I { /// `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 @@ impl RandomAccessIterator for Rev /// `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 @@ impl Iterator for Cycle where I: Clone + Iterator { } } -#[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 @@ impl DoubleEndedIterator for Chain where } } -#[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 @@ impl DoubleEndedIterator for Zip where } } -#[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 @@ impl DoubleEndedIterator for Map where } } -#[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 @@ impl DoubleEndedIterator for Enumerate where } } -#[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 @@ impl Iterator for Skip where I: Iterator { } } -#[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 @@ impl Iterator for Take where I: Iterator{ } } -#[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 @@ impl DoubleEndedIterator for Fuse where I: DoubleEndedIterator { } // 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 @@ impl DoubleEndedIterator for Inspect } } -#[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 @@ impl RandomAccessIterator for Inspect /// 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 @@ impl Iterator for StepBy> where /// 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 @@ impl Iterator for RangeInclusive where } } -#[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 @@ type IterateState = (F, Option, bool); /// 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 9dfaec0095a5a..030d2a33f8f65 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 b5555fa51197c..14bb82dff7d6e 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 7c20722b26d47..dc3b06977d6c6 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 @@ mod impls { /// /// [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 26c6e899df1ce..4e9613454ab97 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 32522794254f6..1b5fa4e0e950b 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 50dd3f1661adf..229414fe76664 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 62b566e7eb40c..bbc1bdacde713 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 f51dcf54a1959..f3a7e8f09a9eb 100644 --- a/src/libcore/num/flt2dec/mod.rs +++ b/src/libcore/num/flt2dec/mod.rs @@ -126,6 +126,8 @@ functions. // 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 3113521e0afff..efc9123880978 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 bf26022692d09..c8a0ae47637d2 100644 --- a/src/libcore/num/mod.rs +++ b/src/libcore/num/mod.rs @@ -41,10 +41,7 @@ use str::{FromStr, StrExt}; #[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 @@ macro_rules! int_impl { /// 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 @@ macro_rules! int_impl { /// 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 @@ macro_rules! int_impl { /// 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 @@ macro_rules! int_impl { /// 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 @@ macro_rules! int_impl { /// 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 @@ macro_rules! uint_impl { /// 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 @@ macro_rules! uint_impl { /// 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 @@ macro_rules! uint_impl { /// 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 @@ macro_rules! uint_impl { /// 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 @@ macro_rules! uint_impl { /// 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 @@ impl fmt::Display for ParseIntError { #[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 8678295074550..0719d7c17cc4e 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 69c2222949032..748ed29e3a306 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 intrinsics::{i64_mul_with_overflow, u64_mul_with_overflow}; 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 c52f4de732ff9..48b1cbeef4fdd 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 @@ 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(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 @@ macro_rules! forward_ref_binop { } } - #[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 @@ macro_rules! forward_ref_binop { } } - #[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 @@ mod impls { /// 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 593c5e79d3425..9a00d1071473f 100644 --- a/src/libcore/option.rs +++ b/src/libcore/option.rs @@ -285,7 +285,7 @@ impl Option { /// 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 635150c088688..8133db097dfcf 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 a4d529ad47d09..ac153d64ab28f 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 ops::{Drop, Fn, FnMut, FnOnce}; 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 9ca9b4fc46c99..0f1831e8314d3 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 @@ impl *const T { /// 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 @@ impl *mut T { /// 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 @@ impl *mut T { /// /// 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 @@ impl PartialOrd for *mut T { /// 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 ec84ef7986a43..85e1318d7a115 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 772831b1a5862..998657a236dec 100644 --- a/src/libcore/result.rs +++ b/src/libcore/result.rs @@ -434,7 +434,7 @@ impl Result { /// 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 @@ impl> FromIterator> for Result { /// 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 @@ impl SliceExt for [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 @@ impl SliceExt for [T] { 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 @@ impl SliceExt for [T] { 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 @@ impl<'a, T> DoubleEndedIterator for Windows<'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 @@ impl<'a, T> DoubleEndedIterator for Chunks<'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 @@ impl PartialOrd for [T] { } /// 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 ef8b371f06179..13c6ad367257d 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 @@ generate_pattern_iterators! { #[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 @@ generate_pattern_iterators! { #[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 @@ mod traits { /// 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 @@ impl AsRef<[u8]> 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(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 9a96612195cf8..8bdbab55211d8 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 35c1cb09281f4..0000000000000 --- 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 15767024ba80f..0760ccb723b19 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 7ade4ef1c4628..6a6adb0db6b45 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 41ae0f2d5e203..18b1d39ea82d8 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 8b46e2fe2e9c1..944af19a44313 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 7d46cc84fd685..e4d0c9aa15f7a 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 1737de827e3ce..88d307610208f 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 9f25c8d5fee14..6173e3c8205c1 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 67101a69b5709..f5a7ec4dbd246 100644 --- a/src/librustc_typeck/lib.rs +++ b/src/librustc_typeck/lib.rs @@ -78,8 +78,10 @@ This API is completely unstable and subject to change. #![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 a9456cb487c6a..750df19047d73 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 31790ce6290fe..8170dd957307b 100644 --- a/src/libserialize/lib.rs +++ b/src/libserialize/lib.rs @@ -29,12 +29,13 @@ Core encoding and decoding interfaces. #![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 328c75b6d9e20..1677f95ca9039 100644 --- a/src/libstd/error.rs +++ b/src/libstd/error.rs @@ -77,7 +77,7 @@ pub trait Error: Debug + Display + Reflect { /// 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 8305088057c41..8f7ed6388f575 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 11c4b0f12610a..432cdbdfef05e 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)] From c44f5399e4dd2f9d55e107d365d6fe98f6491dc9 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Tue, 9 Jun 2015 11:52:41 -0700 Subject: [PATCH 02/31] alloc: Split apart the global `alloc` feature --- src/liballoc/arc.rs | 16 ++++++++-------- src/liballoc/boxed.rs | 6 +++--- src/liballoc/heap.rs | 7 ++++++- src/liballoc/lib.rs | 10 +++++++--- src/liballoc/rc.rs | 20 ++++++++++---------- src/libarena/lib.rs | 3 ++- src/libcollections/lib.rs | 3 +++ src/liblog/lib.rs | 5 +++-- src/librustc_resolve/lib.rs | 2 +- src/librustc_trans/lib.rs | 2 +- src/libstd/lib.rs | 3 +++ src/libtest/lib.rs | 11 ++++++----- 12 files changed, 53 insertions(+), 35 deletions(-) diff --git a/src/liballoc/arc.rs b/src/liballoc/arc.rs index 616071f0df709..e0d459d877fd2 100644 --- a/src/liballoc/arc.rs +++ b/src/liballoc/arc.rs @@ -134,7 +134,7 @@ impl, U: ?Sized> CoerceUnsized> for Arc {} /// Weak pointers will not keep the data inside of the `Arc` alive, and can be /// used to break cycles between `Arc` pointers. #[unsafe_no_drop_flag] -#[unstable(feature = "alloc", +#[unstable(feature = "arc_weak", reason = "Weak pointers may not belong in this module.")] pub struct Weak { // FIXME #12808: strange name to try to avoid interfering with @@ -198,7 +198,7 @@ impl Arc { /// /// let weak_five = five.downgrade(); /// ``` - #[unstable(feature = "alloc", + #[unstable(feature = "arc_weak", reason = "Weak pointers may not belong in this module.")] pub fn downgrade(&self) -> Weak { // See the clone() impl for why this is relaxed @@ -236,12 +236,12 @@ impl Arc { /// Get the number of weak references to this value. #[inline] -#[unstable(feature = "alloc")] +#[unstable(feature = "arc_extras")] pub fn weak_count(this: &Arc) -> usize { this.inner().weak.load(SeqCst) - 1 } /// Get the number of strong references to this value. #[inline] -#[unstable(feature = "alloc")] +#[unstable(feature = "arc_extras")] pub fn strong_count(this: &Arc) -> usize { this.inner().strong.load(SeqCst) } @@ -271,7 +271,7 @@ pub fn strong_count(this: &Arc) -> usize { this.inner().strong.loa /// # } /// ``` #[inline] -#[unstable(feature = "alloc")] +#[unstable(feature = "arc_extras")] pub unsafe fn get_mut(this: &mut Arc) -> Option<&mut T> { // FIXME(#24880) potential race with upgraded weak pointers here if strong_count(this) == 1 && weak_count(this) == 0 { @@ -352,7 +352,7 @@ impl Arc { /// # } /// ``` #[inline] - #[unstable(feature = "alloc")] + #[unstable(feature = "arc_extras")] pub unsafe fn make_unique(&mut self) -> &mut T { // FIXME(#24880) potential race with upgraded weak pointers here // @@ -438,7 +438,7 @@ impl Drop for Arc { } } -#[unstable(feature = "alloc", +#[unstable(feature = "arc_weak", reason = "Weak pointers may not belong in this module.")] impl Weak { /// Upgrades a weak reference to a strong reference. @@ -479,7 +479,7 @@ impl Weak { } } -#[unstable(feature = "alloc", +#[unstable(feature = "arc_weak", reason = "Weak pointers may not belong in this module.")] impl Clone for Weak { /// Makes a clone of the `Weak`. diff --git a/src/liballoc/boxed.rs b/src/liballoc/boxed.rs index 91cbd3915d006..ffc4186dee8d9 100644 --- a/src/liballoc/boxed.rs +++ b/src/liballoc/boxed.rs @@ -81,7 +81,7 @@ use core::raw::{TraitObject}; /// } /// ``` #[lang = "exchange_heap"] -#[unstable(feature = "alloc", +#[unstable(feature = "box_heap", reason = "may be renamed; uncertain about custom allocator design")] pub const HEAP: () = (); @@ -121,7 +121,7 @@ impl Box { /// Function is unsafe, because improper use of this function may /// lead to memory problems like double-free, for example if the /// function is called twice on the same raw pointer. - #[unstable(feature = "alloc", + #[unstable(feature = "box_raw", reason = "may be renamed or moved out of Box scope")] #[inline] pub unsafe fn from_raw(raw: *mut T) -> Self { @@ -146,7 +146,7 @@ impl Box { /// let raw = boxed::into_raw(seventeen); /// let boxed_again = unsafe { Box::from_raw(raw) }; /// ``` -#[unstable(feature = "alloc", +#[unstable(feature = "box_raw", reason = "may be renamed")] #[inline] pub fn into_raw(b: Box) -> *mut T { diff --git a/src/liballoc/heap.rs b/src/liballoc/heap.rs index 1cc63588fddff..14797d7f4b54d 100644 --- a/src/liballoc/heap.rs +++ b/src/liballoc/heap.rs @@ -8,6 +8,12 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +#![unstable(feature = "heap_api", + reason = "the precise API and guarantees it provides may be tweaked \ + slightly, especially to possibly take into account the \ + types being stored to make room for a future \ + tracing garbage collector")] + use core::{isize, usize}; #[inline(always)] @@ -94,7 +100,6 @@ pub fn usable_size(size: usize, align: usize) -> usize { /// /// These statistics may be inconsistent if other threads use the allocator /// during the call. -#[unstable(feature = "alloc")] pub fn stats_print() { imp::stats_print(); } diff --git a/src/liballoc/lib.rs b/src/liballoc/lib.rs index 91585c3cb6cf7..e297d4cbf7762 100644 --- a/src/liballoc/lib.rs +++ b/src/liballoc/lib.rs @@ -59,9 +59,11 @@ // Do not remove on snapshot creation. Needed for bootstrap. (Issue #22364) #![cfg_attr(stage0, feature(custom_attribute))] #![crate_name = "alloc"] -#![unstable(feature = "alloc")] -#![staged_api] #![crate_type = "rlib"] +#![staged_api] +#![unstable(feature = "alloc", + reason = "this library is unlikely to be stabilized in its current \ + form or name")] #![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/", @@ -86,11 +88,11 @@ #![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))] - #[macro_use] extern crate core; @@ -124,6 +126,7 @@ pub mod rc; /// Common out-of-memory routine #[cold] #[inline(never)] +#[unstable(feature = "oom", reason = "not a scrutinized interface")] pub fn oom() -> ! { // FIXME(#14674): This really needs to do something other than just abort // here, but any printing done must be *guaranteed* to not @@ -144,4 +147,5 @@ pub fn oom() -> ! { // to get linked in to libstd successfully (the linker won't // optimize it out). #[doc(hidden)] +#[unstable(feature = "issue_14344_fixme")] pub fn fixme_14344_be_sure_to_link_to_collections() {} diff --git a/src/liballoc/rc.rs b/src/liballoc/rc.rs index 44f4a6a6290c8..04dde7a07f920 100644 --- a/src/liballoc/rc.rs +++ b/src/liballoc/rc.rs @@ -236,7 +236,7 @@ impl Rc { /// /// let weak_five = five.downgrade(); /// ``` - #[unstable(feature = "alloc", + #[unstable(feature = "rc_weak", reason = "Weak pointers may not belong in this module")] pub fn downgrade(&self) -> Weak { self.inc_weak(); @@ -246,12 +246,12 @@ impl Rc { /// Get the number of weak references to this value. #[inline] -#[unstable(feature = "alloc")] +#[unstable(feature = "rc_extras")] pub fn weak_count(this: &Rc) -> usize { this.weak() - 1 } /// Get the number of strong references to this value. #[inline] -#[unstable(feature = "alloc")] +#[unstable(feature = "rc_extras")] pub fn strong_count(this: &Rc) -> usize { this.strong() } /// Returns true if there are no other `Rc` or `Weak` values that share the @@ -269,7 +269,7 @@ pub fn strong_count(this: &Rc) -> usize { this.strong() } /// rc::is_unique(&five); /// ``` #[inline] -#[unstable(feature = "alloc")] +#[unstable(feature = "rc_extras")] pub fn is_unique(rc: &Rc) -> bool { weak_count(rc) == 0 && strong_count(rc) == 1 } @@ -292,7 +292,7 @@ pub fn is_unique(rc: &Rc) -> bool { /// assert_eq!(rc::try_unwrap(x), Err(Rc::new(4))); /// ``` #[inline] -#[unstable(feature = "alloc")] +#[unstable(feature = "rc_extras")] pub fn try_unwrap(rc: Rc) -> Result> { if is_unique(&rc) { unsafe { @@ -327,7 +327,7 @@ pub fn try_unwrap(rc: Rc) -> Result> { /// assert!(rc::get_mut(&mut x).is_none()); /// ``` #[inline] -#[unstable(feature = "alloc")] +#[unstable(feature = "rc_extras")] pub fn get_mut(rc: &mut Rc) -> Option<&mut T> { if is_unique(rc) { let inner = unsafe { &mut **rc._ptr }; @@ -354,7 +354,7 @@ impl Rc { /// let mut_five = five.make_unique(); /// ``` #[inline] - #[unstable(feature = "alloc")] + #[unstable(feature = "rc_extras")] pub fn make_unique(&mut self) -> &mut T { if !is_unique(self) { *self = Rc::new((**self).clone()) @@ -652,7 +652,7 @@ impl fmt::Pointer for Rc { /// /// See the [module level documentation](./index.html) for more. #[unsafe_no_drop_flag] -#[unstable(feature = "alloc", +#[unstable(feature = "rc_weak", reason = "Weak pointers may not belong in this module.")] pub struct Weak { // FIXME #12808: strange names to try to avoid interfering with @@ -663,7 +663,7 @@ pub struct Weak { impl !marker::Send for Weak {} impl !marker::Sync for Weak {} -#[unstable(feature = "alloc", +#[unstable(feature = "rc_weak", reason = "Weak pointers may not belong in this module.")] impl Weak { @@ -741,7 +741,7 @@ impl Drop for Weak { } } -#[unstable(feature = "alloc", +#[unstable(feature = "rc_weak", reason = "Weak pointers may not belong in this module.")] impl Clone for Weak { diff --git a/src/libarena/lib.rs b/src/libarena/lib.rs index 73641647bf426..109ad8a942c84 100644 --- a/src/libarena/lib.rs +++ b/src/libarena/lib.rs @@ -33,10 +33,11 @@ #![feature(alloc)] #![feature(box_syntax)] #![feature(core_intrinsics)] +#![feature(heap_api)] +#![feature(oom)] #![feature(ptr_as_ref)] #![feature(raw)] #![feature(staged_api)] -#![feature(unboxed_closures)] #![cfg_attr(test, feature(test))] extern crate alloc; diff --git a/src/libcollections/lib.rs b/src/libcollections/lib.rs index 0c1349bc2e6c8..ecf5bace3825a 100644 --- a/src/libcollections/lib.rs +++ b/src/libcollections/lib.rs @@ -29,6 +29,7 @@ #![feature(alloc)] #![feature(box_patterns)] +#![feature(box_raw)] #![feature(box_syntax)] #![feature(copy_lifetime)] #![feature(core)] @@ -36,6 +37,7 @@ #![feature(core_prelude)] #![feature(core_slice_ext)] #![feature(core_str_ext)] +#![feature(heap_api)] #![feature(iter_cmp)] #![feature(iter_idx)] #![feature(iter_order)] @@ -43,6 +45,7 @@ #![feature(iter_sum)] #![feature(lang_items)] #![feature(num_bits_bytes)] +#![feature(oom)] #![feature(pattern)] #![feature(ptr_as_ref)] #![feature(raw)] diff --git a/src/liblog/lib.rs b/src/liblog/lib.rs index 0760ccb723b19..0238bf1f4be18 100644 --- a/src/liblog/lib.rs +++ b/src/liblog/lib.rs @@ -169,10 +169,11 @@ html_playground_url = "http://play.rust-lang.org/")] #![deny(missing_docs)] -#![feature(alloc)] -#![feature(staged_api)] +#![feature(box_raw)] #![feature(box_syntax)] +#![feature(const_fn)] #![feature(iter_cmp)] +#![feature(staged_api)] #![feature(std_misc)] use std::boxed; diff --git a/src/librustc_resolve/lib.rs b/src/librustc_resolve/lib.rs index c47922dd95471..0c0fd3f93dcdd 100644 --- a/src/librustc_resolve/lib.rs +++ b/src/librustc_resolve/lib.rs @@ -19,9 +19,9 @@ html_favicon_url = "https://doc.rust-lang.org/favicon.ico", html_root_url = "http://doc.rust-lang.org/nightly/")] -#![feature(alloc)] #![feature(associated_consts)] #![feature(collections)] +#![feature(rc_weak)] #![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 6173e3c8205c1..d0fadd6565c3b 100644 --- a/src/librustc_trans/lib.rs +++ b/src/librustc_trans/lib.rs @@ -25,7 +25,6 @@ html_favicon_url = "https://doc.rust-lang.org/favicon.ico", html_root_url = "http://doc.rust-lang.org/nightly/")] -#![feature(alloc)] #![feature(box_patterns)] #![feature(box_syntax)] #![feature(collections)] @@ -40,6 +39,7 @@ #![feature(path_relative_from)] #![feature(path_relative_from)] #![feature(quote)] +#![feature(rc_weak)] #![feature(rustc_diagnostic_macros)] #![feature(rustc_private)] #![feature(staged_api)] diff --git a/src/libstd/lib.rs b/src/libstd/lib.rs index 8f7ed6388f575..7504488122396 100644 --- a/src/libstd/lib.rs +++ b/src/libstd/lib.rs @@ -107,6 +107,7 @@ #![feature(allow_internal_unstable)] #![feature(associated_consts)] #![feature(borrow_state)] +#![feature(box_raw)] #![feature(box_syntax)] #![feature(char_internals)] #![feature(collections)] @@ -117,6 +118,7 @@ #![feature(core_prelude)] #![feature(core_simd)] #![feature(fnbox)] +#![feature(heap_api)] #![feature(int_error_internals)] #![feature(into_cow)] #![feature(iter_order)] @@ -126,6 +128,7 @@ #![feature(macro_reexport)] #![feature(no_std)] #![feature(num_bits_bytes)] +#![feature(oom)] #![feature(optin_builtin_traits)] #![feature(rand)] #![feature(raw)] diff --git a/src/libtest/lib.rs b/src/libtest/lib.rs index 9850e0a6c2fc9..6ee6f8c2e24bd 100644 --- a/src/libtest/lib.rs +++ b/src/libtest/lib.rs @@ -37,14 +37,15 @@ #![feature(asm)] #![feature(box_syntax)] #![feature(collections)] -#![feature(core)] +#![feature(duration)] +#![feature(duration_span)] +#![feature(fnbox)] +#![feature(iter_cmp)] +#![feature(libc)] #![feature(rustc_private)] +#![feature(set_stdio)] #![feature(staged_api)] #![feature(std_misc)] -#![feature(libc)] -#![feature(set_stdio)] -#![feature(duration)] -#![feature(duration_span)] extern crate getopts; extern crate serialize; From d444d0c357e85c90e73585520e2da74304c7265a Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Tue, 9 Jun 2015 14:39:23 -0700 Subject: [PATCH 03/31] collections: Split the `collections` feature This commit also deprecates the `as_string` and `as_slice` free functions in the `string` and `vec` modules. --- src/libcollections/binary_heap.rs | 16 ++++++----- src/libcollections/bit.rs | 40 +++++++++++++------------- src/libcollections/btree/map.rs | 4 +-- src/libcollections/btree/set.rs | 4 +-- src/libcollections/enum_set.rs | 37 +++++++----------------- src/libcollections/lib.rs | 15 ++++++---- src/libcollections/linked_list.rs | 4 +-- src/libcollections/range.rs | 1 + src/libcollections/slice.rs | 48 +++++++++++++++++-------------- src/libcollections/str.rs | 20 ++++++------- src/libcollections/string.rs | 19 ++++++++---- src/libcollections/vec.rs | 33 ++++++++++++++------- src/libcollections/vec_deque.rs | 20 ++++++------- src/libcollections/vec_map.rs | 20 +++++++------ src/libgraphviz/lib.rs | 3 +- src/librustc/lib.rs | 8 ++++++ src/librustc_back/lib.rs | 2 +- src/librustc_driver/lib.rs | 7 +++-- src/librustc_lint/lib.rs | 4 +-- src/librustc_llvm/lib.rs | 2 +- src/librustc_resolve/lib.rs | 2 +- src/librustc_trans/lib.rs | 2 +- src/librustc_typeck/lib.rs | 4 ++- src/librustc_unicode/char.rs | 12 ++++++-- src/libserialize/lib.rs | 2 ++ src/libstd/lib.rs | 5 ++++ src/libsyntax/lib.rs | 6 ++-- src/libterm/lib.rs | 4 +-- src/libtest/lib.rs | 2 +- src/rustbook/main.rs | 6 ++-- 30 files changed, 197 insertions(+), 155 deletions(-) diff --git a/src/libcollections/binary_heap.rs b/src/libcollections/binary_heap.rs index 451b1fd61cbdf..f6204173ed7a5 100644 --- a/src/libcollections/binary_heap.rs +++ b/src/libcollections/binary_heap.rs @@ -10,10 +10,11 @@ //! A priority queue implemented with a binary heap. //! -//! Insertion and popping the largest element have `O(log n)` time complexity. Checking the largest -//! element is `O(1)`. Converting a vector to a binary heap can be done in-place, and has `O(n)` -//! complexity. A binary heap can also be converted to a sorted vector in-place, allowing it to -//! be used for an `O(n log n)` in-place heapsort. +//! Insertion and popping the largest element have `O(log n)` time complexity. +//! Checking the largest element is `O(1)`. Converting a vector to a binary heap +//! can be done in-place, and has `O(n)` complexity. A binary heap can also be +//! converted to a sorted vector in-place, allowing it to be used for an `O(n +//! log n)` in-place heapsort. //! //! # Examples //! @@ -539,8 +540,9 @@ impl BinaryHeap { /// /// The elements are removed in arbitrary order. #[inline] - #[unstable(feature = "collections", - reason = "matches collection reform specification, waiting for dust to settle")] + #[unstable(feature = "drain", + reason = "matches collection reform specification, \ + waiting for dust to settle")] pub fn drain(&mut self) -> Drain { Drain { iter: self.data.drain(..) } } @@ -678,7 +680,7 @@ impl DoubleEndedIterator for IntoIter { impl ExactSizeIterator for IntoIter {} /// An iterator that drains a `BinaryHeap`. -#[unstable(feature = "collections", reason = "recent addition")] +#[unstable(feature = "drain", reason = "recent addition")] pub struct Drain<'a, T: 'a> { iter: vec::Drain<'a, T>, } diff --git a/src/libcollections/bit.rs b/src/libcollections/bit.rs index 562bbe262068f..5709ed7a29499 100644 --- a/src/libcollections/bit.rs +++ b/src/libcollections/bit.rs @@ -156,8 +156,7 @@ const FALSE: &'static bool = &false; /// println!("{:?}", bv); /// println!("total bits set to true: {}", bv.iter().filter(|x| *x).count()); /// ``` -#[unstable(feature = "collections", - reason = "RFC 509")] +#[unstable(feature = "bitvec", reason = "RFC 509")] pub struct BitVec { /// Internal representation of the bit vector storage: Vec, @@ -181,14 +180,16 @@ impl Index for BitVec { /// Computes how many blocks are needed to store that many bits fn blocks_for_bits(bits: usize) -> usize { - // If we want 17 bits, dividing by 32 will produce 0. So we add 1 to make sure we - // reserve enough. But if we want exactly a multiple of 32, this will actually allocate - // one too many. So we need to check if that's the case. We can do that by computing if - // bitwise AND by `32 - 1` is 0. But LLVM should be able to optimize the semantically - // superior modulo operator on a power of two to this. + // If we want 17 bits, dividing by 32 will produce 0. So we add 1 to make + // sure we reserve enough. But if we want exactly a multiple of 32, this + // will actually allocate one too many. So we need to check if that's the + // case. We can do that by computing if bitwise AND by `32 - 1` is 0. But + // LLVM should be able to optimize the semantically superior modulo operator + // on a power of two to this. // // Note that we can technically avoid this branch with the expression - // `(nbits + u32::BITS - 1) / 32::BITS`, but if nbits is almost usize::MAX this will overflow. + // `(nbits + u32::BITS - 1) / 32::BITS`, but if nbits is almost usize::MAX + // this will overflow. if bits % u32::BITS == 0 { bits / u32::BITS } else { @@ -202,6 +203,7 @@ fn mask_for_bits(bits: usize) -> u32 { !0 >> (u32::BITS - bits % u32::BITS) % u32::BITS } +#[unstable(feature = "bitvec", reason = "RFC 509")] impl BitVec { /// Applies the given operation to the blocks of self and other, and sets /// self to be the result. This relies on the caller not to corrupt the @@ -407,8 +409,6 @@ impl BitVec { /// assert_eq!(bv[3], true); /// ``` #[inline] - #[unstable(feature = "collections", - reason = "panic semantics are likely to change in the future")] pub fn set(&mut self, i: usize, x: bool) { assert!(i < self.nbits); let w = i / u32::BITS; @@ -608,7 +608,7 @@ impl BitVec { /// # Examples /// /// ``` - /// # #![feature(collections, bit_vec_append_split_off)] + /// # #![feature(bitvec, append)] /// use std::collections::BitVec; /// /// let mut a = BitVec::from_bytes(&[0b10000000]); @@ -621,7 +621,7 @@ impl BitVec { /// assert!(a.eq_vec(&[true, false, false, false, false, false, false, false, /// false, true, true, false, false, false, false, true])); /// ``` - #[unstable(feature = "bit_vec_append_split_off", + #[unstable(feature = "append", reason = "recently added as part of collections reform 2")] pub fn append(&mut self, other: &mut Self) { let b = self.len() % u32::BITS; @@ -651,7 +651,7 @@ impl BitVec { /// # Examples /// /// ``` - /// # #![feature(collections, bit_vec_append_split_off)] + /// # #![feature(bitvec, split_off)] /// use std::collections::BitVec; /// let mut a = BitVec::new(); /// a.push(true); @@ -666,7 +666,7 @@ impl BitVec { /// assert!(a.eq_vec(&[true, false])); /// assert!(b.eq_vec(&[false, true])); /// ``` - #[unstable(feature = "bit_vec_append_split_off", + #[unstable(feature = "split_off", reason = "recently added as part of collections reform 2")] pub fn split_off(&mut self, at: usize) -> Self { assert!(at <= self.len(), "`at` out of bounds"); @@ -1254,8 +1254,7 @@ impl<'a> IntoIterator for &'a BitVec { /// assert!(bv[3]); /// ``` #[derive(Clone)] -#[unstable(feature = "collections", - reason = "RFC 509")] +#[unstable(feature = "bitset", reason = "RFC 509")] pub struct BitSet { bit_vec: BitVec, } @@ -1322,6 +1321,7 @@ impl cmp::PartialEq for BitSet { #[stable(feature = "rust1", since = "1.0.0")] impl cmp::Eq for BitSet {} +#[unstable(feature = "bitset", reason = "RFC 509")] impl BitSet { /// Creates a new empty `BitSet`. /// @@ -1808,7 +1808,7 @@ impl BitSet { /// # Examples /// /// ``` - /// # #![feature(collections, bit_set_append_split_off)] + /// # #![feature(collections, append)] /// use std::collections::{BitVec, BitSet}; /// /// let mut a = BitSet::new(); @@ -1826,7 +1826,7 @@ impl BitSet { /// assert_eq!(b.len(), 0); /// assert_eq!(a, BitSet::from_bit_vec(BitVec::from_bytes(&[0b01110010]))); /// ``` - #[unstable(feature = "bit_set_append_split_off", + #[unstable(feature = "append", reason = "recently added as part of collections reform 2")] pub fn append(&mut self, other: &mut Self) { self.union_with(other); @@ -1839,7 +1839,7 @@ impl BitSet { /// # Examples /// /// ``` - /// # #![feature(collections, bit_set_append_split_off)] + /// # #![feature(bitset, split_off)] /// use std::collections::{BitSet, BitVec}; /// let mut a = BitSet::new(); /// a.insert(2); @@ -1854,7 +1854,7 @@ impl BitSet { /// assert_eq!(a, BitSet::from_bit_vec(BitVec::from_bytes(&[0b01100000]))); /// assert_eq!(b, BitSet::from_bit_vec(BitVec::from_bytes(&[0b00010010]))); /// ``` - #[unstable(feature = "bit_set_append_split_off", + #[unstable(feature = "split_off", reason = "recently added as part of collections reform 2")] pub fn split_off(&mut self, at: usize) -> Self { let mut other = BitSet::new(); diff --git a/src/libcollections/btree/map.rs b/src/libcollections/btree/map.rs index 314036ef59d80..127f470c9aaae 100644 --- a/src/libcollections/btree/map.rs +++ b/src/libcollections/btree/map.rs @@ -1520,7 +1520,7 @@ impl BTreeMap { /// } /// assert_eq!(Some((&5, &"b")), map.range(Included(&4), Unbounded).next()); /// ``` - #[unstable(feature = "collections", + #[unstable(feature = "btree_range", reason = "matches collection reform specification, waiting for dust to settle")] pub fn range<'a>(&'a self, min: Bound<&K>, max: Bound<&K>) -> Range<'a, K, V> { range_impl!(&self.root, min, max, as_slices_internal, iter, Range, edges, []) @@ -1548,7 +1548,7 @@ impl BTreeMap { /// println!("{} => {}", name, balance); /// } /// ``` - #[unstable(feature = "collections", + #[unstable(feature = "btree_range", reason = "matches collection reform specification, waiting for dust to settle")] pub fn range_mut<'a>(&'a mut self, min: Bound<&K>, max: Bound<&K>) -> RangeMut<'a, K, V> { range_impl!(&mut self.root, min, max, as_slices_internal_mut, iter_mut, RangeMut, diff --git a/src/libcollections/btree/set.rs b/src/libcollections/btree/set.rs index ec6c5e63e2daf..5914e2f296a33 100644 --- a/src/libcollections/btree/set.rs +++ b/src/libcollections/btree/set.rs @@ -102,7 +102,7 @@ impl BTreeSet { /// Makes a new BTreeSet with the given B. /// /// B cannot be less than 2. - #[unstable(feature = "collections", + #[unstable(feature = "btree_b", reason = "probably want this to be on the type, eventually")] pub fn with_b(b: usize) -> BTreeSet { BTreeSet { map: BTreeMap::with_b(b) } @@ -154,7 +154,7 @@ impl BTreeSet { /// } /// assert_eq!(Some(&5), set.range(Included(&4), Unbounded).next()); /// ``` - #[unstable(feature = "collections", + #[unstable(feature = "btree_range", reason = "matches collection reform specification, waiting for dust to settle")] pub fn range<'a>(&'a self, min: Bound<&T>, max: Bound<&T>) -> Range<'a, T> { fn first((a, _): (A, B)) -> A { a } diff --git a/src/libcollections/enum_set.rs b/src/libcollections/enum_set.rs index ad90f9f1caa9c..e90e6c065a2c2 100644 --- a/src/libcollections/enum_set.rs +++ b/src/libcollections/enum_set.rs @@ -13,21 +13,26 @@ //! This module defines a container which uses an efficient bit mask //! representation to hold C-like enum variants. +#![unstable(feature = "enumset", + reason = "matches collection reform specification, \ + waiting for dust to settle")] + use core::prelude::*; use core::marker; use core::fmt; use core::iter::{FromIterator}; use core::ops::{Sub, BitOr, BitAnd, BitXor}; -// FIXME(contentions): implement union family of methods? (general design may be wrong here) +// FIXME(contentions): implement union family of methods? (general design may be +// wrong here) -#[derive(PartialEq, Eq, PartialOrd, Ord, Hash)] /// A specialized set implementation to use enum types. /// -/// It is a logic error for an item to be modified in such a way that the transformation of the -/// item to or from a `usize`, as determined by the `CLike` trait, changes while the item is in the -/// set. This is normally only possible through `Cell`, `RefCell`, global state, I/O, or unsafe -/// code. +/// It is a logic error for an item to be modified in such a way that the +/// transformation of the item to or from a `usize`, as determined by the +/// `CLike` trait, changes while the item is in the set. This is normally only +/// possible through `Cell`, `RefCell`, global state, I/O, or unsafe code. +#[derive(PartialEq, Eq, PartialOrd, Ord, Hash)] pub struct EnumSet { // We must maintain the invariant that no bits are set // for which no variant exists @@ -93,22 +98,16 @@ fn bit(e: &E) -> usize { impl EnumSet { /// Returns an empty `EnumSet`. - #[unstable(feature = "collections", - reason = "matches collection reform specification, waiting for dust to settle")] pub fn new() -> EnumSet { EnumSet {bits: 0, marker: marker::PhantomData} } /// Returns the number of elements in the given `EnumSet`. - #[unstable(feature = "collections", - reason = "matches collection reform specification, waiting for dust to settle")] pub fn len(&self) -> usize { self.bits.count_ones() as usize } /// Returns true if the `EnumSet` is empty. - #[unstable(feature = "collections", - reason = "matches collection reform specification, waiting for dust to settle")] pub fn is_empty(&self) -> bool { self.bits == 0 } @@ -118,22 +117,16 @@ impl EnumSet { } /// Returns `false` if the `EnumSet` contains any enum of the given `EnumSet`. - #[unstable(feature = "collections", - reason = "matches collection reform specification, waiting for dust to settle")] pub fn is_disjoint(&self, other: &EnumSet) -> bool { (self.bits & other.bits) == 0 } /// Returns `true` if a given `EnumSet` is included in this `EnumSet`. - #[unstable(feature = "collections", - reason = "matches collection reform specification, waiting for dust to settle")] pub fn is_superset(&self, other: &EnumSet) -> bool { (self.bits & other.bits) == other.bits } /// Returns `true` if this `EnumSet` is included in the given `EnumSet`. - #[unstable(feature = "collections", - reason = "matches collection reform specification, waiting for dust to settle")] pub fn is_subset(&self, other: &EnumSet) -> bool { other.is_superset(self) } @@ -151,8 +144,6 @@ impl EnumSet { } /// Adds an enum to the `EnumSet`, and returns `true` if it wasn't there before - #[unstable(feature = "collections", - reason = "matches collection reform specification, waiting for dust to settle")] pub fn insert(&mut self, e: E) -> bool { let result = !self.contains(&e); self.bits |= bit(&e); @@ -160,8 +151,6 @@ impl EnumSet { } /// Removes an enum from the EnumSet - #[unstable(feature = "collections", - reason = "matches collection reform specification, waiting for dust to settle")] pub fn remove(&mut self, e: &E) -> bool { let result = self.contains(e); self.bits &= !bit(e); @@ -169,15 +158,11 @@ impl EnumSet { } /// Returns `true` if an `EnumSet` contains a given enum. - #[unstable(feature = "collections", - reason = "matches collection reform specification, waiting for dust to settle")] pub fn contains(&self, e: &E) -> bool { (self.bits & bit(e)) != 0 } /// Returns an iterator over an `EnumSet`. - #[unstable(feature = "collections", - reason = "matches collection reform specification, waiting for dust to settle")] pub fn iter(&self) -> Iter { Iter::new(self.bits) } diff --git a/src/libcollections/lib.rs b/src/libcollections/lib.rs index ecf5bace3825a..9762381381c60 100644 --- a/src/libcollections/lib.rs +++ b/src/libcollections/lib.rs @@ -10,14 +10,17 @@ //! Collection types. //! -//! See [std::collections](../std/collections) for a detailed discussion of collections in Rust. +//! See [std::collections](../std/collections) for a detailed discussion of +//! collections in Rust. // Do not remove on snapshot creation. Needed for bootstrap. (Issue #22364) #![cfg_attr(stage0, feature(custom_attribute))] #![crate_name = "collections"] -#![unstable(feature = "collections")] #![staged_api] #![crate_type = "rlib"] +#![unstable(feature = "collections", + reason = "library is unlikely to be stabilized with the current \ + layout and name, use std::collections instead")] #![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/", @@ -107,14 +110,12 @@ pub mod vec; pub mod vec_deque; pub mod vec_map; -#[unstable(feature = "collections", - reason = "RFC 509")] +#[unstable(feature = "bitvec", reason = "RFC 509")] pub mod bit_vec { pub use bit::{BitVec, Iter}; } -#[unstable(feature = "collections", - reason = "RFC 509")] +#[unstable(feature = "bitset", reason = "RFC 509")] pub mod bit_set { pub use bit::{BitSet, Union, Intersection, Difference, SymmetricDifference}; pub use bit::SetIter as Iter; @@ -133,6 +134,7 @@ pub mod btree_set { // FIXME(#14344) this shouldn't be necessary #[doc(hidden)] +#[unstable(feature = "issue_14344_fixme")] pub fn fixme_14344_be_sure_to_link_to_collections() {} #[cfg(not(test))] @@ -141,6 +143,7 @@ mod std { } /// An endpoint of a range of keys. +#[unstable(feature = "collections_bound")] #[derive(Clone, Copy, Debug, Hash, PartialEq, Eq)] pub enum Bound { /// An inclusive bound. diff --git a/src/libcollections/linked_list.rs b/src/libcollections/linked_list.rs index 8ff49efe9d7d2..a732ce9e81df7 100644 --- a/src/libcollections/linked_list.rs +++ b/src/libcollections/linked_list.rs @@ -801,7 +801,7 @@ impl<'a, A> IterMut<'a, A> { /// } /// ``` #[inline] - #[unstable(feature = "collections", + #[unstable(feature = "linked_list_extras", reason = "this is probably better handled by a cursor type -- we'll see")] pub fn insert_next(&mut self, elt: A) { self.insert_next_node(box Node::new(elt)) @@ -824,7 +824,7 @@ impl<'a, A> IterMut<'a, A> { /// assert_eq!(it.next().unwrap(), &2); /// ``` #[inline] - #[unstable(feature = "collections", + #[unstable(feature = "linked_list_extras", reason = "this is probably better handled by a cursor type -- we'll see")] pub fn peek_next(&mut self) -> Option<&mut A> { if self.nelem == 0 { diff --git a/src/libcollections/range.rs b/src/libcollections/range.rs index 6ab143998d299..f37c4aede6a1a 100644 --- a/src/libcollections/range.rs +++ b/src/libcollections/range.rs @@ -7,6 +7,7 @@ // , at your // option. This file may not be copied, modified, or distributed // except according to those terms. + #![unstable(feature = "collections_range", reason = "was just added")] //! Range syntax. diff --git a/src/libcollections/slice.rs b/src/libcollections/slice.rs index 310652727b77e..c5418c9a0db8e 100644 --- a/src/libcollections/slice.rs +++ b/src/libcollections/slice.rs @@ -11,7 +11,8 @@ //! Utilities for slice manipulation //! //! The `slice` module contains useful code to help work with slice values. -//! Slices are a view into a block of memory represented as a pointer and a length. +//! Slices are a view into a block of memory represented as a pointer and a +//! length. //! //! ``` //! // slicing a Vec @@ -69,8 +70,9 @@ //! } //! ``` //! -//! This iterator yields mutable references to the slice's elements, so while the element -//! type of the slice is `i32`, the element type of the iterator is `&mut i32`. +//! This iterator yields mutable references to the slice's elements, so while +//! the element type of the slice is `i32`, the element type of the iterator is +//! `&mut i32`. //! //! * `.iter()` and `.iter_mut()` are the explicit methods to return the default //! iterators. @@ -278,14 +280,14 @@ impl [T] { } /// Returns all but the first element of a slice. - #[unstable(feature = "collections", reason = "likely to be renamed")] + #[unstable(feature = "slice_extras", reason = "likely to be renamed")] #[inline] pub fn tail(&self) -> &[T] { core_slice::SliceExt::tail(self) } /// Returns all but the first element of a mutable slice - #[unstable(feature = "collections", + #[unstable(feature = "slice_extras", reason = "likely to be renamed or removed")] #[inline] pub fn tail_mut(&mut self) -> &mut [T] { @@ -293,14 +295,14 @@ impl [T] { } /// Returns all but the last element of a slice. - #[unstable(feature = "collections", reason = "likely to be renamed")] + #[unstable(feature = "slice_extras", reason = "likely to be renamed")] #[inline] pub fn init(&self) -> &[T] { core_slice::SliceExt::init(self) } /// Returns all but the last element of a mutable slice - #[unstable(feature = "collections", + #[unstable(feature = "slice_extras", reason = "likely to be renamed or removed")] #[inline] pub fn init_mut(&mut self) -> &mut [T] { @@ -727,13 +729,13 @@ impl [T] { } /// Find the first index containing a matching value. - #[unstable(feature = "collections")] + #[unstable(feature = "slice_position_elem")] pub fn position_elem(&self, t: &T) -> Option where T: PartialEq { core_slice::SliceExt::position_elem(self, t) } /// Find the last index containing a matching value. - #[unstable(feature = "collections")] + #[unstable(feature = "slice_position_elem")] pub fn rposition_elem(&self, t: &T) -> Option where T: PartialEq { core_slice::SliceExt::rposition_elem(self, t) } @@ -869,7 +871,7 @@ impl [T] { /// assert_eq!(Some(vec![1, 3, 2]), perms.next()); /// assert_eq!(Some(vec![3, 1, 2]), perms.next()); /// ``` - #[unstable(feature = "collections")] + #[unstable(feature = "permutations")] #[inline] pub fn permutations(&self) -> Permutations where T: Clone { // NB see hack module in this file @@ -893,7 +895,7 @@ impl [T] { /// let b: &mut [_] = &mut [1, 0, 2]; /// assert!(v == b); /// ``` - #[unstable(feature = "collections", + #[unstable(feature = "permutations", reason = "uncertain if this merits inclusion in std")] pub fn next_permutation(&mut self) -> bool where T: Ord { core_slice::SliceExt::next_permutation(self) @@ -916,7 +918,7 @@ impl [T] { /// let b: &mut [_] = &mut [0, 1, 2]; /// assert!(v == b); /// ``` - #[unstable(feature = "collections", + #[unstable(feature = "permutations", reason = "uncertain if this merits inclusion in std")] pub fn prev_permutation(&mut self) -> bool where T: Ord { core_slice::SliceExt::prev_permutation(self) @@ -940,7 +942,7 @@ impl [T] { /// assert!(dst.clone_from_slice(&src2) == 3); /// assert!(dst == [3, 4, 5]); /// ``` - #[unstable(feature = "collections")] + #[unstable(feature = "clone_from_slice")] pub fn clone_from_slice(&mut self, src: &[T]) -> usize where T: Clone { core_slice::SliceExt::clone_from_slice(self, src) } @@ -967,7 +969,7 @@ impl [T] { /// assert_eq!(num_moved, 3); /// assert!(a == [6, 7, 8, 4, 5]); /// ``` - #[unstable(feature = "collections", + #[unstable(feature = "move_from", reason = "uncertain about this API approach")] #[inline] pub fn move_from(&mut self, mut src: Vec, start: usize, end: usize) -> usize { @@ -997,10 +999,12 @@ impl [T] { //////////////////////////////////////////////////////////////////////////////// // Extension traits for slices over specific kinds of data //////////////////////////////////////////////////////////////////////////////// -#[unstable(feature = "collections", reason = "recently changed")] +#[unstable(feature = "slice_concat_ext", + reason = "trait should not have to exist")] /// An extension trait for concatenating slices pub trait SliceConcatExt { - #[unstable(feature = "collections", reason = "recently changed")] + #[unstable(feature = "slice_concat_ext", + reason = "trait should not have to exist")] /// The resulting type after concatenation type Output; @@ -1014,8 +1018,8 @@ pub trait SliceConcatExt { #[stable(feature = "rust1", since = "1.0.0")] fn concat(&self) -> Self::Output; - /// Flattens a slice of `T` into a single value `Self::Output`, placing a given separator - /// between each. + /// Flattens a slice of `T` into a single value `Self::Output`, placing a + /// given separator between each. /// /// # Examples /// @@ -1060,7 +1064,7 @@ impl> SliceConcatExt for [V] { /// /// The last generated swap is always (0, 1), and it returns the /// sequence to its initial order. -#[unstable(feature = "collections")] +#[unstable(feature = "permutations")] #[derive(Clone)] pub struct ElementSwaps { sdir: Vec, @@ -1072,7 +1076,7 @@ pub struct ElementSwaps { impl ElementSwaps { /// Creates an `ElementSwaps` iterator for a sequence of `length` elements. - #[unstable(feature = "collections")] + #[unstable(feature = "permutations")] pub fn new(length: usize) -> ElementSwaps { // Initialize `sdir` with a direction that position should move in // (all negative at the beginning) and the `size` of the @@ -1194,13 +1198,13 @@ impl Iterator for ElementSwaps { /// swap applied. /// /// Generates even and odd permutations alternately. -#[unstable(feature = "collections")] +#[unstable(feature = "permutations")] pub struct Permutations { swaps: ElementSwaps, v: Vec, } -#[unstable(feature = "collections", reason = "trait is unstable")] +#[unstable(feature = "permutations", reason = "trait is unstable")] impl Iterator for Permutations { type Item = Vec; diff --git a/src/libcollections/str.rs b/src/libcollections/str.rs index 39e1812512f44..61e09a2670ab3 100644 --- a/src/libcollections/str.rs +++ b/src/libcollections/str.rs @@ -366,7 +366,7 @@ impl<'a> Iterator for Recompositions<'a> { /// /// For use with the `std::iter` module. #[derive(Clone)] -#[unstable(feature = "collections")] +#[unstable(feature = "str_utf16")] pub struct Utf16Units<'a> { encoder: Utf16Encoder> } @@ -591,7 +591,7 @@ impl str { /// assert_eq!(s.slice_chars(0, 4), "Löwe"); /// assert_eq!(s.slice_chars(5, 7), "老虎"); /// ``` - #[unstable(feature = "collections", + #[unstable(feature = "slice_chars", reason = "may have yet to prove its worth")] pub fn slice_chars(&self, begin: usize, end: usize) -> &str { core_str::StrExt::slice_chars(self, begin, end) @@ -1068,7 +1068,7 @@ impl str { } /// Returns an iterator of `u16` over the string encoded as UTF-16. - #[unstable(feature = "collections", + #[unstable(feature = "str_utf16", reason = "this functionality may only be provided by libunicode")] pub fn utf16_units(&self) -> Utf16Units { Utf16Units { encoder: Utf16Encoder::new(self[..].chars()) } @@ -1527,7 +1527,7 @@ impl str { /// let v: Vec<&str> = "1abc2abc3".matches(char::is_numeric).collect(); /// assert_eq!(v, ["1", "2", "3"]); /// ``` - #[unstable(feature = "collections", + #[unstable(feature = "str_matches", reason = "method got recently added")] pub fn matches<'a, P: Pattern<'a>>(&'a self, pat: P) -> Matches<'a, P> { core_str::StrExt::matches(self, pat) @@ -1560,7 +1560,7 @@ impl str { /// let v: Vec<&str> = "1abc2abc3".rmatches(char::is_numeric).collect(); /// assert_eq!(v, ["3", "2", "1"]); /// ``` - #[unstable(feature = "collections", + #[unstable(feature = "str_matches", reason = "method got recently added")] pub fn rmatches<'a, P: Pattern<'a>>(&'a self, pat: P) -> RMatches<'a, P> where P::Searcher: ReverseSearcher<'a> @@ -1605,7 +1605,7 @@ impl str { /// let v: Vec<(usize, usize)> = "ababa".match_indices("aba").collect(); /// assert_eq!(v, [(0, 3)]); // only the first `aba` /// ``` - #[unstable(feature = "collections", + #[unstable(feature = "str_matches", reason = "might have its iterator type changed")] // NB: Right now MatchIndices yields `(usize, usize)`, but it would // be more consistent with `matches` and `char_indices` to return `(usize, &str)` @@ -1649,7 +1649,7 @@ impl str { /// let v: Vec<(usize, usize)> = "ababa".rmatch_indices("aba").collect(); /// assert_eq!(v, [(2, 5)]); // only the last `aba` /// ``` - #[unstable(feature = "collections", + #[unstable(feature = "str_matches", reason = "might have its iterator type changed")] // NB: Right now RMatchIndices yields `(usize, usize)`, but it would // be more consistent with `rmatches` and `char_indices` to return `(usize, &str)` @@ -1677,7 +1677,7 @@ impl str { /// assert!(string.subslice_offset(lines[1]) == 2); // &"b" /// assert!(string.subslice_offset(lines[2]) == 4); // &"c" /// ``` - #[unstable(feature = "collections", + #[unstable(feature = "subslice_offset", reason = "awaiting convention about comparability of arbitrary slices")] pub fn subslice_offset(&self, inner: &str) -> usize { core_str::StrExt::subslice_offset(self, inner) @@ -1922,14 +1922,14 @@ impl str { } /// Escapes each char in `s` with `char::escape_default`. - #[unstable(feature = "collections", + #[unstable(feature = "str_escape", reason = "return type may change to be an iterator")] pub fn escape_default(&self) -> String { self.chars().flat_map(|c| c.escape_default()).collect() } /// Escapes each char in `s` with `char::escape_unicode`. - #[unstable(feature = "collections", + #[unstable(feature = "str_escape", reason = "return type may change to be an iterator")] pub fn escape_unicode(&self) -> String { self.chars().flat_map(|c| c.escape_unicode()).collect() diff --git a/src/libcollections/string.rs b/src/libcollections/string.rs index 6717f2f45fab5..6e37a5731b384 100644 --- a/src/libcollections/string.rs +++ b/src/libcollections/string.rs @@ -696,7 +696,7 @@ impl String { /// # Examples /// /// ``` - /// # #![feature(collections_drain)] + /// # #![feature(drain)] /// /// let mut s = String::from("α is alpha, β is beta"); /// let beta_offset = s.find('β').unwrap_or(s.len()); @@ -710,7 +710,7 @@ impl String { /// s.drain(..); /// assert_eq!(s, ""); /// ``` - #[unstable(feature = "collections_drain", + #[unstable(feature = "drain", reason = "recently added, matches RFC")] pub fn drain(&mut self, range: R) -> Drain where R: RangeArgument { // Memory safety @@ -975,10 +975,14 @@ impl ops::Deref for String { /// Wrapper type providing a `&String` reference via `Deref`. #[unstable(feature = "collections")] +#[deprecated(since = "1.2.0", + reason = "replaced with deref coercions or Borrow")] +#[allow(deprecated)] pub struct DerefString<'a> { x: DerefVec<'a, u8> } +#[allow(deprecated)] impl<'a> Deref for DerefString<'a> { type Target = String; @@ -1005,6 +1009,9 @@ impl<'a> Deref for DerefString<'a> { /// string_consumer(&as_string("foo")); /// ``` #[unstable(feature = "collections")] +#[deprecated(since = "1.2.0", + reason = "replaced with deref coercions or Borrow")] +#[allow(deprecated)] pub fn as_string<'a>(x: &'a str) -> DerefString<'a> { DerefString { x: as_vec(x.as_bytes()) } } @@ -1134,7 +1141,7 @@ impl fmt::Write for String { } /// A draining iterator for `String`. -#[unstable(feature = "collections_drain", reason = "recently added")] +#[unstable(feature = "drain", reason = "recently added")] pub struct Drain<'a> { /// Will be used as &'a mut String in the destructor string: *mut String, @@ -1149,7 +1156,7 @@ pub struct Drain<'a> { unsafe impl<'a> Sync for Drain<'a> {} unsafe impl<'a> Send for Drain<'a> {} -#[unstable(feature = "collections_drain", reason = "recently added")] +#[unstable(feature = "drain", reason = "recently added")] impl<'a> Drop for Drain<'a> { fn drop(&mut self) { unsafe { @@ -1163,7 +1170,7 @@ impl<'a> Drop for Drain<'a> { } } -#[unstable(feature = "collections_drain", reason = "recently added")] +#[unstable(feature = "drain", reason = "recently added")] impl<'a> Iterator for Drain<'a> { type Item = char; @@ -1177,7 +1184,7 @@ impl<'a> Iterator for Drain<'a> { } } -#[unstable(feature = "collections_drain", reason = "recently added")] +#[unstable(feature = "drain", reason = "recently added")] impl<'a> DoubleEndedIterator for Drain<'a> { #[inline] fn next_back(&mut self) -> Option { diff --git a/src/libcollections/vec.rs b/src/libcollections/vec.rs index ba41f438b37fb..1409ececfc7a5 100644 --- a/src/libcollections/vec.rs +++ b/src/libcollections/vec.rs @@ -276,7 +276,7 @@ impl Vec { /// the buffer are copied into the vector without cloning, as if /// `ptr::read()` were called on them. #[inline] - #[unstable(feature = "collections", + #[unstable(feature = "vec_from_raw_buf", reason = "may be better expressed via composition")] pub unsafe fn from_raw_buf(ptr: *const T, elts: usize) -> Vec { let mut dst = Vec::with_capacity(elts); @@ -704,7 +704,7 @@ impl Vec { /// assert_eq!(vec2, []); /// ``` #[inline] - #[unstable(feature = "collections", + #[unstable(feature = "append", reason = "new API, waiting for dust to settle")] pub fn append(&mut self, other: &mut Self) { if mem::size_of::() == 0 { @@ -742,7 +742,7 @@ impl Vec { /// # Examples /// /// ``` - /// # #![feature(collections_drain)] + /// # #![feature(drain)] /// /// // Draining using `..` clears the whole vector. /// let mut v = vec![1, 2, 3]; @@ -750,7 +750,7 @@ impl Vec { /// assert_eq!(v, &[]); /// assert_eq!(u, &[1, 2, 3]); /// ``` - #[unstable(feature = "collections_drain", + #[unstable(feature = "drain", reason = "recently added, matches RFC")] pub fn drain(&mut self, range: R) -> Drain where R: RangeArgument { // Memory safety @@ -851,7 +851,7 @@ impl Vec { /// let newtyped_bytes = bytes.map_in_place(|x| Newtype(x)); /// assert_eq!(&newtyped_bytes[..], &[Newtype(0x11), Newtype(0x22)]); /// ``` - #[unstable(feature = "collections", + #[unstable(feature = "map_in_place", reason = "API may change to provide stronger guarantees")] pub fn map_in_place(self, mut f: F) -> Vec where F: FnMut(T) -> U { // FIXME: Assert statically that the types `T` and `U` have the same @@ -1043,14 +1043,14 @@ impl Vec { /// # Examples /// /// ``` - /// # #![feature(collections)] + /// # #![feature(split_off)] /// let mut vec = vec![1,2,3]; /// let vec2 = vec.split_off(1); /// assert_eq!(vec, [1]); /// assert_eq!(vec2, [2, 3]); /// ``` #[inline] - #[unstable(feature = "collections", + #[unstable(feature = "split_off", reason = "new API, waiting for dust to settle")] pub fn split_off(&mut self, at: usize) -> Self { assert!(at <= self.len(), "`at` out of bounds"); @@ -1091,7 +1091,7 @@ impl Vec { /// vec.resize(2, 0); /// assert_eq!(vec, [1, 2]); /// ``` - #[unstable(feature = "collections", + #[unstable(feature = "vec_resize", reason = "matches collection reform specification; waiting for dust to settle")] pub fn resize(&mut self, new_len: usize, value: T) { let len = self.len(); @@ -1117,7 +1117,7 @@ impl Vec { /// assert_eq!(vec, [1, 2, 3, 4]); /// ``` #[inline] - #[unstable(feature = "collections", + #[unstable(feature = "vec_push_all", reason = "likely to be replaced by a more optimized extend")] pub fn push_all(&mut self, other: &[T]) { self.reserve(other.len()); @@ -1738,7 +1738,7 @@ unsafe impl Sync for IntoIter { } impl IntoIter { #[inline] /// Drops all items that have not yet been moved and returns the empty vector. - #[unstable(feature = "collections")] + #[unstable(feature = "iter_to_vec")] pub fn into_inner(mut self) -> Vec { unsafe { for _x in self.by_ref() { } @@ -1832,7 +1832,7 @@ impl Drop for IntoIter { } /// A draining iterator for `Vec`. -#[unstable(feature = "collections_drain", reason = "recently added")] +#[unstable(feature = "drain", reason = "recently added")] pub struct Drain<'a, T: 'a> { /// Index of tail to preserve tail_start: usize, @@ -1907,12 +1907,17 @@ impl<'a, T> ExactSizeIterator for Drain<'a, T> {} /// Wrapper type providing a `&Vec` reference via `Deref`. #[unstable(feature = "collections")] +#[deprecated(since = "1.2.0", + reason = "replaced with deref coercions or Borrow")] pub struct DerefVec<'a, T:'a> { x: Vec, l: PhantomData<&'a T>, } #[unstable(feature = "collections")] +#[deprecated(since = "1.2.0", + reason = "replaced with deref coercions or Borrow")] +#[allow(deprecated)] impl<'a, T> Deref for DerefVec<'a, T> { type Target = Vec; @@ -1923,6 +1928,9 @@ impl<'a, T> Deref for DerefVec<'a, T> { // Prevent the inner `Vec` from attempting to deallocate memory. #[stable(feature = "rust1", since = "1.0.0")] +#[deprecated(since = "1.2.0", + reason = "replaced with deref coercions or Borrow")] +#[allow(deprecated)] impl<'a, T> Drop for DerefVec<'a, T> { fn drop(&mut self) { self.x.len = 0; @@ -1948,6 +1956,9 @@ impl<'a, T> Drop for DerefVec<'a, T> { /// vec_consumer(&as_vec(&values)); /// ``` #[unstable(feature = "collections")] +#[deprecated(since = "1.2.0", + reason = "replaced with deref coercions or Borrow")] +#[allow(deprecated)] pub fn as_vec<'a, T>(x: &'a [T]) -> DerefVec<'a, T> { unsafe { DerefVec { diff --git a/src/libcollections/vec_deque.rs b/src/libcollections/vec_deque.rs index da13684b4f302..54127ea8a9ef2 100644 --- a/src/libcollections/vec_deque.rs +++ b/src/libcollections/vec_deque.rs @@ -491,7 +491,7 @@ impl VecDeque { /// assert_eq!(buf.len(), 1); /// assert_eq!(Some(&5), buf.get(0)); /// ``` - #[unstable(feature = "collections", + #[unstable(feature = "deque_extras", reason = "matches collection reform specification; waiting on panic semantics")] pub fn truncate(&mut self, len: usize) { for _ in len..self.len() { @@ -552,7 +552,7 @@ impl VecDeque { /// Returns a pair of slices which contain, in order, the contents of the /// `VecDeque`. #[inline] - #[unstable(feature = "collections", + #[unstable(feature = "deque_extras", reason = "matches collection reform specification, waiting for dust to settle")] pub fn as_slices(&self) -> (&[T], &[T]) { unsafe { @@ -572,7 +572,7 @@ impl VecDeque { /// Returns a pair of slices which contain, in order, the contents of the /// `VecDeque`. #[inline] - #[unstable(feature = "collections", + #[unstable(feature = "deque_extras", reason = "matches collection reform specification, waiting for dust to settle")] pub fn as_mut_slices(&mut self) -> (&mut [T], &mut [T]) { unsafe { @@ -638,7 +638,7 @@ impl VecDeque { /// assert!(v.is_empty()); /// ``` #[inline] - #[unstable(feature = "collections", + #[unstable(feature = "drain", reason = "matches collection reform specification, waiting for dust to settle")] pub fn drain(&mut self) -> Drain { Drain { @@ -880,7 +880,7 @@ impl VecDeque { /// buf.push_back(10); /// assert_eq!(buf.swap_back_remove(1), Some(99)); /// ``` - #[unstable(feature = "collections", + #[unstable(feature = "deque_extras", reason = "the naming of this function may be altered")] pub fn swap_back_remove(&mut self, index: usize) -> Option { let length = self.len(); @@ -914,7 +914,7 @@ impl VecDeque { /// buf.push_back(20); /// assert_eq!(buf.swap_front_remove(3), Some(99)); /// ``` - #[unstable(feature = "collections", + #[unstable(feature = "deque_extras", reason = "the naming of this function may be altered")] pub fn swap_front_remove(&mut self, index: usize) -> Option { let length = self.len(); @@ -1320,7 +1320,7 @@ impl VecDeque { /// assert_eq!(buf2.len(), 2); /// ``` #[inline] - #[unstable(feature = "collections", + #[unstable(feature = "split_off", reason = "new API, waiting for dust to settle")] pub fn split_off(&mut self, at: usize) -> Self { let len = self.len(); @@ -1383,7 +1383,7 @@ impl VecDeque { /// assert_eq!(buf2.len(), 0); /// ``` #[inline] - #[unstable(feature = "collections", + #[unstable(feature = "append", reason = "new API, waiting for dust to settle")] pub fn append(&mut self, other: &mut Self) { // naive impl @@ -1447,7 +1447,7 @@ impl VecDeque { /// assert_eq!(a, b); /// } /// ``` - #[unstable(feature = "collections", + #[unstable(feature = "deque_extras", reason = "matches collection reform specification; waiting on panic semantics")] pub fn resize(&mut self, new_len: usize, value: T) { let len = self.len(); @@ -1635,7 +1635,7 @@ impl DoubleEndedIterator for IntoIter { impl ExactSizeIterator for IntoIter {} /// A draining VecDeque iterator -#[unstable(feature = "collections", +#[unstable(feature = "drain", reason = "matches collection reform specification, waiting for dust to settle")] pub struct Drain<'a, T: 'a> { inner: &'a mut VecDeque, diff --git a/src/libcollections/vec_map.rs b/src/libcollections/vec_map.rs index 5c2f5759604b7..3fd2455a00443 100644 --- a/src/libcollections/vec_map.rs +++ b/src/libcollections/vec_map.rs @@ -12,6 +12,8 @@ //! are O(highest integer key). #![allow(missing_docs)] +#![unstable(feature = "vecmap", + reason = "may not be stabilized in the standard library")] use self::Entry::*; @@ -325,7 +327,7 @@ impl VecMap { /// assert_eq!(a[3], "c"); /// assert_eq!(a[4], "d"); /// ``` - #[unstable(feature = "collections", + #[unstable(feature = "append", reason = "recently added as part of collections reform 2")] pub fn append(&mut self, other: &mut Self) { self.extend(other.drain()); @@ -358,7 +360,7 @@ impl VecMap { /// assert_eq!(b[3], "c"); /// assert_eq!(b[4], "d"); /// ``` - #[unstable(feature = "collections", + #[unstable(feature = "split_off", reason = "recently added as part of collections reform 2")] pub fn split_off(&mut self, at: usize) -> Self { let mut other = VecMap::new(); @@ -410,7 +412,7 @@ impl VecMap { /// /// assert_eq!(vec, [(1, "a"), (2, "b"), (3, "c")]); /// ``` - #[unstable(feature = "collections", + #[unstable(feature = "drain", reason = "matches collection reform specification, waiting for dust to settle")] pub fn drain<'a>(&'a mut self) -> Drain<'a, V> { fn filter((i, v): (usize, Option)) -> Option<(usize, A)> { @@ -632,7 +634,7 @@ impl VecMap { impl<'a, V> Entry<'a, V> { - #[unstable(feature = "collections", + #[unstable(feature = "entry", reason = "will soon be replaced by or_insert")] #[deprecated(since = "1.0", reason = "replaced with more ergonomic `or_insert` and `or_insert_with`")] @@ -644,7 +646,7 @@ impl<'a, V> Entry<'a, V> { } } - #[unstable(feature = "collections", + #[unstable(feature = "entry", reason = "matches entry v3 specification, waiting for dust to settle")] /// Ensures a value is in the entry by inserting the default if empty, and returns /// a mutable reference to the value in the entry. @@ -655,7 +657,7 @@ impl<'a, V> Entry<'a, V> { } } - #[unstable(feature = "collections", + #[unstable(feature = "entry", reason = "matches entry v3 specification, waiting for dust to settle")] /// Ensures a value is in the entry by inserting the result of the default function if empty, /// and returns a mutable reference to the value in the entry. @@ -1003,14 +1005,14 @@ pub struct IntoIter { fn((usize, Option)) -> Option<(usize, V)>> } -#[unstable(feature = "collections")] +#[unstable(feature = "drain")] pub struct Drain<'a, V:'a> { iter: FilterMap< Enumerate>>, fn((usize, Option)) -> Option<(usize, V)>> } -#[unstable(feature = "collections")] +#[unstable(feature = "drain")] impl<'a, V> Iterator for Drain<'a, V> { type Item = (usize, V); @@ -1018,7 +1020,7 @@ impl<'a, V> Iterator for Drain<'a, V> { fn size_hint(&self) -> (usize, Option) { self.iter.size_hint() } } -#[unstable(feature = "collections")] +#[unstable(feature = "drain")] impl<'a, V> DoubleEndedIterator for Drain<'a, V> { fn next_back(&mut self) -> Option<(usize, V)> { self.iter.next_back() } } diff --git a/src/libgraphviz/lib.rs b/src/libgraphviz/lib.rs index f6c5d66f55cff..f8d80035d97fb 100644 --- a/src/libgraphviz/lib.rs +++ b/src/libgraphviz/lib.rs @@ -281,8 +281,9 @@ #![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/")] -#![feature(collections)] + #![feature(into_cow)] +#![feature(str_escape)] use self::LabelText::*; diff --git a/src/librustc/lib.rs b/src/librustc/lib.rs index 944af19a44313..49667bf74cf2c 100644 --- a/src/librustc/lib.rs +++ b/src/librustc/lib.rs @@ -25,18 +25,22 @@ html_favicon_url = "https://doc.rust-lang.org/favicon.ico", html_root_url = "http://doc.rust-lang.org/nightly/")] +#![feature(append)] #![feature(associated_consts)] #![feature(box_patterns)] #![feature(box_syntax)] +#![feature(clone_from_slice)] #![feature(collections)] #![feature(const_fn)] #![feature(duration)] #![feature(duration_span)] +#![feature(enumset)] #![feature(fs_canonicalize)] #![feature(hash_default)] #![feature(into_cow)] #![feature(iter_sum)] #![feature(libc)] +#![feature(map_in_place)] #![feature(num_bits_bytes)] #![feature(path_ext)] #![feature(quote)] @@ -45,10 +49,14 @@ #![feature(rustc_diagnostic_macros)] #![feature(rustc_private)] #![feature(slice_bytes)] +#![feature(slice_extras)] #![feature(slice_patterns)] +#![feature(slice_position_elem)] #![feature(staged_api)] #![feature(std_misc)] #![feature(str_char)] +#![feature(str_matches)] +#![feature(vec_push_all)] #![feature(wrapping)] #![cfg_attr(test, feature(test))] diff --git a/src/librustc_back/lib.rs b/src/librustc_back/lib.rs index e4d0c9aa15f7a..297041a990790 100644 --- a/src/librustc_back/lib.rs +++ b/src/librustc_back/lib.rs @@ -33,7 +33,6 @@ html_root_url = "http://doc.rust-lang.org/nightly/")] #![feature(box_syntax)] -#![feature(collections)] #![feature(fs_canonicalize)] #![feature(libc)] #![feature(path_ext)] @@ -42,6 +41,7 @@ #![feature(slice_bytes)] #![feature(staged_api)] #![feature(step_by)] +#![feature(vec_push_all)] #![cfg_attr(test, feature(test, rand))] extern crate syntax; diff --git a/src/librustc_driver/lib.rs b/src/librustc_driver/lib.rs index 6ae0ea81c3dda..e369ca46b2c02 100644 --- a/src/librustc_driver/lib.rs +++ b/src/librustc_driver/lib.rs @@ -26,14 +26,15 @@ html_root_url = "http://doc.rust-lang.org/nightly/")] #![feature(box_syntax)] -#![feature(collections)] +#![feature(exit_status)] #![feature(libc)] #![feature(quote)] #![feature(rustc_diagnostic_macros)] #![feature(rustc_private)] -#![feature(staged_api)] -#![feature(exit_status)] #![feature(set_stdio)] +#![feature(staged_api)] +#![feature(str_casing)] +#![feature(vec_push_all)] extern crate arena; extern crate flate; diff --git a/src/librustc_lint/lib.rs b/src/librustc_lint/lib.rs index 88d307610208f..d53689bb1d164 100644 --- a/src/librustc_lint/lib.rs +++ b/src/librustc_lint/lib.rs @@ -30,17 +30,17 @@ html_favicon_url = "https://doc.rust-lang.org/favicon.ico", html_root_url = "http://doc.rust-lang.org/nightly/")] +#![cfg_attr(test, feature(test))] #![feature(box_patterns)] #![feature(box_syntax)] -#![feature(collections)] #![feature(num_bits_bytes)] #![feature(quote)] #![feature(ref_slice)] #![feature(rustc_diagnostic_macros)] #![feature(rustc_private)] #![feature(staged_api)] +#![feature(str_casing)] #![feature(str_char)] -#![cfg_attr(test, feature(test))] extern crate syntax; #[macro_use] diff --git a/src/librustc_llvm/lib.rs b/src/librustc_llvm/lib.rs index bf331705b32c9..bea934c6aa0dc 100644 --- a/src/librustc_llvm/lib.rs +++ b/src/librustc_llvm/lib.rs @@ -27,10 +27,10 @@ #![feature(associated_consts)] #![feature(box_syntax)] -#![feature(collections)] #![feature(libc)] #![feature(link_args)] #![feature(staged_api)] +#![feature(vec_push_all)] extern crate libc; #[macro_use] #[no_link] extern crate rustc_bitflags; diff --git a/src/librustc_resolve/lib.rs b/src/librustc_resolve/lib.rs index 0c0fd3f93dcdd..787f914718d4b 100644 --- a/src/librustc_resolve/lib.rs +++ b/src/librustc_resolve/lib.rs @@ -20,10 +20,10 @@ html_root_url = "http://doc.rust-lang.org/nightly/")] #![feature(associated_consts)] -#![feature(collections)] #![feature(rc_weak)] #![feature(rustc_diagnostic_macros)] #![feature(rustc_private)] +#![feature(slice_extras)] #![feature(staged_api)] #[macro_use] extern crate log; diff --git a/src/librustc_trans/lib.rs b/src/librustc_trans/lib.rs index d0fadd6565c3b..5ace77284953a 100644 --- a/src/librustc_trans/lib.rs +++ b/src/librustc_trans/lib.rs @@ -27,7 +27,6 @@ #![feature(box_patterns)] #![feature(box_syntax)] -#![feature(collections)] #![feature(const_fn)] #![feature(fs)] #![feature(iter_cmp)] @@ -46,6 +45,7 @@ #![feature(std_misc)] #![feature(unicode)] #![feature(unicode)] +#![feature(vec_push_all)] #![allow(trivial_casts)] diff --git a/src/librustc_typeck/lib.rs b/src/librustc_typeck/lib.rs index f5a7ec4dbd246..f204fa2b1fd01 100644 --- a/src/librustc_typeck/lib.rs +++ b/src/librustc_typeck/lib.rs @@ -77,14 +77,16 @@ This API is completely unstable and subject to change. #![feature(box_patterns)] #![feature(box_syntax)] -#![feature(collections, collections_drain)] +#![feature(drain)] #![feature(iter_cmp)] #![feature(iter_sum)] #![feature(quote)] #![feature(ref_slice)] #![feature(rustc_diagnostic_macros)] #![feature(rustc_private)] +#![feature(slice_extras)] #![feature(staged_api)] +#![feature(vec_push_all)] #[macro_use] extern crate log; #[macro_use] extern crate syntax; diff --git a/src/librustc_unicode/char.rs b/src/librustc_unicode/char.rs index a7ced76e10c18..0ad5141c5bee6 100644 --- a/src/librustc_unicode/char.rs +++ b/src/librustc_unicode/char.rs @@ -310,7 +310,9 @@ impl char { #[unstable(feature = "unicode", reason = "pending decision about Iterator/Writer/Reader")] #[inline] - pub fn encode_utf8(self, dst: &mut [u8]) -> Option { C::encode_utf8(self, dst) } + pub fn encode_utf8(self, dst: &mut [u8]) -> Option { + C::encode_utf8(self, dst) + } /// Encodes this character as UTF-16 into the provided `u16` buffer, and /// then returns the number of `u16`s written. @@ -345,7 +347,9 @@ impl char { #[unstable(feature = "unicode", reason = "pending decision about Iterator/Writer/Reader")] #[inline] - pub fn encode_utf16(self, dst: &mut [u16]) -> Option { C::encode_utf16(self, dst) } + pub fn encode_utf16(self, dst: &mut [u16]) -> Option { + C::encode_utf16(self, dst) + } /// Returns whether the specified character is considered a Unicode /// alphabetic code point. @@ -541,5 +545,7 @@ impl char { #[unstable(feature = "unicode", reason = "needs expert opinion. is_cjk flag stands out as ugly")] #[inline] - pub fn width(self, is_cjk: bool) -> Option { charwidth::width(self, is_cjk) } + pub fn width(self, is_cjk: bool) -> Option { + charwidth::width(self, is_cjk) + } } diff --git a/src/libserialize/lib.rs b/src/libserialize/lib.rs index 8170dd957307b..7fdab8789158e 100644 --- a/src/libserialize/lib.rs +++ b/src/libserialize/lib.rs @@ -36,6 +36,8 @@ Core encoding and decoding interfaces. #![feature(std_misc)] #![feature(str_char)] #![feature(unicode)] +#![feature(vecmap)] +#![feature(enumset)] #![cfg_attr(test, feature(test))] // test harness access diff --git a/src/libstd/lib.rs b/src/libstd/lib.rs index 7504488122396..20211f87689b6 100644 --- a/src/libstd/lib.rs +++ b/src/libstd/lib.rs @@ -110,7 +110,9 @@ #![feature(box_raw)] #![feature(box_syntax)] #![feature(char_internals)] +#![feature(clone_from_slice)] #![feature(collections)] +#![feature(collections_bound)] #![feature(const_fn)] #![feature(core)] #![feature(core_float)] @@ -126,6 +128,8 @@ #![feature(libc)] #![feature(linkage, thread_local, asm)] #![feature(macro_reexport)] +#![feature(slice_concat_ext)] +#![feature(slice_position_elem)] #![feature(no_std)] #![feature(num_bits_bytes)] #![feature(oom)] @@ -142,6 +146,7 @@ #![feature(unicode)] #![feature(unique)] #![feature(unsafe_no_drop_flag, filling_drop)] +#![feature(vec_push_all)] #![feature(wrapping)] #![feature(zero_one)] #![cfg_attr(test, feature(float_from_str_radix))] diff --git a/src/libsyntax/lib.rs b/src/libsyntax/lib.rs index 432cdbdfef05e..7333265bdd412 100644 --- a/src/libsyntax/lib.rs +++ b/src/libsyntax/lib.rs @@ -26,15 +26,17 @@ html_root_url = "http://doc.rust-lang.org/nightly/")] #![feature(associated_consts)] -#![feature(collections)] -#![feature(collections_drain)] +#![feature(bitset)] +#![feature(drain)] #![feature(filling_drop)] #![feature(libc)] #![feature(ref_slice)] #![feature(rustc_private)] #![feature(staged_api)] #![feature(str_char)] +#![feature(str_escape)] #![feature(unicode)] +#![feature(vec_push_all)] extern crate fmt_macros; extern crate serialize; diff --git a/src/libterm/lib.rs b/src/libterm/lib.rs index ec1426e6e48ce..3affb37ba5b9f 100644 --- a/src/libterm/lib.rs +++ b/src/libterm/lib.rs @@ -56,12 +56,12 @@ #![deny(missing_docs)] #![feature(box_syntax)] -#![feature(collections)] +#![feature(path_ext)] #![feature(rustc_private)] #![feature(staged_api)] #![feature(std_misc)] #![feature(str_char)] -#![feature(path_ext)] +#![feature(vec_push_all)] #![cfg_attr(windows, feature(libc))] #[macro_use] extern crate log; diff --git a/src/libtest/lib.rs b/src/libtest/lib.rs index 6ee6f8c2e24bd..4664968913466 100644 --- a/src/libtest/lib.rs +++ b/src/libtest/lib.rs @@ -36,7 +36,6 @@ #![feature(asm)] #![feature(box_syntax)] -#![feature(collections)] #![feature(duration)] #![feature(duration_span)] #![feature(fnbox)] @@ -44,6 +43,7 @@ #![feature(libc)] #![feature(rustc_private)] #![feature(set_stdio)] +#![feature(slice_extras)] #![feature(staged_api)] #![feature(std_misc)] diff --git a/src/rustbook/main.rs b/src/rustbook/main.rs index 09fcd518c1e7e..e79462a4aafe2 100644 --- a/src/rustbook/main.rs +++ b/src/rustbook/main.rs @@ -10,11 +10,11 @@ #![deny(warnings)] -#![feature(core)] #![feature(exit_status)] -#![feature(rustdoc)] -#![feature(rustc_private)] +#![feature(iter_sum)] #![feature(path_relative_from)] +#![feature(rustc_private)] +#![feature(rustdoc)] extern crate rustdoc; extern crate rustc_back; From 6895311e859e1859f9b3f0adc9f1fbb4d2891534 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Tue, 9 Jun 2015 18:15:22 -0700 Subject: [PATCH 04/31] std: Split the `std_misc` feature --- src/libcollections/btree/map.rs | 2 +- src/liblog/lib.rs | 4 +++- src/librustc/lib.rs | 3 ++- src/librustc_trans/lib.rs | 2 +- src/libserialize/lib.rs | 4 ++-- src/libstd/ascii.rs | 6 +----- src/libstd/collections/hash/map.rs | 25 ++++++++++++------------- src/libstd/collections/hash/set.rs | 14 ++++++++------ src/libstd/collections/hash/state.rs | 4 ++-- src/libstd/collections/mod.rs | 2 +- src/libstd/dynamic_lib.rs | 4 +++- src/libstd/ffi/c_str.rs | 1 - src/libstd/io/error.rs | 2 +- src/libstd/lib.rs | 2 +- src/libstd/macros.rs | 6 ++---- src/libstd/num/f32.rs | 28 +++++++++++++++------------- src/libstd/num/f64.rs | 16 ++++++++-------- src/libstd/num/float_macros.rs | 1 - src/libstd/num/int_macros.rs | 1 - src/libstd/num/uint_macros.rs | 1 - src/libstd/panicking.rs | 2 -- src/libstd/rt/mod.rs | 4 +++- src/libstd/rtdeps.rs | 2 -- src/libstd/sync/future.rs | 2 +- src/libstd/sync/mpsc/mpsc_queue.rs | 2 -- src/libstd/sync/mpsc/select.rs | 6 +++--- src/libstd/sync/mpsc/spsc_queue.rs | 2 -- src/libstd/sync/mutex.rs | 19 ++++++------------- src/libstd/sync/once.rs | 2 +- src/libstd/sync/rwlock.rs | 22 ++++++---------------- src/libstd/sync/semaphore.rs | 2 +- src/libstd/sys/common/poison.rs | 8 ++++---- src/libstd/thread/local.rs | 4 ++-- src/libstd/thunk.rs | 2 +- src/libterm/lib.rs | 2 +- 35 files changed, 92 insertions(+), 117 deletions(-) diff --git a/src/libcollections/btree/map.rs b/src/libcollections/btree/map.rs index 127f470c9aaae..95a6fe14ef60c 100644 --- a/src/libcollections/btree/map.rs +++ b/src/libcollections/btree/map.rs @@ -1151,7 +1151,7 @@ impl<'a, K, V> DoubleEndedIterator for RangeMut<'a, K, V> { } impl<'a, K: Ord, V> Entry<'a, K, V> { - #[unstable(feature = "std_misc", + #[unstable(feature = "entry", reason = "will soon be replaced by or_insert")] #[deprecated(since = "1.0", reason = "replaced with more ergonomic `or_insert` and `or_insert_with`")] diff --git a/src/liblog/lib.rs b/src/liblog/lib.rs index 0238bf1f4be18..246b59098658a 100644 --- a/src/liblog/lib.rs +++ b/src/liblog/lib.rs @@ -173,8 +173,10 @@ #![feature(box_syntax)] #![feature(const_fn)] #![feature(iter_cmp)] +#![feature(once_new)] +#![feature(rt)] #![feature(staged_api)] -#![feature(std_misc)] +#![feature(static_mutex)] use std::boxed; use std::cell::RefCell; diff --git a/src/librustc/lib.rs b/src/librustc/lib.rs index 49667bf74cf2c..b557b0f564941 100644 --- a/src/librustc/lib.rs +++ b/src/librustc/lib.rs @@ -34,9 +34,11 @@ #![feature(const_fn)] #![feature(duration)] #![feature(duration_span)] +#![feature(dynamic_lib)] #![feature(enumset)] #![feature(fs_canonicalize)] #![feature(hash_default)] +#![feature(hashmap_hasher)] #![feature(into_cow)] #![feature(iter_sum)] #![feature(libc)] @@ -53,7 +55,6 @@ #![feature(slice_patterns)] #![feature(slice_position_elem)] #![feature(staged_api)] -#![feature(std_misc)] #![feature(str_char)] #![feature(str_matches)] #![feature(vec_push_all)] diff --git a/src/librustc_trans/lib.rs b/src/librustc_trans/lib.rs index 5ace77284953a..978fa4e745b99 100644 --- a/src/librustc_trans/lib.rs +++ b/src/librustc_trans/lib.rs @@ -33,6 +33,7 @@ #![feature(iter_sum)] #![feature(iter_unfold)] #![feature(libc)] +#![feature(once_new)] #![feature(path_ext)] #![feature(path_ext)] #![feature(path_relative_from)] @@ -42,7 +43,6 @@ #![feature(rustc_diagnostic_macros)] #![feature(rustc_private)] #![feature(staged_api)] -#![feature(std_misc)] #![feature(unicode)] #![feature(unicode)] #![feature(vec_push_all)] diff --git a/src/libserialize/lib.rs b/src/libserialize/lib.rs index 7fdab8789158e..5951e4f823e7c 100644 --- a/src/libserialize/lib.rs +++ b/src/libserialize/lib.rs @@ -29,15 +29,15 @@ Core encoding and decoding interfaces. #![feature(box_syntax)] #![feature(collections)] +#![feature(enumset)] +#![feature(hashmap_hasher)] #![feature(num_bits_bytes)] #![feature(num_wrapping)] #![feature(rustc_private)] #![feature(staged_api)] -#![feature(std_misc)] #![feature(str_char)] #![feature(unicode)] #![feature(vecmap)] -#![feature(enumset)] #![cfg_attr(test, feature(test))] // test harness access diff --git a/src/libstd/ascii.rs b/src/libstd/ascii.rs index b808acb73a12a..9b94b7f7003ed 100644 --- a/src/libstd/ascii.rs +++ b/src/libstd/ascii.rs @@ -18,7 +18,7 @@ use ops::Range; use mem; /// Extension methods for ASCII-subset only operations on owned strings -#[unstable(feature = "std_misc", +#[unstable(feature = "owned_ascii_ext", reason = "would prefer to do this in a more general way")] pub trait OwnedAsciiExt { /// Converts the string to ASCII upper case: @@ -189,8 +189,6 @@ impl AsciiExt for str { } } -#[unstable(feature = "std_misc", - reason = "would prefer to do this in a more general way")] impl OwnedAsciiExt for String { #[inline] fn into_ascii_uppercase(self) -> String { @@ -244,8 +242,6 @@ impl AsciiExt for [u8] { } } -#[unstable(feature = "std_misc", - reason = "would prefer to do this in a more general way")] impl OwnedAsciiExt for Vec { #[inline] fn into_ascii_uppercase(mut self) -> Vec { diff --git a/src/libstd/collections/hash/map.rs b/src/libstd/collections/hash/map.rs index e12814bf77c7c..1dca3b77f3880 100644 --- a/src/libstd/collections/hash/map.rs +++ b/src/libstd/collections/hash/map.rs @@ -43,8 +43,7 @@ use super::table::BucketState::{ use super::state::HashState; const INITIAL_LOG2_CAP: usize = 5; -#[unstable(feature = "std_misc")] -pub const INITIAL_CAPACITY: usize = 1 << INITIAL_LOG2_CAP; // 2^5 +const INITIAL_CAPACITY: usize = 1 << INITIAL_LOG2_CAP; // 2^5 /// The default behavior of HashMap implements a load factor of 90.9%. /// This behavior is characterized by the following condition: @@ -544,7 +543,7 @@ impl HashMap /// # Examples /// /// ``` - /// # #![feature(std_misc)] + /// # #![feature(hashmap_hasher)] /// use std::collections::HashMap; /// use std::collections::hash_map::RandomState; /// @@ -553,7 +552,7 @@ impl HashMap /// map.insert(1, 2); /// ``` #[inline] - #[unstable(feature = "std_misc", reason = "hasher stuff is unclear")] + #[unstable(feature = "hashmap_hasher", reason = "hasher stuff is unclear")] pub fn with_hash_state(hash_state: S) -> HashMap { HashMap { hash_state: hash_state, @@ -573,7 +572,7 @@ impl HashMap /// # Examples /// /// ``` - /// # #![feature(std_misc)] + /// # #![feature(hashmap_hasher)] /// use std::collections::HashMap; /// use std::collections::hash_map::RandomState; /// @@ -582,7 +581,7 @@ impl HashMap /// map.insert(1, 2); /// ``` #[inline] - #[unstable(feature = "std_misc", reason = "hasher stuff is unclear")] + #[unstable(feature = "hashmap_hasher", reason = "hasher stuff is unclear")] pub fn with_capacity_and_hash_state(capacity: usize, hash_state: S) -> HashMap { let resize_policy = DefaultResizePolicy::new(); @@ -980,7 +979,7 @@ impl HashMap /// # Examples /// /// ``` - /// # #![feature(std_misc)] + /// # #![feature(drain)] /// use std::collections::HashMap; /// /// let mut a = HashMap::new(); @@ -995,7 +994,7 @@ impl HashMap /// assert!(a.is_empty()); /// ``` #[inline] - #[unstable(feature = "std_misc", + #[unstable(feature = "drain", reason = "matches collection reform specification, waiting for dust to settle")] pub fn drain(&mut self) -> Drain { fn last_two((_, b, c): (A, B, C)) -> (B, C) { (b, c) } @@ -1308,7 +1307,7 @@ impl<'a, K, V> Clone for Values<'a, K, V> { } /// HashMap drain iterator. -#[unstable(feature = "std_misc", +#[unstable(feature = "drain", reason = "matches collection reform specification, waiting for dust to settle")] pub struct Drain<'a, K: 'a, V: 'a> { inner: iter::Map, fn((SafeHash, K, V)) -> (K, V)> @@ -1480,7 +1479,7 @@ impl<'a, K, V> ExactSizeIterator for Drain<'a, K, V> { } impl<'a, K, V> Entry<'a, K, V> { - #[unstable(feature = "std_misc", + #[unstable(feature = "entry", reason = "will soon be replaced by or_insert")] #[deprecated(since = "1.0", reason = "replaced with more ergonomic `or_insert` and `or_insert_with`")] @@ -1596,14 +1595,14 @@ impl Extend<(K, V)> for HashMap /// `Hasher`, but the hashers created by two different `RandomState` /// instances are unlikely to produce the same result for the same values. #[derive(Clone)] -#[unstable(feature = "std_misc", +#[unstable(feature = "hashmap_hasher", reason = "hashing an hash maps may be altered")] pub struct RandomState { k0: u64, k1: u64, } -#[unstable(feature = "std_misc", +#[unstable(feature = "hashmap_hasher", reason = "hashing an hash maps may be altered")] impl RandomState { /// Constructs a new `RandomState` that is initialized with random keys. @@ -1615,7 +1614,7 @@ impl RandomState { } } -#[unstable(feature = "std_misc", +#[unstable(feature = "hashmap_hasher", reason = "hashing an hash maps may be altered")] impl HashState for RandomState { type Hasher = SipHasher; diff --git a/src/libstd/collections/hash/set.rs b/src/libstd/collections/hash/set.rs index c31a46ada3287..ba50b156ab230 100644 --- a/src/libstd/collections/hash/set.rs +++ b/src/libstd/collections/hash/set.rs @@ -20,9 +20,11 @@ use iter::{Iterator, IntoIterator, ExactSizeIterator, FromIterator, Map, Chain, use ops::{BitOr, BitAnd, BitXor, Sub}; use option::Option::{Some, None, self}; -use super::map::{self, HashMap, Keys, INITIAL_CAPACITY, RandomState}; +use super::map::{self, HashMap, Keys, RandomState}; use super::state::HashState; +const INITIAL_CAPACITY: usize = 32; + // Future Optimization (FIXME!) // ============================= // @@ -152,7 +154,7 @@ impl HashSet /// # Examples /// /// ``` - /// # #![feature(std_misc)] + /// # #![feature(hashmap_hasher)] /// use std::collections::HashSet; /// use std::collections::hash_map::RandomState; /// @@ -161,7 +163,7 @@ impl HashSet /// set.insert(2); /// ``` #[inline] - #[unstable(feature = "std_misc", reason = "hasher stuff is unclear")] + #[unstable(feature = "hashmap_hasher", reason = "hasher stuff is unclear")] pub fn with_hash_state(hash_state: S) -> HashSet { HashSet::with_capacity_and_hash_state(INITIAL_CAPACITY, hash_state) } @@ -177,7 +179,7 @@ impl HashSet /// # Examples /// /// ``` - /// # #![feature(std_misc)] + /// # #![feature(hashmap_hasher)] /// use std::collections::HashSet; /// use std::collections::hash_map::RandomState; /// @@ -186,7 +188,7 @@ impl HashSet /// set.insert(1); /// ``` #[inline] - #[unstable(feature = "std_misc", reason = "hasher stuff is unclear")] + #[unstable(feature = "hashmap_hasher", reason = "hasher stuff is unclear")] pub fn with_capacity_and_hash_state(capacity: usize, hash_state: S) -> HashSet { HashSet { @@ -406,7 +408,7 @@ impl HashSet /// Clears the set, returning all elements in an iterator. #[inline] - #[unstable(feature = "std_misc", + #[unstable(feature = "drain", reason = "matches collection reform specification, waiting for dust to settle")] pub fn drain(&mut self) -> Drain { fn first((a, _): (A, B)) -> A { a } diff --git a/src/libstd/collections/hash/state.rs b/src/libstd/collections/hash/state.rs index 3a06d2d03bf3f..365e6268b3b0d 100644 --- a/src/libstd/collections/hash/state.rs +++ b/src/libstd/collections/hash/state.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +#![unstable(feature = "hashmap_hasher", reason = "hasher stuff is unclear")] + use clone::Clone; use default::Default; use hash; @@ -25,7 +27,6 @@ use marker; /// algorithm can implement the `Default` trait and create hash maps with the /// `DefaultState` structure. This state is 0-sized and will simply delegate /// to `Default` when asked to create a hasher. -#[unstable(feature = "std_misc", reason = "hasher stuff is unclear")] pub trait HashState { /// Type of the hasher that will be created. type Hasher: hash::Hasher; @@ -38,7 +39,6 @@ pub trait HashState { /// default trait. /// /// This struct has is 0-sized and does not need construction. -#[unstable(feature = "std_misc", reason = "hasher stuff is unclear")] pub struct DefaultState(marker::PhantomData); impl HashState for DefaultState { diff --git a/src/libstd/collections/mod.rs b/src/libstd/collections/mod.rs index 4781f2b47548f..3f0b223b9977a 100644 --- a/src/libstd/collections/mod.rs +++ b/src/libstd/collections/mod.rs @@ -410,7 +410,7 @@ pub mod hash_set { /// Experimental support for providing custom hash algorithms to a HashMap and /// HashSet. -#[unstable(feature = "std_misc", reason = "module was recently added")] +#[unstable(feature = "hashmap_hasher", reason = "module was recently added")] pub mod hash_state { pub use super::hash::state::*; } diff --git a/src/libstd/dynamic_lib.rs b/src/libstd/dynamic_lib.rs index 1c8e52f1b5361..ddafe416305e1 100644 --- a/src/libstd/dynamic_lib.rs +++ b/src/libstd/dynamic_lib.rs @@ -12,7 +12,9 @@ //! //! A simple wrapper over the platform's dynamic library facilities -#![unstable(feature = "std_misc")] +#![unstable(feature = "dynamic_lib", + reason = "API has not been scrutinized and is highly likely to \ + either disappear or change")] #![allow(missing_docs)] use prelude::v1::*; diff --git a/src/libstd/ffi/c_str.rs b/src/libstd/ffi/c_str.rs index 433bb335a805b..d5df9b3aa72b2 100644 --- a/src/libstd/ffi/c_str.rs +++ b/src/libstd/ffi/c_str.rs @@ -8,7 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![unstable(feature = "std_misc")] use borrow::{Cow, ToOwned}; use boxed::{self, Box}; diff --git a/src/libstd/io/error.rs b/src/libstd/io/error.rs index c4e472f158edf..b43ac0daf5127 100644 --- a/src/libstd/io/error.rs +++ b/src/libstd/io/error.rs @@ -123,7 +123,7 @@ pub enum ErrorKind { Other, /// Any I/O error not part of this list. - #[unstable(feature = "std_misc", + #[unstable(feature = "io_error_internals", reason = "better expressed through extensible enums that this \ enum cannot be exhaustively matched against")] #[doc(hidden)] diff --git a/src/libstd/lib.rs b/src/libstd/lib.rs index 20211f87689b6..fb510ed678271 100644 --- a/src/libstd/lib.rs +++ b/src/libstd/lib.rs @@ -150,7 +150,7 @@ #![feature(wrapping)] #![feature(zero_one)] #![cfg_attr(test, feature(float_from_str_radix))] -#![cfg_attr(test, feature(test, rustc_private, std_misc))] +#![cfg_attr(test, feature(test, rustc_private))] // Don't link to std. We are std. #![no_std] diff --git a/src/libstd/macros.rs b/src/libstd/macros.rs index 706571b67c9ac..749974c7afab0 100644 --- a/src/libstd/macros.rs +++ b/src/libstd/macros.rs @@ -14,8 +14,6 @@ //! library. Each macro is available for use when linking against the standard //! library. -#![unstable(feature = "std_misc")] - /// The entry point for panic of Rust threads. /// /// This macro is used to inject panic into a Rust thread, causing the thread to @@ -165,7 +163,7 @@ macro_rules! try { /// # Examples /// /// ``` -/// # #![feature(std_misc)] +/// # #![feature(mpsc_select)] /// use std::thread; /// use std::sync::mpsc; /// @@ -191,7 +189,7 @@ macro_rules! try { /// /// For more information about select, see the `std::sync::mpsc::Select` structure. #[macro_export] -#[unstable(feature = "std_misc")] +#[unstable(feature = "mpsc_select")] macro_rules! select { ( $($name:pat = $rx:ident.$meth:ident() => $code:expr),+ diff --git a/src/libstd/num/f32.rs b/src/libstd/num/f32.rs index c22f5d073de89..0c40f6c1fc8a8 100644 --- a/src/libstd/num/f32.rs +++ b/src/libstd/num/f32.rs @@ -194,7 +194,7 @@ impl f32 { /// The floating point encoding is documented in the [Reference][floating-point]. /// /// ``` - /// # #![feature(std_misc)] + /// # #![feature(float_extras)] /// use std::f32; /// /// let num = 2.0f32; @@ -211,9 +211,11 @@ impl f32 { /// assert!(abs_difference <= f32::EPSILON); /// ``` /// [floating-point]: ../../../../../reference.html#machine-types - #[unstable(feature = "std_misc", reason = "signature is undecided")] + #[unstable(feature = "float_extras", reason = "signature is undecided")] #[inline] - pub fn integer_decode(self) -> (u64, i16, i8) { num::Float::integer_decode(self) } + pub fn integer_decode(self) -> (u64, i16, i8) { + num::Float::integer_decode(self) + } /// Returns the largest integer less than or equal to a number. /// @@ -555,7 +557,7 @@ impl f32 { /// Converts radians to degrees. /// /// ``` - /// # #![feature(std_misc)] + /// # #![feature(float_extras)] /// use std::f32::{self, consts}; /// /// let angle = consts::PI; @@ -564,14 +566,14 @@ impl f32 { /// /// assert!(abs_difference <= f32::EPSILON); /// ``` - #[unstable(feature = "std_misc", reason = "desirability is unclear")] + #[unstable(feature = "float_extras", reason = "desirability is unclear")] #[inline] pub fn to_degrees(self) -> f32 { num::Float::to_degrees(self) } /// Converts degrees to radians. /// /// ``` - /// # #![feature(std_misc)] + /// # #![feature(float_extras)] /// use std::f32::{self, consts}; /// /// let angle = 180.0f32; @@ -580,21 +582,21 @@ impl f32 { /// /// assert!(abs_difference <= f32::EPSILON); /// ``` - #[unstable(feature = "std_misc", reason = "desirability is unclear")] + #[unstable(feature = "float_extras", reason = "desirability is unclear")] #[inline] pub fn to_radians(self) -> f32 { num::Float::to_radians(self) } /// Constructs a floating point number of `x*2^exp`. /// /// ``` - /// # #![feature(std_misc)] + /// # #![feature(float_extras)] /// use std::f32; /// // 3*2^2 - 12 == 0 /// let abs_difference = (f32::ldexp(3.0, 2) - 12.0).abs(); /// /// assert!(abs_difference <= f32::EPSILON); /// ``` - #[unstable(feature = "std_misc", + #[unstable(feature = "float_extras", reason = "pending integer conventions")] #[inline] pub fn ldexp(x: f32, exp: isize) -> f32 { @@ -608,7 +610,7 @@ impl f32 { /// * `0.5 <= abs(x) < 1.0` /// /// ``` - /// # #![feature(std_misc)] + /// # #![feature(float_extras)] /// use std::f32; /// /// let x = 4.0f32; @@ -621,7 +623,7 @@ impl f32 { /// assert!(abs_difference_0 <= f32::EPSILON); /// assert!(abs_difference_1 <= f32::EPSILON); /// ``` - #[unstable(feature = "std_misc", + #[unstable(feature = "float_extras", reason = "pending integer conventions")] #[inline] pub fn frexp(self) -> (f32, isize) { @@ -636,7 +638,7 @@ impl f32 { /// `other`. /// /// ``` - /// # #![feature(std_misc)] + /// # #![feature(float_extras)] /// use std::f32; /// /// let x = 1.0f32; @@ -645,7 +647,7 @@ impl f32 { /// /// assert!(abs_diff <= f32::EPSILON); /// ``` - #[unstable(feature = "std_misc", + #[unstable(feature = "float_extras", reason = "unsure about its place in the world")] #[inline] pub fn next_after(self, other: f32) -> f32 { diff --git a/src/libstd/num/f64.rs b/src/libstd/num/f64.rs index cde0b567ade0f..41c0fcb9797a6 100644 --- a/src/libstd/num/f64.rs +++ b/src/libstd/num/f64.rs @@ -190,7 +190,7 @@ impl f64 { /// The floating point encoding is documented in the [Reference][floating-point]. /// /// ``` - /// # #![feature(std_misc)] + /// # #![feature(float_extras)] /// let num = 2.0f64; /// /// // (8388608, -22, 1) @@ -205,7 +205,7 @@ impl f64 { /// assert!(abs_difference < 1e-10); /// ``` /// [floating-point]: ../../../../../reference.html#machine-types - #[unstable(feature = "std_misc", reason = "signature is undecided")] + #[unstable(feature = "float_extras", reason = "signature is undecided")] #[inline] pub fn integer_decode(self) -> (u64, i16, i8) { num::Float::integer_decode(self) } @@ -567,13 +567,13 @@ impl f64 { /// Constructs a floating point number of `x*2^exp`. /// /// ``` - /// # #![feature(std_misc)] + /// # #![feature(float_extras)] /// // 3*2^2 - 12 == 0 /// let abs_difference = (f64::ldexp(3.0, 2) - 12.0).abs(); /// /// assert!(abs_difference < 1e-10); /// ``` - #[unstable(feature = "std_misc", + #[unstable(feature = "float_extras", reason = "pending integer conventions")] #[inline] pub fn ldexp(x: f64, exp: isize) -> f64 { @@ -587,7 +587,7 @@ impl f64 { /// * `0.5 <= abs(x) < 1.0` /// /// ``` - /// # #![feature(std_misc)] + /// # #![feature(float_extras)] /// let x = 4.0_f64; /// /// // (1/2)*2^3 -> 1 * 8/2 -> 4.0 @@ -598,7 +598,7 @@ impl f64 { /// assert!(abs_difference_0 < 1e-10); /// assert!(abs_difference_1 < 1e-10); /// ``` - #[unstable(feature = "std_misc", + #[unstable(feature = "float_extras", reason = "pending integer conventions")] #[inline] pub fn frexp(self) -> (f64, isize) { @@ -613,7 +613,7 @@ impl f64 { /// `other`. /// /// ``` - /// # #![feature(std_misc)] + /// # #![feature(float_extras)] /// /// let x = 1.0f32; /// @@ -621,7 +621,7 @@ impl f64 { /// /// assert!(abs_diff < 1e-10); /// ``` - #[unstable(feature = "std_misc", + #[unstable(feature = "float_extras", reason = "unsure about its place in the world")] #[inline] pub fn next_after(self, other: f64) -> f64 { diff --git a/src/libstd/num/float_macros.rs b/src/libstd/num/float_macros.rs index 60a548b596b1c..16ad21a07d700 100644 --- a/src/libstd/num/float_macros.rs +++ b/src/libstd/num/float_macros.rs @@ -8,7 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![unstable(feature = "std_misc")] #![doc(hidden)] macro_rules! assert_approx_eq { diff --git a/src/libstd/num/int_macros.rs b/src/libstd/num/int_macros.rs index af1976d575093..178fad09f9881 100644 --- a/src/libstd/num/int_macros.rs +++ b/src/libstd/num/int_macros.rs @@ -8,7 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![unstable(feature = "std_misc")] #![doc(hidden)] macro_rules! int_module { ($T:ty) => ( diff --git a/src/libstd/num/uint_macros.rs b/src/libstd/num/uint_macros.rs index 96b0ba1c77f8d..555a5cc3e20e9 100644 --- a/src/libstd/num/uint_macros.rs +++ b/src/libstd/num/uint_macros.rs @@ -8,7 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![unstable(feature = "std_misc")] #![doc(hidden)] #![allow(unsigned_negation)] diff --git a/src/libstd/panicking.rs b/src/libstd/panicking.rs index 01588843591f3..b584658fb07e7 100644 --- a/src/libstd/panicking.rs +++ b/src/libstd/panicking.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![unstable(feature = "std_misc")] - use prelude::v1::*; use io::prelude::*; diff --git a/src/libstd/rt/mod.rs b/src/libstd/rt/mod.rs index 0d26206f26bcf..1b8e81e2b7913 100644 --- a/src/libstd/rt/mod.rs +++ b/src/libstd/rt/mod.rs @@ -16,7 +16,9 @@ //! and should be considered as private implementation details for the //! time being. -#![unstable(feature = "std_misc")] +#![unstable(feature = "rt", + reason = "this public module should not exist and is highly likely \ + to disappear")] #![allow(missing_docs)] use prelude::v1::*; diff --git a/src/libstd/rtdeps.rs b/src/libstd/rtdeps.rs index a7f3bc2bdc82c..be674c83e2213 100644 --- a/src/libstd/rtdeps.rs +++ b/src/libstd/rtdeps.rs @@ -12,8 +12,6 @@ //! the standard library This varies per-platform, but these libraries are //! necessary for running libstd. -#![unstable(feature = "std_misc")] - // All platforms need to link to rustrt #[cfg(not(test))] #[link(name = "rust_builtin", kind = "static")] diff --git a/src/libstd/sync/future.rs b/src/libstd/sync/future.rs index 2d281eb4e249c..76b07999280d0 100644 --- a/src/libstd/sync/future.rs +++ b/src/libstd/sync/future.rs @@ -28,7 +28,7 @@ //! ``` #![allow(missing_docs)] -#![unstable(feature = "std_misc", +#![unstable(feature = "future", reason = "futures as-is have yet to be deeply reevaluated with recent \ core changes to Rust's synchronization story, and will likely \ become stable in the future but are unstable until that time")] diff --git a/src/libstd/sync/mpsc/mpsc_queue.rs b/src/libstd/sync/mpsc/mpsc_queue.rs index 2c0da938cbf8b..f3edf0d68c759 100644 --- a/src/libstd/sync/mpsc/mpsc_queue.rs +++ b/src/libstd/sync/mpsc/mpsc_queue.rs @@ -35,8 +35,6 @@ //! method, and see the method for more information about it. Due to this //! caveat, this queue may not be appropriate for all use-cases. -#![unstable(feature = "std_misc")] - // http://www.1024cores.net/home/lock-free-algorithms // /queues/non-intrusive-mpsc-node-based-queue diff --git a/src/libstd/sync/mpsc/select.rs b/src/libstd/sync/mpsc/select.rs index 679cc550454fa..a67138742aeeb 100644 --- a/src/libstd/sync/mpsc/select.rs +++ b/src/libstd/sync/mpsc/select.rs @@ -27,7 +27,7 @@ //! # Examples //! //! ```rust -//! # #![feature(std_misc)] +//! # #![feature(mpsc_select)] //! use std::sync::mpsc::channel; //! //! let (tx1, rx1) = channel(); @@ -47,7 +47,7 @@ //! ``` #![allow(dead_code)] -#![unstable(feature = "std_misc", +#![unstable(feature = "mpsc_select", reason = "This implementation, while likely sufficient, is unsafe and \ likely to be error prone. At some point in the future this \ module will likely be replaced, and it is currently \ @@ -124,7 +124,7 @@ impl Select { /// # Examples /// /// ``` - /// # #![feature(std_misc)] + /// # #![feature(mpsc_select)] /// use std::sync::mpsc::Select; /// /// let select = Select::new(); diff --git a/src/libstd/sync/mpsc/spsc_queue.rs b/src/libstd/sync/mpsc/spsc_queue.rs index a0ed52d4d3c87..770068a66bec6 100644 --- a/src/libstd/sync/mpsc/spsc_queue.rs +++ b/src/libstd/sync/mpsc/spsc_queue.rs @@ -33,8 +33,6 @@ //! concurrently between two threads. This data structure is safe to use and //! enforces the semantics that there is one pusher and one popper. -#![unstable(feature = "std_misc")] - use core::prelude::*; use alloc::boxed; diff --git a/src/libstd/sync/mutex.rs b/src/libstd/sync/mutex.rs index fd22d723ebdb1..5f77ee2054591 100644 --- a/src/libstd/sync/mutex.rs +++ b/src/libstd/sync/mutex.rs @@ -85,7 +85,6 @@ use sys_common::poison::{self, TryLockError, TryLockResult, LockResult}; /// To recover from a poisoned mutex: /// /// ``` -/// # #![feature(std_misc)] /// use std::sync::{Arc, Mutex}; /// use std::thread; /// @@ -139,7 +138,7 @@ unsafe impl Sync for Mutex { } /// # Examples /// /// ``` -/// # #![feature(std_misc)] +/// # #![feature(static_mutex)] /// use std::sync::{StaticMutex, MUTEX_INIT}; /// /// static LOCK: StaticMutex = MUTEX_INIT; @@ -150,7 +149,7 @@ unsafe impl Sync for Mutex { } /// } /// // lock is unlocked here. /// ``` -#[unstable(feature = "std_misc", +#[unstable(feature = "static_mutex", reason = "may be merged with Mutex in the future")] pub struct StaticMutex { lock: sys::Mutex, @@ -176,7 +175,7 @@ impl<'a, T: ?Sized> !marker::Send for MutexGuard<'a, T> {} /// Static initialization of a mutex. This constant can be used to initialize /// other mutex constants. -#[unstable(feature = "std_misc", +#[unstable(feature = "static_mutex", reason = "may be merged with Mutex in the future")] pub const MUTEX_INIT: StaticMutex = StaticMutex::new(); @@ -237,7 +236,7 @@ impl Mutex { /// time. You should not trust a `false` value for program correctness /// without additional synchronization. #[inline] - #[unstable(feature = "std_misc")] + #[unstable(feature = "sync_poison")] pub fn is_poisoned(&self) -> bool { self.inner.poison.get() } @@ -270,10 +269,10 @@ struct Dummy(UnsafeCell<()>); unsafe impl Sync for Dummy {} static DUMMY: Dummy = Dummy(UnsafeCell::new(())); +#[unstable(feature = "static_mutex", + reason = "may be merged with Mutex in the future")] impl StaticMutex { /// Creates a new mutex in an unlocked state ready for use. - #[unstable(feature = "std_misc", - reason = "may be merged with Mutex in the future")] pub const fn new() -> StaticMutex { StaticMutex { lock: sys::Mutex::new(), @@ -283,8 +282,6 @@ impl StaticMutex { /// Acquires this lock, see `Mutex::lock` #[inline] - #[unstable(feature = "std_misc", - reason = "may be merged with Mutex in the future")] pub fn lock(&'static self) -> LockResult> { unsafe { self.lock.lock() } MutexGuard::new(self, &DUMMY.0) @@ -292,8 +289,6 @@ impl StaticMutex { /// Attempts to grab this lock, see `Mutex::try_lock` #[inline] - #[unstable(feature = "std_misc", - reason = "may be merged with Mutex in the future")] pub fn try_lock(&'static self) -> TryLockResult> { if unsafe { self.lock.try_lock() } { Ok(try!(MutexGuard::new(self, &DUMMY.0))) @@ -312,8 +307,6 @@ impl StaticMutex { /// *all* platforms. It may be the case that some platforms do not leak /// memory if this method is not called, but this is not guaranteed to be /// true on all platforms. - #[unstable(feature = "std_misc", - reason = "may be merged with Mutex in the future")] pub unsafe fn destroy(&'static self) { self.lock.destroy() } diff --git a/src/libstd/sync/once.rs b/src/libstd/sync/once.rs index 269affff20855..1e0aa271b4dcd 100644 --- a/src/libstd/sync/once.rs +++ b/src/libstd/sync/once.rs @@ -48,7 +48,7 @@ pub const ONCE_INIT: Once = Once::new(); impl Once { /// Creates a new `Once` value. - #[unstable(feature = "std_misc")] + #[unstable(feature = "once_new")] pub const fn new() -> Once { Once { mutex: StaticMutex::new(), diff --git a/src/libstd/sync/rwlock.rs b/src/libstd/sync/rwlock.rs index 857d8889b7c25..5a6bf987fd717 100644 --- a/src/libstd/sync/rwlock.rs +++ b/src/libstd/sync/rwlock.rs @@ -81,7 +81,7 @@ unsafe impl Sync for RwLock {} /// # Examples /// /// ``` -/// # #![feature(std_misc)] +/// # #![feature(static_rwlock)] /// use std::sync::{StaticRwLock, RW_LOCK_INIT}; /// /// static LOCK: StaticRwLock = RW_LOCK_INIT; @@ -96,7 +96,7 @@ unsafe impl Sync for RwLock {} /// } /// unsafe { LOCK.destroy() } // free all resources /// ``` -#[unstable(feature = "std_misc", +#[unstable(feature = "static_rwlock", reason = "may be merged with RwLock in the future")] pub struct StaticRwLock { lock: sys::RWLock, @@ -104,7 +104,7 @@ pub struct StaticRwLock { } /// Constant initialization for a statically-initialized rwlock. -#[unstable(feature = "std_misc", +#[unstable(feature = "static_rwlock", reason = "may be merged with RwLock in the future")] pub const RW_LOCK_INIT: StaticRwLock = StaticRwLock::new(); @@ -253,7 +253,7 @@ impl RwLock { /// time. You should not trust a `false` value for program correctness /// without additional synchronization. #[inline] - #[unstable(feature = "std_misc")] + #[unstable(feature = "sync_poison")] pub fn is_poisoned(&self) -> bool { self.inner.poison.get() } @@ -283,10 +283,10 @@ struct Dummy(UnsafeCell<()>); unsafe impl Sync for Dummy {} static DUMMY: Dummy = Dummy(UnsafeCell::new(())); +#[unstable(feature = "static_rwlock", + reason = "may be merged with RwLock in the future")] impl StaticRwLock { /// Creates a new rwlock. - #[unstable(feature = "std_misc", - reason = "may be merged with RwLock in the future")] pub const fn new() -> StaticRwLock { StaticRwLock { lock: sys::RWLock::new(), @@ -299,8 +299,6 @@ impl StaticRwLock { /// /// See `RwLock::read`. #[inline] - #[unstable(feature = "std_misc", - reason = "may be merged with RwLock in the future")] pub fn read(&'static self) -> LockResult> { unsafe { self.lock.read() } RwLockReadGuard::new(self, &DUMMY.0) @@ -310,8 +308,6 @@ impl StaticRwLock { /// /// See `RwLock::try_read`. #[inline] - #[unstable(feature = "std_misc", - reason = "may be merged with RwLock in the future")] pub fn try_read(&'static self) -> TryLockResult> { if unsafe { self.lock.try_read() } { @@ -326,8 +322,6 @@ impl StaticRwLock { /// /// See `RwLock::write`. #[inline] - #[unstable(feature = "std_misc", - reason = "may be merged with RwLock in the future")] pub fn write(&'static self) -> LockResult> { unsafe { self.lock.write() } RwLockWriteGuard::new(self, &DUMMY.0) @@ -337,8 +331,6 @@ impl StaticRwLock { /// /// See `RwLock::try_write`. #[inline] - #[unstable(feature = "std_misc", - reason = "may be merged with RwLock in the future")] pub fn try_write(&'static self) -> TryLockResult> { if unsafe { self.lock.try_write() } { @@ -354,8 +346,6 @@ impl StaticRwLock { /// active users of the lock, and this also doesn't prevent any future users /// of this lock. This method is required to be called to not leak memory on /// all platforms. - #[unstable(feature = "std_misc", - reason = "may be merged with RwLock in the future")] pub unsafe fn destroy(&'static self) { self.lock.destroy() } diff --git a/src/libstd/sync/semaphore.rs b/src/libstd/sync/semaphore.rs index 776b3c5064ced..0278a6c95b982 100644 --- a/src/libstd/sync/semaphore.rs +++ b/src/libstd/sync/semaphore.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![unstable(feature = "std_misc", +#![unstable(feature = "semaphore", reason = "the interaction between semaphores and the acquisition/release \ of resources is currently unclear")] diff --git a/src/libstd/sys/common/poison.rs b/src/libstd/sys/common/poison.rs index 48c8198272588..75f85879fd1f4 100644 --- a/src/libstd/sys/common/poison.rs +++ b/src/libstd/sys/common/poison.rs @@ -120,24 +120,24 @@ impl Error for PoisonError { impl PoisonError { /// Creates a `PoisonError`. - #[unstable(feature = "std_misc")] + #[unstable(feature = "sync_poison")] pub fn new(guard: T) -> PoisonError { PoisonError { guard: guard } } /// Consumes this error indicating that a lock is poisoned, returning the /// underlying guard to allow access regardless. - #[unstable(feature = "std_misc")] + #[unstable(feature = "sync_poison")] pub fn into_inner(self) -> T { self.guard } /// Reaches into this error indicating that a lock is poisoned, returning a /// reference to the underlying guard to allow access regardless. - #[unstable(feature = "std_misc")] + #[unstable(feature = "sync_poison")] pub fn get_ref(&self) -> &T { &self.guard } /// Reaches into this error indicating that a lock is poisoned, returning a /// mutable reference to the underlying guard to allow access regardless. - #[unstable(feature = "std_misc")] + #[unstable(feature = "sync_poi")] pub fn get_mut(&mut self) -> &mut T { &mut self.guard } } diff --git a/src/libstd/thread/local.rs b/src/libstd/thread/local.rs index 69a26cdc490f6..2b5e3fb18eb16 100644 --- a/src/libstd/thread/local.rs +++ b/src/libstd/thread/local.rs @@ -154,7 +154,7 @@ macro_rules! __thread_local_inner { } /// Indicator of the state of a thread local storage key. -#[unstable(feature = "std_misc", +#[unstable(feature = "thread_local_state", reason = "state querying was recently added")] #[derive(Eq, PartialEq, Copy, Clone)] pub enum LocalKeyState { @@ -249,7 +249,7 @@ impl LocalKey { /// initialization does not panic. Keys in the `Valid` state are guaranteed /// to be able to be accessed. Keys in the `Destroyed` state will panic on /// any call to `with`. - #[unstable(feature = "std_misc", + #[unstable(feature = "thread_local_state", reason = "state querying was recently added")] pub fn state(&'static self) -> LocalKeyState { unsafe { diff --git a/src/libstd/thunk.rs b/src/libstd/thunk.rs index 6091794ed4286..084893314a8e5 100644 --- a/src/libstd/thunk.rs +++ b/src/libstd/thunk.rs @@ -10,7 +10,7 @@ // Because this module is temporary... #![allow(missing_docs)] -#![unstable(feature = "std_misc")] +#![unstable(feature = "thunk")] use alloc::boxed::{Box, FnBox}; use core::marker::Send; diff --git a/src/libterm/lib.rs b/src/libterm/lib.rs index 3affb37ba5b9f..5131e0b34e380 100644 --- a/src/libterm/lib.rs +++ b/src/libterm/lib.rs @@ -56,10 +56,10 @@ #![deny(missing_docs)] #![feature(box_syntax)] +#![feature(owned_ascii_ext)] #![feature(path_ext)] #![feature(rustc_private)] #![feature(staged_api)] -#![feature(std_misc)] #![feature(str_char)] #![feature(vec_push_all)] #![cfg_attr(windows, feature(libc))] From ce1a965cf54ce65fc43b535c27029ce183214063 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Wed, 10 Jun 2015 13:33:52 -0700 Subject: [PATCH 05/31] Fallout in tests and docs from feature renamings --- src/compiletest/compiletest.rs | 11 +- src/liballoc/arc.rs | 20 +-- src/liballoc/boxed.rs | 8 +- src/liballoc/lib.rs | 2 +- src/liballoc/rc.rs | 33 +++-- src/libcollections/bit.rs | 125 +++++++++--------- src/libcollections/btree/map.rs | 4 +- src/libcollections/btree/set.rs | 2 +- src/libcollections/fmt.rs | 3 +- src/libcollections/lib.rs | 4 +- src/libcollections/linked_list.rs | 4 +- src/libcollections/slice.rs | 12 +- src/libcollections/str.rs | 16 +-- src/libcollections/vec.rs | 8 +- src/libcollections/vec_deque.rs | 18 +-- src/libcollections/vec_map.rs | 42 +++--- src/libcollectionstest/lib.rs | 45 +++++-- src/libcollectionstest/str.rs | 3 +- src/libcollectionstest/string.rs | 3 +- src/libcollectionstest/vec.rs | 3 + src/libcollectionstest/vec_deque.rs | 2 - src/libcore/cell.rs | 2 +- src/libcore/cmp.rs | 8 +- src/libcore/fmt/num.rs | 2 +- src/libcore/hash/mod.rs | 4 +- src/libcore/iter.rs | 18 +-- src/libcore/marker.rs | 2 +- src/libcore/option.rs | 2 +- src/libcore/ptr.rs | 2 +- src/libcore/raw.rs | 4 +- src/libcore/result.rs | 2 +- src/libcore/simd.rs | 2 +- src/libcoretest/lib.rs | 48 ++++--- src/libcoretest/option.rs | 4 +- src/libflate/lib.rs | 2 +- src/librand/lib.rs | 2 +- src/librustc/lib.rs | 3 +- src/librustc_bitflags/lib.rs | 2 +- src/librustc_driver/lib.rs | 1 - src/librustc_lint/lib.rs | 1 - src/librustc_trans/lib.rs | 2 +- src/librustc_typeck/lib.rs | 2 +- src/librustc_unicode/lib.rs | 2 +- src/librustdoc/lib.rs | 15 ++- src/libstd/lib.rs | 4 +- src/libstd/sync/future.rs | 2 +- src/libstd/sync/mutex.rs | 2 + src/libstd/sync/semaphore.rs | 2 +- src/libtest/lib.rs | 3 +- src/rustbook/main.rs | 2 +- src/test/auxiliary/linkage-visibility.rs | 2 +- src/test/bench/core-set.rs | 1 + src/test/bench/core-std.rs | 2 +- src/test/bench/msgsend-ring-mutex-arcs.rs | 2 +- src/test/bench/shootout-k-nucleotide.rs | 2 +- src/test/bench/shootout-mandelbrot.rs | 2 +- src/test/bench/shootout-meteor.rs | 2 +- src/test/bench/shootout-spectralnorm.rs | 5 +- src/test/bench/std-smallintmap.rs | 2 +- src/test/bench/task-perf-alloc-unwind.rs | 2 +- .../compile-fail/feature-gate-simd-ffi.rs | 2 +- src/test/compile-fail/lint-dead-code-4.rs | 9 +- .../compile-fail/lint-exceeding-bitshifts.rs | 2 +- src/test/debuginfo/constant-debug-locs.rs | 2 +- src/test/debuginfo/simd.rs | 2 +- src/test/run-make/extern-fn-reachable/main.rs | 2 +- .../intrinsic-unreachable/exit-unreachable.rs | 2 +- src/test/run-make/volatile-intrinsics/main.rs | 2 +- src/test/run-pass/binary-heap-panic-safe.rs | 2 +- src/test/run-pass/bitv-perf-test.rs | 10 +- src/test/run-pass/deriving-hash.rs | 2 +- src/test/run-pass/discriminant_value.rs | 2 +- src/test/run-pass/dst-coerce-custom.rs | 2 +- src/test/run-pass/enum-null-pointer-opt.rs | 3 +- src/test/run-pass/fat-ptr-cast.rs | 2 +- src/test/run-pass/for-loop-no-std.rs | 2 +- src/test/run-pass/format-no-std.rs | 2 - .../into-iterator-type-inference-shift.rs | 6 +- src/test/run-pass/intrinsic-assume.rs | 3 +- .../run-pass/intrinsic-move-val-cleanups.rs | 2 +- src/test/run-pass/intrinsic-unreachable.rs | 3 +- src/test/run-pass/issue-11709.rs | 2 +- src/test/run-pass/issue-11736.rs | 2 +- src/test/run-pass/issue-11958.rs | 2 +- src/test/run-pass/issue-13494.rs | 4 +- src/test/run-pass/issue-13763.rs | 2 +- src/test/run-pass/issue-15673.rs | 3 +- src/test/run-pass/issue-16530.rs | 3 +- src/test/run-pass/issue-17897.rs | 2 +- src/test/run-pass/issue-18188.rs | 2 +- src/test/run-pass/issue-21058.rs | 3 +- src/test/run-pass/issue-2190-1.rs | 2 +- src/test/run-pass/issue-23037.rs | 2 +- src/test/run-pass/issue-23550.rs | 2 +- src/test/run-pass/issue-6898.rs | 6 +- .../run-pass/iter-cloned-type-inference.rs | 3 +- src/test/run-pass/linkage-visibility.rs | 2 - ...thod-mut-self-modifies-mut-slice-lvalue.rs | 2 +- .../run-pass/minmax-stability-issue-23687.rs | 3 +- src/test/run-pass/new-box-syntax.rs | 4 +- src/test/run-pass/realloc-16687.rs | 2 +- src/test/run-pass/running-with-no-runtime.rs | 8 +- .../run-pass/send-is-not-static-par-for.rs | 2 - src/test/run-pass/simd-binop.rs | 2 +- src/test/run-pass/simd-issue-10604.rs | 3 +- .../run-pass/slice-of-zero-size-elements.rs | 2 +- .../run-pass/std-sync-right-kind-impls.rs | 3 +- .../sync-send-iterators-in-libcollections.rs | 4 +- .../sync-send-iterators-in-libcore.rs | 1 + src/test/run-pass/tydesc-name.rs | 2 +- src/test/run-pass/typeid-intrinsic.rs | 2 +- src/test/run-pass/ufcs-polymorphic-paths.rs | 3 +- src/test/run-pass/unfold-cross-crate.rs | 2 +- src/test/run-pass/unsized3.rs | 4 +- src/test/run-pass/vec-concat.rs | 2 +- src/test/run-pass/vec-macro-no-std.rs | 4 +- src/test/run-pass/vector-sort-panic-safe.rs | 2 +- src/test/run-pass/wrapping-int-api.rs | 2 +- 118 files changed, 364 insertions(+), 338 deletions(-) diff --git a/src/compiletest/compiletest.rs b/src/compiletest/compiletest.rs index 1471e30baa6b0..92a94d23f0842 100644 --- a/src/compiletest/compiletest.rs +++ b/src/compiletest/compiletest.rs @@ -11,13 +11,14 @@ #![crate_type = "bin"] #![feature(box_syntax)] -#![feature(collections)] -#![feature(rustc_private)] -#![feature(std_misc)] -#![feature(test)] +#![feature(dynamic_lib)] +#![feature(libc)] #![feature(path_ext)] +#![feature(rustc_private)] +#![feature(slice_extras)] #![feature(str_char)] -#![feature(libc)] +#![feature(test)] +#![feature(vec_push_all)] #![deny(warnings)] diff --git a/src/liballoc/arc.rs b/src/liballoc/arc.rs index e0d459d877fd2..c1ad367c234b3 100644 --- a/src/liballoc/arc.rs +++ b/src/liballoc/arc.rs @@ -191,7 +191,7 @@ impl Arc { /// # Examples /// /// ``` - /// # #![feature(alloc)] + /// # #![feature(arc_weak)] /// use std::sync::Arc; /// /// let five = Arc::new(5); @@ -236,12 +236,12 @@ impl Arc { /// Get the number of weak references to this value. #[inline] -#[unstable(feature = "arc_extras")] +#[unstable(feature = "arc_counts")] pub fn weak_count(this: &Arc) -> usize { this.inner().weak.load(SeqCst) - 1 } /// Get the number of strong references to this value. #[inline] -#[unstable(feature = "arc_extras")] +#[unstable(feature = "arc_counts")] pub fn strong_count(this: &Arc) -> usize { this.inner().strong.load(SeqCst) } @@ -255,7 +255,7 @@ pub fn strong_count(this: &Arc) -> usize { this.inner().strong.loa /// # Examples /// /// ``` -/// # #![feature(alloc)] +/// # #![feature(arc_unique, alloc)] /// extern crate alloc; /// # fn main() { /// use alloc::arc::{Arc, get_mut}; @@ -271,7 +271,7 @@ pub fn strong_count(this: &Arc) -> usize { this.inner().strong.loa /// # } /// ``` #[inline] -#[unstable(feature = "arc_extras")] +#[unstable(feature = "arc_unique")] pub unsafe fn get_mut(this: &mut Arc) -> Option<&mut T> { // FIXME(#24880) potential race with upgraded weak pointers here if strong_count(this) == 1 && weak_count(this) == 0 { @@ -342,7 +342,7 @@ impl Arc { /// # Examples /// /// ``` - /// # #![feature(alloc)] + /// # #![feature(arc_unique)] /// use std::sync::Arc; /// /// # unsafe { @@ -352,7 +352,7 @@ impl Arc { /// # } /// ``` #[inline] - #[unstable(feature = "arc_extras")] + #[unstable(feature = "arc_unique")] pub unsafe fn make_unique(&mut self) -> &mut T { // FIXME(#24880) potential race with upgraded weak pointers here // @@ -451,7 +451,7 @@ impl Weak { /// # Examples /// /// ``` - /// # #![feature(alloc)] + /// # #![feature(arc_weak)] /// use std::sync::Arc; /// /// let five = Arc::new(5); @@ -489,7 +489,7 @@ impl Clone for Weak { /// # Examples /// /// ``` - /// # #![feature(alloc)] + /// # #![feature(arc_weak)] /// use std::sync::Arc; /// /// let weak_five = Arc::new(5).downgrade(); @@ -513,7 +513,7 @@ impl Drop for Weak { /// # Examples /// /// ``` - /// # #![feature(alloc)] + /// # #![feature(arc_weak)] /// use std::sync::Arc; /// /// { diff --git a/src/liballoc/boxed.rs b/src/liballoc/boxed.rs index ffc4186dee8d9..b59a5685f0d8f 100644 --- a/src/liballoc/boxed.rs +++ b/src/liballoc/boxed.rs @@ -71,7 +71,7 @@ use core::raw::{TraitObject}; /// The following two examples are equivalent: /// /// ``` -/// # #![feature(alloc)] +/// # #![feature(box_heap)] /// #![feature(box_syntax)] /// use std::boxed::HEAP; /// @@ -139,7 +139,7 @@ impl Box { /// /// # Examples /// ``` -/// # #![feature(alloc)] +/// # #![feature(box_raw)] /// use std::boxed; /// /// let seventeen = Box::new(17u32); @@ -183,7 +183,7 @@ impl Clone for Box { /// # Examples /// /// ``` - /// # #![feature(alloc, core)] + /// # #![feature(box_raw)] /// let x = Box::new(5); /// let mut y = Box::new(10); /// @@ -336,7 +336,7 @@ impl ExactSizeIterator for Box {} /// -> i32>`. /// /// ``` -/// #![feature(core)] +/// #![feature(fnbox)] /// /// use std::boxed::FnBox; /// use std::collections::HashMap; diff --git a/src/liballoc/lib.rs b/src/liballoc/lib.rs index e297d4cbf7762..7dcf7a76da083 100644 --- a/src/liballoc/lib.rs +++ b/src/liballoc/lib.rs @@ -89,7 +89,7 @@ #![feature(unsafe_no_drop_flag, filling_drop)] #![feature(unsize)] -#![cfg_attr(test, feature(test, alloc, rustc_private))] +#![cfg_attr(test, feature(test, alloc, rustc_private, box_raw))] #![cfg_attr(all(not(feature = "external_funcs"), not(feature = "external_crate")), feature(libc))] diff --git a/src/liballoc/rc.rs b/src/liballoc/rc.rs index 04dde7a07f920..802591a6171d5 100644 --- a/src/liballoc/rc.rs +++ b/src/liballoc/rc.rs @@ -32,7 +32,6 @@ //! and have the `Owner` remain allocated as long as any `Gadget` points at it. //! //! ```rust -//! # #![feature(alloc)] //! use std::rc::Rc; //! //! struct Owner { @@ -92,7 +91,7 @@ //! documentation for more details on interior mutability. //! //! ```rust -//! # #![feature(alloc)] +//! # #![feature(rc_weak)] //! use std::rc::Rc; //! use std::rc::Weak; //! use std::cell::RefCell; @@ -229,7 +228,7 @@ impl Rc { /// # Examples /// /// ``` - /// # #![feature(alloc)] + /// # #![feature(rc_weak)] /// use std::rc::Rc; /// /// let five = Rc::new(5); @@ -246,12 +245,12 @@ impl Rc { /// Get the number of weak references to this value. #[inline] -#[unstable(feature = "rc_extras")] +#[unstable(feature = "rc_counts")] pub fn weak_count(this: &Rc) -> usize { this.weak() - 1 } /// Get the number of strong references to this value. #[inline] -#[unstable(feature = "rc_extras")] +#[unstable(feature = "rc_counts")] pub fn strong_count(this: &Rc) -> usize { this.strong() } /// Returns true if there are no other `Rc` or `Weak` values that share the @@ -260,7 +259,7 @@ pub fn strong_count(this: &Rc) -> usize { this.strong() } /// # Examples /// /// ``` -/// # #![feature(alloc)] +/// # #![feature(rc_unique)] /// use std::rc; /// use std::rc::Rc; /// @@ -269,7 +268,7 @@ pub fn strong_count(this: &Rc) -> usize { this.strong() } /// rc::is_unique(&five); /// ``` #[inline] -#[unstable(feature = "rc_extras")] +#[unstable(feature = "rc_unique")] pub fn is_unique(rc: &Rc) -> bool { weak_count(rc) == 0 && strong_count(rc) == 1 } @@ -281,7 +280,7 @@ pub fn is_unique(rc: &Rc) -> bool { /// # Examples /// /// ``` -/// # #![feature(alloc)] +/// # #![feature(rc_unique)] /// use std::rc::{self, Rc}; /// /// let x = Rc::new(3); @@ -292,7 +291,7 @@ pub fn is_unique(rc: &Rc) -> bool { /// assert_eq!(rc::try_unwrap(x), Err(Rc::new(4))); /// ``` #[inline] -#[unstable(feature = "rc_extras")] +#[unstable(feature = "rc_unique")] pub fn try_unwrap(rc: Rc) -> Result> { if is_unique(&rc) { unsafe { @@ -316,7 +315,7 @@ pub fn try_unwrap(rc: Rc) -> Result> { /// # Examples /// /// ``` -/// # #![feature(alloc)] +/// # #![feature(rc_unique)] /// use std::rc::{self, Rc}; /// /// let mut x = Rc::new(3); @@ -327,7 +326,7 @@ pub fn try_unwrap(rc: Rc) -> Result> { /// assert!(rc::get_mut(&mut x).is_none()); /// ``` #[inline] -#[unstable(feature = "rc_extras")] +#[unstable(feature = "rc_unique")] pub fn get_mut(rc: &mut Rc) -> Option<&mut T> { if is_unique(rc) { let inner = unsafe { &mut **rc._ptr }; @@ -346,7 +345,7 @@ impl Rc { /// # Examples /// /// ``` - /// # #![feature(alloc)] + /// # #![feature(rc_unique)] /// use std::rc::Rc; /// /// let mut five = Rc::new(5); @@ -354,7 +353,7 @@ impl Rc { /// let mut_five = five.make_unique(); /// ``` #[inline] - #[unstable(feature = "rc_extras")] + #[unstable(feature = "rc_unique")] pub fn make_unique(&mut self) -> &mut T { if !is_unique(self) { *self = Rc::new((**self).clone()) @@ -390,7 +389,6 @@ impl Drop for Rc { /// # Examples /// /// ``` - /// # #![feature(alloc)] /// use std::rc::Rc; /// /// { @@ -443,7 +441,6 @@ impl Clone for Rc { /// # Examples /// /// ``` - /// # #![feature(alloc)] /// use std::rc::Rc; /// /// let five = Rc::new(5); @@ -677,7 +674,7 @@ impl Weak { /// # Examples /// /// ``` - /// # #![feature(alloc)] + /// # #![feature(rc_weak)] /// use std::rc::Rc; /// /// let five = Rc::new(5); @@ -705,7 +702,7 @@ impl Drop for Weak { /// # Examples /// /// ``` - /// # #![feature(alloc)] + /// # #![feature(rc_weak)] /// use std::rc::Rc; /// /// { @@ -752,7 +749,7 @@ impl Clone for Weak { /// # Examples /// /// ``` - /// # #![feature(alloc)] + /// # #![feature(rc_weak)] /// use std::rc::Rc; /// /// let weak_five = Rc::new(5).downgrade(); diff --git a/src/libcollections/bit.rs b/src/libcollections/bit.rs index 5709ed7a29499..6a07c2c47eb24 100644 --- a/src/libcollections/bit.rs +++ b/src/libcollections/bit.rs @@ -38,7 +38,7 @@ //! [sieve]: http://en.wikipedia.org/wiki/Sieve_of_Eratosthenes //! //! ``` -//! # #![feature(collections, core, step_by)] +//! # #![feature(bitset, bitvec, range_inclusive, step_by)] //! use std::collections::{BitSet, BitVec}; //! use std::iter; //! @@ -133,7 +133,7 @@ const FALSE: &'static bool = &false; /// # Examples /// /// ``` -/// # #![feature(collections)] +/// # #![feature(bitvec)] /// use std::collections::BitVec; /// /// let mut bv = BitVec::from_elem(10, false); @@ -250,7 +250,7 @@ impl BitVec { /// # Examples /// /// ``` - /// # #![feature(collections)] + /// # #![feature(bitvec)] /// use std::collections::BitVec; /// let mut bv = BitVec::new(); /// ``` @@ -265,7 +265,7 @@ impl BitVec { /// # Examples /// /// ``` - /// # #![feature(collections)] + /// # #![feature(bitvec)] /// use std::collections::BitVec; /// /// let bv = BitVec::from_elem(10, false); @@ -306,7 +306,7 @@ impl BitVec { /// # Examples /// /// ``` - /// # #![feature(collections)] + /// # #![feature(bitvec)] /// use std::collections::BitVec; /// /// let bv = BitVec::from_bytes(&[0b10100000, 0b00010010]); @@ -349,7 +349,7 @@ impl BitVec { /// # Examples /// /// ``` - /// # #![feature(collections)] + /// # #![feature(bitvec)] /// use std::collections::BitVec; /// /// let bv = BitVec::from_fn(5, |i| { i % 2 == 0 }); @@ -368,7 +368,7 @@ impl BitVec { /// # Examples /// /// ``` - /// # #![feature(collections)] + /// # #![feature(bitvec)] /// use std::collections::BitVec; /// /// let bv = BitVec::from_bytes(&[0b01100000]); @@ -401,7 +401,7 @@ impl BitVec { /// # Examples /// /// ``` - /// # #![feature(collections)] + /// # #![feature(bitvec)] /// use std::collections::BitVec; /// /// let mut bv = BitVec::from_elem(5, false); @@ -424,7 +424,7 @@ impl BitVec { /// # Examples /// /// ``` - /// # #![feature(collections)] + /// # #![feature(bitvec)] /// use std::collections::BitVec; /// /// let before = 0b01100000; @@ -445,7 +445,7 @@ impl BitVec { /// # Examples /// /// ``` - /// # #![feature(collections)] + /// # #![feature(bitvec)] /// use std::collections::BitVec; /// /// let before = 0b01100000; @@ -474,7 +474,7 @@ impl BitVec { /// # Examples /// /// ``` - /// # #![feature(collections)] + /// # #![feature(bitvec)] /// use std::collections::BitVec; /// /// let a = 0b01100100; @@ -505,7 +505,7 @@ impl BitVec { /// # Examples /// /// ``` - /// # #![feature(collections)] + /// # #![feature(bitvec)] /// use std::collections::BitVec; /// /// let a = 0b01100100; @@ -536,7 +536,7 @@ impl BitVec { /// # Examples /// /// ``` - /// # #![feature(collections)] + /// # #![feature(bitvec)] /// use std::collections::BitVec; /// /// let a = 0b01100100; @@ -566,7 +566,7 @@ impl BitVec { /// # Examples /// /// ``` - /// # #![feature(collections)] + /// # #![feature(bitvec)] /// use std::collections::BitVec; /// /// let mut bv = BitVec::from_elem(5, true); @@ -591,7 +591,7 @@ impl BitVec { /// # Examples /// /// ``` - /// # #![feature(collections)] + /// # #![feature(bitvec)] /// use std::collections::BitVec; /// /// let bv = BitVec::from_bytes(&[0b01110100, 0b10010010]); @@ -712,7 +712,7 @@ impl BitVec { /// # Examples /// /// ``` - /// # #![feature(collections)] + /// # #![feature(bitvec)] /// use std::collections::BitVec; /// /// let mut bv = BitVec::from_elem(10, false); @@ -730,7 +730,7 @@ impl BitVec { /// # Examples /// /// ``` - /// # #![feature(collections)] + /// # #![feature(bitvec)] /// use std::collections::BitVec; /// /// let mut bv = BitVec::from_elem(10, false); @@ -752,7 +752,7 @@ impl BitVec { /// # Examples /// /// ``` - /// # #![feature(collections)] + /// # #![feature(bitvec)] /// use std::collections::BitVec; /// /// let mut bv = BitVec::from_elem(3, true); @@ -800,7 +800,7 @@ impl BitVec { /// # Examples /// /// ``` - /// # #![feature(collections)] + /// # #![feature(bitvec)] /// use std::collections::BitVec; /// /// let bv = BitVec::from_bytes(&[0b10100000]); @@ -821,7 +821,7 @@ impl BitVec { /// # Examples /// /// ``` - /// # #![feature(collections)] + /// # #![feature(bitvec)] /// use std::collections::BitVec; /// /// let mut bv = BitVec::from_bytes(&[0b01001011]); @@ -848,7 +848,7 @@ impl BitVec { /// # Examples /// /// ``` - /// # #![feature(collections)] + /// # #![feature(bitvec)] /// use std::collections::BitVec; /// /// let mut bv = BitVec::from_elem(3, false); @@ -879,7 +879,7 @@ impl BitVec { /// # Examples /// /// ``` - /// # #![feature(collections)] + /// # #![feature(bitvec)] /// use std::collections::BitVec; /// /// let mut bv = BitVec::from_elem(3, false); @@ -902,7 +902,7 @@ impl BitVec { /// # Examples /// /// ``` - /// # #![feature(collections)] + /// # #![feature(bitvec)] /// use std::collections::BitVec; /// /// let mut bv = BitVec::new(); @@ -924,7 +924,7 @@ impl BitVec { /// # Examples /// /// ``` - /// # #![feature(collections)] + /// # #![feature(bitvec)] /// use std::collections::BitVec; /// /// let mut bv = BitVec::from_bytes(&[0b01001011]); @@ -975,7 +975,7 @@ impl BitVec { /// # Examples /// /// ``` - /// # #![feature(collections)] + /// # #![feature(bitvec)] /// use std::collections::BitVec; /// /// let mut bv = BitVec::from_bytes(&[0b01001001]); @@ -1006,7 +1006,7 @@ impl BitVec { /// # Examples /// /// ``` - /// # #![feature(collections)] + /// # #![feature(bitvec)] /// use std::collections::BitVec; /// /// let mut bv = BitVec::new(); @@ -1224,7 +1224,7 @@ impl<'a> IntoIterator for &'a BitVec { /// # Examples /// /// ``` -/// # #![feature(collections)] +/// # #![feature(bitvec, bitset)] /// use std::collections::{BitSet, BitVec}; /// /// // It's a regular set @@ -1328,7 +1328,7 @@ impl BitSet { /// # Examples /// /// ``` - /// # #![feature(collections)] + /// # #![feature(bitset)] /// use std::collections::BitSet; /// /// let mut s = BitSet::new(); @@ -1345,7 +1345,7 @@ impl BitSet { /// # Examples /// /// ``` - /// # #![feature(collections)] + /// # #![feature(bitset)] /// use std::collections::BitSet; /// /// let mut s = BitSet::with_capacity(100); @@ -1363,7 +1363,7 @@ impl BitSet { /// # Examples /// /// ``` - /// # #![feature(collections)] + /// # #![feature(bitset, bitvec)] /// use std::collections::{BitVec, BitSet}; /// /// let bv = BitVec::from_bytes(&[0b01100000]); @@ -1385,7 +1385,7 @@ impl BitSet { /// # Examples /// /// ``` - /// # #![feature(collections)] + /// # #![feature(bitset)] /// use std::collections::BitSet; /// /// let mut s = BitSet::with_capacity(100); @@ -1397,9 +1397,9 @@ impl BitSet { self.bit_vec.capacity() } - /// Reserves capacity for the given `BitSet` to contain `len` distinct elements. In the case - /// of `BitSet` this means reallocations will not occur as long as all inserted elements - /// are less than `len`. + /// Reserves capacity for the given `BitSet` to contain `len` distinct + /// elements. In the case of `BitSet` this means reallocations will not + /// occur as long as all inserted elements are less than `len`. /// /// The collection may reserve more space to avoid frequent reallocations. /// @@ -1407,7 +1407,7 @@ impl BitSet { /// # Examples /// /// ``` - /// # #![feature(collections)] + /// # #![feature(bitset)] /// use std::collections::BitSet; /// /// let mut s = BitSet::new(); @@ -1422,19 +1422,19 @@ impl BitSet { } } - /// Reserves the minimum capacity for the given `BitSet` to contain `len` distinct elements. - /// In the case of `BitSet` this means reallocations will not occur as long as all inserted - /// elements are less than `len`. + /// Reserves the minimum capacity for the given `BitSet` to contain `len` + /// distinct elements. In the case of `BitSet` this means reallocations + /// will not occur as long as all inserted elements are less than `len`. /// - /// Note that the allocator may give the collection more space than it requests. Therefore - /// capacity can not be relied upon to be precisely minimal. Prefer `reserve_len` if future - /// insertions are expected. + /// Note that the allocator may give the collection more space than it + /// requests. Therefore capacity can not be relied upon to be precisely + /// minimal. Prefer `reserve_len` if future insertions are expected. /// /// /// # Examples /// /// ``` - /// # #![feature(collections)] + /// # #![feature(bitset)] /// use std::collections::BitSet; /// /// let mut s = BitSet::new(); @@ -1455,7 +1455,7 @@ impl BitSet { /// # Examples /// /// ``` - /// # #![feature(collections)] + /// # #![feature(bitset)] /// use std::collections::BitSet; /// /// let mut s = BitSet::new(); @@ -1476,7 +1476,7 @@ impl BitSet { /// # Examples /// /// ``` - /// # #![feature(collections)] + /// # #![feature(bitset)] /// use std::collections::BitSet; /// /// let mut s = BitSet::new(); @@ -1523,7 +1523,7 @@ impl BitSet { /// # Examples /// /// ``` - /// # #![feature(collections)] + /// # #![feature(bitset)] /// use std::collections::BitSet; /// /// let mut s = BitSet::new(); @@ -1556,7 +1556,7 @@ impl BitSet { /// # Examples /// /// ``` - /// # #![feature(collections)] + /// # #![feature(bitset, bitvec)] /// use std::collections::{BitVec, BitSet}; /// /// let s = BitSet::from_bit_vec(BitVec::from_bytes(&[0b01001010])); @@ -1578,7 +1578,7 @@ impl BitSet { /// # Examples /// /// ``` - /// # #![feature(collections)] + /// # #![feature(bitset, bitvec)] /// use std::collections::{BitVec, BitSet}; /// /// let a = BitSet::from_bit_vec(BitVec::from_bytes(&[0b01101000])); @@ -1602,12 +1602,13 @@ impl BitSet { } /// Iterator over each usize stored in `self` intersect `other`. - /// See [intersect_with](#method.intersect_with) for an efficient in-place version. + /// See [intersect_with](#method.intersect_with) for an efficient in-place + /// version. /// /// # Examples /// /// ``` - /// # #![feature(collections)] + /// # #![feature(bitset, bitvec)] /// use std::collections::{BitVec, BitSet}; /// /// let a = BitSet::from_bit_vec(BitVec::from_bytes(&[0b01101000])); @@ -1632,12 +1633,13 @@ impl BitSet { } /// Iterator over each usize stored in the `self` setminus `other`. - /// See [difference_with](#method.difference_with) for an efficient in-place version. + /// See [difference_with](#method.difference_with) for an efficient in-place + /// version. /// /// # Examples /// /// ``` - /// # #![feature(collections)] + /// # #![feature(bitset, bitvec)] /// use std::collections::{BitSet, BitVec}; /// /// let a = BitSet::from_bit_vec(BitVec::from_bytes(&[0b01101000])); @@ -1667,14 +1669,15 @@ impl BitSet { })) } - /// Iterator over each usize stored in the symmetric difference of `self` and `other`. - /// See [symmetric_difference_with](#method.symmetric_difference_with) for - /// an efficient in-place version. + /// Iterator over each usize stored in the symmetric difference of `self` + /// and `other`. See + /// [symmetric_difference_with](#method.symmetric_difference_with) for an + /// efficient in-place version. /// /// # Examples /// /// ``` - /// # #![feature(collections)] + /// # #![feature(bitset, bitvec)] /// use std::collections::{BitSet, BitVec}; /// /// let a = BitSet::from_bit_vec(BitVec::from_bytes(&[0b01101000])); @@ -1702,7 +1705,7 @@ impl BitSet { /// # Examples /// /// ``` - /// # #![feature(collections)] + /// # #![feature(bitset, bitvec)] /// use std::collections::{BitSet, BitVec}; /// /// let a = 0b01101000; @@ -1726,7 +1729,7 @@ impl BitSet { /// # Examples /// /// ``` - /// # #![feature(collections)] + /// # #![feature(bitset, bitvec)] /// use std::collections::{BitSet, BitVec}; /// /// let a = 0b01101000; @@ -1751,7 +1754,7 @@ impl BitSet { /// # Examples /// /// ``` - /// # #![feature(collections)] + /// # #![feature(bitset, bitvec)] /// use std::collections::{BitSet, BitVec}; /// /// let a = 0b01101000; @@ -1784,7 +1787,7 @@ impl BitSet { /// # Examples /// /// ``` - /// # #![feature(collections)] + /// # #![feature(bitset, bitvec)] /// use std::collections::{BitSet, BitVec}; /// /// let a = 0b01101000; @@ -1808,7 +1811,7 @@ impl BitSet { /// # Examples /// /// ``` - /// # #![feature(collections, append)] + /// # #![feature(bitset, bitvec, append)] /// use std::collections::{BitVec, BitSet}; /// /// let mut a = BitSet::new(); @@ -1839,7 +1842,7 @@ impl BitSet { /// # Examples /// /// ``` - /// # #![feature(bitset, split_off)] + /// # #![feature(bitset, bitvec, split_off)] /// use std::collections::{BitSet, BitVec}; /// let mut a = BitSet::new(); /// a.insert(2); diff --git a/src/libcollections/btree/map.rs b/src/libcollections/btree/map.rs index 95a6fe14ef60c..d27d04c3a6cec 100644 --- a/src/libcollections/btree/map.rs +++ b/src/libcollections/btree/map.rs @@ -1507,7 +1507,7 @@ impl BTreeMap { /// # Examples /// /// ``` - /// # #![feature(collections)] + /// # #![feature(btree_range, collections_bound)] /// use std::collections::BTreeMap; /// use std::collections::Bound::{Included, Unbounded}; /// @@ -1534,7 +1534,7 @@ impl BTreeMap { /// # Examples /// /// ``` - /// # #![feature(collections)] + /// # #![feature(btree_range, collections_bound)] /// use std::collections::BTreeMap; /// use std::collections::Bound::{Included, Excluded}; /// diff --git a/src/libcollections/btree/set.rs b/src/libcollections/btree/set.rs index 5914e2f296a33..7c4cda305adf2 100644 --- a/src/libcollections/btree/set.rs +++ b/src/libcollections/btree/set.rs @@ -141,7 +141,7 @@ impl BTreeSet { /// # Examples /// /// ``` - /// # #![feature(collections)] + /// # #![feature(btree_range, collections_bound)] /// use std::collections::BTreeSet; /// use std::collections::Bound::{Included, Unbounded}; /// diff --git a/src/libcollections/fmt.rs b/src/libcollections/fmt.rs index 817a5baf3d1be..72d0ca85357a4 100644 --- a/src/libcollections/fmt.rs +++ b/src/libcollections/fmt.rs @@ -172,9 +172,8 @@ //! like: //! //! ``` -//! # #![feature(core, std_misc)] +//! # #![feature(fmt_flags)] //! use std::fmt; -//! use std::f64; //! //! #[derive(Debug)] //! struct Vector2D { diff --git a/src/libcollections/lib.rs b/src/libcollections/lib.rs index 9762381381c60..b08a3b85e4cbf 100644 --- a/src/libcollections/lib.rs +++ b/src/libcollections/lib.rs @@ -44,8 +44,8 @@ #![feature(iter_cmp)] #![feature(iter_idx)] #![feature(iter_order)] -#![feature(iter_product)] -#![feature(iter_sum)] +#![feature(iter_arith)] +#![feature(iter_arith)] #![feature(lang_items)] #![feature(num_bits_bytes)] #![feature(oom)] diff --git a/src/libcollections/linked_list.rs b/src/libcollections/linked_list.rs index a732ce9e81df7..a02cb44896ad3 100644 --- a/src/libcollections/linked_list.rs +++ b/src/libcollections/linked_list.rs @@ -784,7 +784,7 @@ impl<'a, A> IterMut<'a, A> { /// # Examples /// /// ``` - /// # #![feature(collections)] + /// # #![feature(linked_list_extras)] /// use std::collections::LinkedList; /// /// let mut list: LinkedList<_> = vec![1, 3, 4].into_iter().collect(); @@ -812,7 +812,7 @@ impl<'a, A> IterMut<'a, A> { /// # Examples /// /// ``` - /// # #![feature(collections)] + /// # #![feature(linked_list_extras)] /// use std::collections::LinkedList; /// /// let mut list: LinkedList<_> = vec![1, 2, 3].into_iter().collect(); diff --git a/src/libcollections/slice.rs b/src/libcollections/slice.rs index c5418c9a0db8e..be678d4a55c86 100644 --- a/src/libcollections/slice.rs +++ b/src/libcollections/slice.rs @@ -851,7 +851,7 @@ impl [T] { /// # Examples /// /// ```rust - /// # #![feature(collections)] + /// # #![feature(permutations)] /// let v = [1, 2, 3]; /// let mut perms = v.permutations(); /// @@ -863,7 +863,7 @@ impl [T] { /// Iterating through permutations one by one. /// /// ```rust - /// # #![feature(collections)] + /// # #![feature(permutations)] /// let v = [1, 2, 3]; /// let mut perms = v.permutations(); /// @@ -886,7 +886,7 @@ impl [T] { /// # Example /// /// ```rust - /// # #![feature(collections)] + /// # #![feature(permutations)] /// let v: &mut [_] = &mut [0, 1, 2]; /// v.next_permutation(); /// let b: &mut [_] = &mut [0, 2, 1]; @@ -909,7 +909,7 @@ impl [T] { /// # Example /// /// ```rust - /// # #![feature(collections)] + /// # #![feature(permutations)] /// let v: &mut [_] = &mut [1, 0, 2]; /// v.prev_permutation(); /// let b: &mut [_] = &mut [0, 2, 1]; @@ -931,7 +931,7 @@ impl [T] { /// # Example /// /// ```rust - /// # #![feature(collections)] + /// # #![feature(clone_from_slice)] /// let mut dst = [0, 0, 0]; /// let src = [1, 2]; /// @@ -962,7 +962,7 @@ impl [T] { /// # Examples /// /// ```rust - /// # #![feature(collections)] + /// # #![feature(move_from)] /// let mut a = [1, 2, 3, 4, 5]; /// let b = vec![6, 7, 8]; /// let num_moved = a.move_from(b, 0, 3); diff --git a/src/libcollections/str.rs b/src/libcollections/str.rs index 61e09a2670ab3..d41e062cac3d8 100644 --- a/src/libcollections/str.rs +++ b/src/libcollections/str.rs @@ -585,7 +585,7 @@ impl str { /// # Examples /// /// ``` - /// # #![feature(collections)] + /// # #![feature(slice_chars)] /// let s = "Löwe 老虎 Léopard"; /// /// assert_eq!(s.slice_chars(0, 4), "Löwe"); @@ -1520,7 +1520,7 @@ impl str { /// # Examples /// /// ``` - /// # #![feature(collections)] + /// # #![feature(str_matches)] /// let v: Vec<&str> = "abcXXXabcYYYabc".matches("abc").collect(); /// assert_eq!(v, ["abc", "abc", "abc"]); /// @@ -1553,7 +1553,7 @@ impl str { /// # Examples /// /// ``` - /// # #![feature(collections)] + /// # #![feature(str_matches)] /// let v: Vec<&str> = "abcXXXabcYYYabc".rmatches("abc").collect(); /// assert_eq!(v, ["abc", "abc", "abc"]); /// @@ -1595,7 +1595,7 @@ impl str { /// # Examples /// /// ``` - /// # #![feature(collections)] + /// # #![feature(str_matches)] /// let v: Vec<(usize, usize)> = "abcXXXabcYYYabc".match_indices("abc").collect(); /// assert_eq!(v, [(0, 3), (6, 9), (12, 15)]); /// @@ -1639,7 +1639,7 @@ impl str { /// # Examples /// /// ``` - /// # #![feature(collections)] + /// # #![feature(str_matches)] /// let v: Vec<(usize, usize)> = "abcXXXabcYYYabc".rmatch_indices("abc").collect(); /// assert_eq!(v, [(12, 15), (6, 9), (0, 3)]); /// @@ -1669,7 +1669,7 @@ impl str { /// # Examples /// /// ``` - /// # #![feature(collections)] + /// # #![feature(subslice_offset)] /// let string = "a\nb\nc"; /// let lines: Vec<&str> = string.lines().collect(); /// @@ -1863,7 +1863,7 @@ impl str { /// # Examples /// /// ``` - /// #![feature(collections)] + /// #![feature(str_casing)] /// /// let s = "HELLO"; /// assert_eq!(s.to_lowercase(), "hello"); @@ -1909,7 +1909,7 @@ impl str { /// # Examples /// /// ``` - /// #![feature(collections)] + /// #![feature(str_casing)] /// /// let s = "hello"; /// assert_eq!(s.to_uppercase(), "HELLO"); diff --git a/src/libcollections/vec.rs b/src/libcollections/vec.rs index 1409ececfc7a5..3d7c82c9a94a6 100644 --- a/src/libcollections/vec.rs +++ b/src/libcollections/vec.rs @@ -696,7 +696,7 @@ impl Vec { /// # Examples /// /// ``` - /// # #![feature(collections)] + /// # #![feature(append)] /// let mut vec = vec![1, 2, 3]; /// let mut vec2 = vec![4, 5, 6]; /// vec.append(&mut vec2); @@ -840,7 +840,7 @@ impl Vec { /// # Examples /// /// ``` - /// # #![feature(collections)] + /// # #![feature(map_in_place)] /// let v = vec![0, 1, 2]; /// let w = v.map_in_place(|i| i + 3); /// assert_eq!(&w[..], &[3, 4, 5]); @@ -1082,7 +1082,7 @@ impl Vec { /// # Examples /// /// ``` - /// # #![feature(collections)] + /// # #![feature(vec_resize)] /// let mut vec = vec!["hello"]; /// vec.resize(3, "world"); /// assert_eq!(vec, ["hello", "world", "world"]); @@ -1111,7 +1111,7 @@ impl Vec { /// # Examples /// /// ``` - /// # #![feature(collections)] + /// # #![feature(vec_push_all)] /// let mut vec = vec![1]; /// vec.push_all(&[2, 3, 4]); /// assert_eq!(vec, [1, 2, 3, 4]); diff --git a/src/libcollections/vec_deque.rs b/src/libcollections/vec_deque.rs index 54127ea8a9ef2..c80fcfc5fedcc 100644 --- a/src/libcollections/vec_deque.rs +++ b/src/libcollections/vec_deque.rs @@ -480,7 +480,7 @@ impl VecDeque { /// # Examples /// /// ``` - /// # #![feature(collections)] + /// # #![feature(deque_extras)] /// use std::collections::VecDeque; /// /// let mut buf = VecDeque::new(); @@ -629,7 +629,7 @@ impl VecDeque { /// # Examples /// /// ``` - /// # #![feature(collections)] + /// # #![feature(drain)] /// use std::collections::VecDeque; /// /// let mut v = VecDeque::new(); @@ -868,7 +868,7 @@ impl VecDeque { /// # Examples /// /// ``` - /// # #![feature(collections)] + /// # #![feature(deque_extras)] /// use std::collections::VecDeque; /// /// let mut buf = VecDeque::new(); @@ -892,8 +892,8 @@ impl VecDeque { self.pop_back() } - /// Removes an element from anywhere in the ringbuf and returns it, replacing it with the first - /// element. + /// Removes an element from anywhere in the ringbuf and returns it, + /// replacing it with the first element. /// /// This does not preserve ordering, but is O(1). /// @@ -902,7 +902,7 @@ impl VecDeque { /// # Examples /// /// ``` - /// # #![feature(collections)] + /// # #![feature(deque_extras)] /// use std::collections::VecDeque; /// /// let mut buf = VecDeque::new(); @@ -1310,7 +1310,7 @@ impl VecDeque { /// # Examples /// /// ``` - /// # #![feature(collections)] + /// # #![feature(split_off)] /// use std::collections::VecDeque; /// /// let mut buf: VecDeque<_> = vec![1,2,3].into_iter().collect(); @@ -1373,7 +1373,7 @@ impl VecDeque { /// # Examples /// /// ``` - /// # #![feature(collections)] + /// # #![feature(append)] /// use std::collections::VecDeque; /// /// let mut buf: VecDeque<_> = vec![1, 2, 3].into_iter().collect(); @@ -1434,7 +1434,7 @@ impl VecDeque { /// # Examples /// /// ``` - /// # #![feature(collections)] + /// # #![feature(deque_extras)] /// use std::collections::VecDeque; /// /// let mut buf = VecDeque::new(); diff --git a/src/libcollections/vec_map.rs b/src/libcollections/vec_map.rs index 3fd2455a00443..98ecd045b9ace 100644 --- a/src/libcollections/vec_map.rs +++ b/src/libcollections/vec_map.rs @@ -35,7 +35,7 @@ use vec::Vec; /// # Examples /// /// ``` -/// # #![feature(collections)] +/// # #![feature(vecmap)] /// use std::collections::VecMap; /// /// let mut months = VecMap::new(); @@ -135,7 +135,7 @@ impl VecMap { /// # Examples /// /// ``` - /// # #![feature(collections)] + /// # #![feature(vecmap)] /// use std::collections::VecMap; /// let mut map: VecMap<&str> = VecMap::new(); /// ``` @@ -148,7 +148,7 @@ impl VecMap { /// # Examples /// /// ``` - /// # #![feature(collections)] + /// # #![feature(vecmap)] /// use std::collections::VecMap; /// let mut map: VecMap<&str> = VecMap::with_capacity(10); /// ``` @@ -163,7 +163,7 @@ impl VecMap { /// # Examples /// /// ``` - /// # #![feature(collections)] + /// # #![feature(vecmap)] /// use std::collections::VecMap; /// let map: VecMap = VecMap::with_capacity(10); /// assert!(map.capacity() >= 10); @@ -183,7 +183,7 @@ impl VecMap { /// # Examples /// /// ``` - /// # #![feature(collections)] + /// # #![feature(vecmap)] /// use std::collections::VecMap; /// let mut map: VecMap<&str> = VecMap::new(); /// map.reserve_len(10); @@ -208,7 +208,7 @@ impl VecMap { /// # Examples /// /// ``` - /// # #![feature(collections)] + /// # #![feature(vecmap)] /// use std::collections::VecMap; /// let mut map: VecMap<&str> = VecMap::new(); /// map.reserve_len_exact(10); @@ -248,7 +248,7 @@ impl VecMap { /// # Examples /// /// ``` - /// # #![feature(collections)] + /// # #![feature(vecmap)] /// use std::collections::VecMap; /// /// let mut map = VecMap::new(); @@ -277,7 +277,7 @@ impl VecMap { /// # Examples /// /// ``` - /// # #![feature(collections)] + /// # #![feature(vecmap)] /// use std::collections::VecMap; /// /// let mut map = VecMap::new(); @@ -307,7 +307,7 @@ impl VecMap { /// # Examples /// /// ``` - /// # #![feature(collections)] + /// # #![feature(vecmap, append)] /// use std::collections::VecMap; /// /// let mut a = VecMap::new(); @@ -343,7 +343,7 @@ impl VecMap { /// # Examples /// /// ``` - /// # #![feature(collections)] + /// # #![feature(vecmap, split_off)] /// use std::collections::VecMap; /// /// let mut a = VecMap::new(); @@ -400,7 +400,7 @@ impl VecMap { /// # Examples /// /// ``` - /// # #![feature(collections)] + /// # #![feature(vecmap, drain)] /// use std::collections::VecMap; /// /// let mut map = VecMap::new(); @@ -428,7 +428,7 @@ impl VecMap { /// # Examples /// /// ``` - /// # #![feature(collections)] + /// # #![feature(vecmap)] /// use std::collections::VecMap; /// /// let mut a = VecMap::new(); @@ -446,7 +446,7 @@ impl VecMap { /// # Examples /// /// ``` - /// # #![feature(collections)] + /// # #![feature(vecmap)] /// use std::collections::VecMap; /// /// let mut a = VecMap::new(); @@ -464,7 +464,7 @@ impl VecMap { /// # Examples /// /// ``` - /// # #![feature(collections)] + /// # #![feature(vecmap)] /// use std::collections::VecMap; /// /// let mut a = VecMap::new(); @@ -480,7 +480,7 @@ impl VecMap { /// # Examples /// /// ``` - /// # #![feature(collections)] + /// # #![feature(vecmap)] /// use std::collections::VecMap; /// /// let mut map = VecMap::new(); @@ -505,7 +505,7 @@ impl VecMap { /// # Examples /// /// ``` - /// # #![feature(collections)] + /// # #![feature(vecmap)] /// use std::collections::VecMap; /// /// let mut map = VecMap::new(); @@ -524,7 +524,7 @@ impl VecMap { /// # Examples /// /// ``` - /// # #![feature(collections)] + /// # #![feature(vecmap)] /// use std::collections::VecMap; /// /// let mut map = VecMap::new(); @@ -552,7 +552,7 @@ impl VecMap { /// # Examples /// /// ``` - /// # #![feature(collections)] + /// # #![feature(vecmap)] /// use std::collections::VecMap; /// /// let mut map = VecMap::new(); @@ -578,7 +578,7 @@ impl VecMap { /// # Examples /// /// ``` - /// # #![feature(collections)] + /// # #![feature(vecmap)] /// use std::collections::VecMap; /// /// let mut map = VecMap::new(); @@ -600,7 +600,7 @@ impl VecMap { /// # Examples /// /// ``` - /// # #![feature(collections)] + /// # #![feature(vecmap, entry)] /// use std::collections::VecMap; /// /// let mut count: VecMap = VecMap::new(); @@ -779,7 +779,7 @@ impl IntoIterator for VecMap { /// # Examples /// /// ``` - /// # #![feature(collections)] + /// # #![feature(vecmap)] /// use std::collections::VecMap; /// /// let mut map = VecMap::new(); diff --git a/src/libcollectionstest/lib.rs b/src/libcollectionstest/lib.rs index 0e3f9d5aaddf6..437657cec1658 100644 --- a/src/libcollectionstest/lib.rs +++ b/src/libcollectionstest/lib.rs @@ -8,23 +8,52 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(bit_set_append_split_off)] +#![feature(append)] #![feature(bit_vec_append_split_off)] +#![feature(bitset)] +#![feature(bitvec)] #![feature(box_syntax)] +#![feature(btree_range)] #![feature(collections)] -#![feature(collections_drain)] -#![feature(core)] +#![feature(collections_bound)] #![feature(const_fn)] -#![feature(hash)] +#![feature(core)] +#![feature(deque_extras)] +#![feature(drain)] +#![feature(enumset)] +#![feature(hash_default)] +#![feature(into_cow)] +#![feature(iter_idx)] +#![feature(iter_order)] +#![feature(iter_arith)] +#![feature(iter_to_vec)] +#![feature(map_in_place)] +#![feature(move_from)] +#![feature(num_bits_bytes)] +#![feature(pattern)] +#![feature(permutations)] #![feature(rand)] +#![feature(range_inclusive)] #![feature(rustc_private)] +#![feature(slice_bytes)] +#![feature(slice_chars)] +#![feature(slice_extras)] +#![feature(slice_position_elem)] +#![feature(split_off)] +#![feature(step_by)] +#![feature(str_char)] +#![feature(str_escape)] +#![feature(str_matches)] +#![feature(str_utf16)] +#![feature(subslice_offset)] #![feature(test)] #![feature(unboxed_closures)] #![feature(unicode)] -#![feature(into_cow)] -#![feature(step_by)] -#![cfg_attr(test, feature(str_char))] -#![cfg_attr(test, feature(vec_deque_retain))] +#![feature(vec_deque_retain)] +#![feature(vec_from_raw_buf)] +#![feature(vec_push_all)] +#![feature(vec_split_off)] +#![feature(vecmap)] #[macro_use] extern crate log; diff --git a/src/libcollectionstest/str.rs b/src/libcollectionstest/str.rs index f8bc1ceaf7dc3..3f32136bc2639 100644 --- a/src/libcollectionstest/str.rs +++ b/src/libcollectionstest/str.rs @@ -9,7 +9,7 @@ // except according to those terms. use std::cmp::Ordering::{Equal, Greater, Less}; -use std::str::{Utf8Error, from_utf8}; +use std::str::from_utf8; #[test] fn test_le() { @@ -1753,6 +1753,7 @@ mod pattern { macro_rules! make_test { ($name:ident, $p:expr, $h:expr, [$($e:expr,)*]) => { + #[allow(unused_imports)] mod $name { use std::str::pattern::SearchStep::{Match, Reject}; use super::{cmp_search_to_vec}; diff --git a/src/libcollectionstest/string.rs b/src/libcollectionstest/string.rs index 2df0c7a3a8a23..257caca4016df 100644 --- a/src/libcollectionstest/string.rs +++ b/src/libcollectionstest/string.rs @@ -10,12 +10,13 @@ use std::borrow::{IntoCow, Cow}; use std::iter::repeat; -use std::str::Utf8Error; +#[allow(deprecated)] use std::string::as_string; use test::Bencher; #[test] +#[allow(deprecated)] fn test_as_string() { let x = "foo"; assert_eq!(x, &**as_string(x)); diff --git a/src/libcollectionstest/vec.rs b/src/libcollectionstest/vec.rs index 3f07c3697ef3c..df63fbc62fcf4 100644 --- a/src/libcollectionstest/vec.rs +++ b/src/libcollectionstest/vec.rs @@ -10,6 +10,7 @@ use std::iter::{FromIterator, repeat}; use std::mem::size_of; +#[allow(deprecated)] use std::vec::as_vec; use test::Bencher; @@ -25,12 +26,14 @@ impl<'a> Drop for DropCounter<'a> { } #[test] +#[allow(deprecated)] fn test_as_vec() { let xs = [1u8, 2u8, 3u8]; assert_eq!(&**as_vec(&xs), xs); } #[test] +#[allow(deprecated)] fn test_as_vec_dtor() { let (mut count_x, mut count_y) = (0, 0); { diff --git a/src/libcollectionstest/vec_deque.rs b/src/libcollectionstest/vec_deque.rs index 14a36b7c4db79..95368de3bf3d9 100644 --- a/src/libcollectionstest/vec_deque.rs +++ b/src/libcollectionstest/vec_deque.rs @@ -537,8 +537,6 @@ fn test_drain() { #[test] fn test_from_iter() { - use std::iter; - let v = vec!(1,2,3,4,5,6,7); let deq: VecDeque<_> = v.iter().cloned().collect(); let u: Vec<_> = deq.iter().cloned().collect(); diff --git a/src/libcore/cell.rs b/src/libcore/cell.rs index 56dfd922dc188..37f37654c1fee 100644 --- a/src/libcore/cell.rs +++ b/src/libcore/cell.rs @@ -221,7 +221,7 @@ impl Cell { /// # Examples /// /// ``` - /// # #![feature(core)] + /// # #![feature(as_unsafe_cell)] /// use std::cell::Cell; /// /// let c = Cell::new(5); diff --git a/src/libcore/cmp.rs b/src/libcore/cmp.rs index b12b59760106a..0269499ad5414 100644 --- a/src/libcore/cmp.rs +++ b/src/libcore/cmp.rs @@ -381,7 +381,7 @@ pub fn max(v1: T, v2: T) -> T { /// # Examples /// /// ``` -/// # #![feature(core)] +/// # #![feature(cmp_partial)] /// use std::cmp; /// /// assert_eq!(Some(1), cmp::partial_min(1, 2)); @@ -391,7 +391,7 @@ pub fn max(v1: T, v2: T) -> T { /// When comparison is impossible: /// /// ``` -/// # #![feature(core)] +/// # #![feature(cmp_partial)] /// use std::cmp; /// /// let result = cmp::partial_min(std::f64::NAN, 1.0); @@ -414,7 +414,7 @@ pub fn partial_min(v1: T, v2: T) -> Option { /// # Examples /// /// ``` -/// # #![feature(core)] +/// # #![feature(cmp_partial)] /// use std::cmp; /// /// assert_eq!(Some(2), cmp::partial_max(1, 2)); @@ -424,7 +424,7 @@ pub fn partial_min(v1: T, v2: T) -> Option { /// When comparison is impossible: /// /// ``` -/// # #![feature(core)] +/// # #![feature(cmp_partial)] /// use std::cmp; /// /// let result = cmp::partial_max(std::f64::NAN, 1.0); diff --git a/src/libcore/fmt/num.rs b/src/libcore/fmt/num.rs index 6aaec20382ecf..fc49f87d10769 100644 --- a/src/libcore/fmt/num.rs +++ b/src/libcore/fmt/num.rs @@ -162,7 +162,7 @@ pub struct RadixFmt(T, R); /// # Examples /// /// ``` -/// # #![feature(core)] +/// # #![feature(fmt_radix)] /// use std::fmt::radix; /// assert_eq!(format!("{}", radix(55, 36)), "1j".to_string()); /// ``` diff --git a/src/libcore/hash/mod.rs b/src/libcore/hash/mod.rs index cbf2828a7dc18..abf9e55a1f2fb 100644 --- a/src/libcore/hash/mod.rs +++ b/src/libcore/hash/mod.rs @@ -16,7 +16,7 @@ //! # Examples //! //! ```rust -//! # #![feature(hash)] +//! # #![feature(hash_default)] //! use std::hash::{hash, Hash, SipHasher}; //! //! #[derive(Hash)] @@ -36,7 +36,7 @@ //! the trait `Hash`: //! //! ```rust -//! # #![feature(hash)] +//! # #![feature(hash_default)] //! use std::hash::{hash, Hash, Hasher, SipHasher}; //! //! struct Person { diff --git a/src/libcore/iter.rs b/src/libcore/iter.rs index da714671c5723..30c2d3fcb6d5d 100644 --- a/src/libcore/iter.rs +++ b/src/libcore/iter.rs @@ -822,7 +822,7 @@ pub trait Iterator { /// # Examples /// /// ``` - /// # #![feature(core)] + /// # #![feature(iter_min_max)] /// use std::iter::MinMaxResult::{NoElements, OneElement, MinMax}; /// /// let a: [i32; 0] = []; @@ -894,7 +894,7 @@ pub trait Iterator { /// # Examples /// /// ``` - /// # #![feature(core)] + /// # #![feature(iter_cmp)] /// let a = [-3_i32, 0, 1, 5, -10]; /// assert_eq!(*a.iter().max_by(|x| x.abs()).unwrap(), -10); /// ``` @@ -922,7 +922,7 @@ pub trait Iterator { /// # Examples /// /// ``` - /// # #![feature(core)] + /// # #![feature(iter_cmp)] /// let a = [-3_i32, 0, 1, 5, -10]; /// assert_eq!(*a.iter().min_by(|x| x.abs()).unwrap(), 0); /// ``` @@ -1061,12 +1061,12 @@ pub trait Iterator { /// # Examples /// /// ``` - /// # #![feature(core)] + /// # #![feature(iter_arith)] /// let a = [1, 2, 3, 4, 5]; /// let it = a.iter(); /// assert_eq!(it.sum::(), 15); /// ``` - #[unstable(feature="iter_sum", reason = "bounds recently changed")] + #[unstable(feature="iter_arith", reason = "bounds recently changed")] fn sum::Item>(self) -> S where S: Add + Zero, Self: Sized, @@ -1079,7 +1079,7 @@ pub trait Iterator { /// # Examples /// /// ``` - /// # #![feature(core)] + /// # #![feature(iter_arith)] /// fn factorial(n: u32) -> u32 { /// (1..).take_while(|&i| i <= n).product() /// } @@ -1087,7 +1087,7 @@ pub trait Iterator { /// assert_eq!(factorial(1), 1); /// assert_eq!(factorial(5), 120); /// ``` - #[unstable(feature="iter_product", reason = "bounds recently changed")] + #[unstable(feature="iter_arith", reason = "bounds recently changed")] fn product::Item>(self) -> P where P: Mul + One, Self: Sized, @@ -1353,7 +1353,7 @@ impl MinMaxResult { /// # Examples /// /// ``` - /// # #![feature(core)] + /// # #![feature(iter_min_max)] /// use std::iter::MinMaxResult::{self, NoElements, OneElement, MinMax}; /// /// let r: MinMaxResult = NoElements; @@ -2509,7 +2509,7 @@ impl RandomAccessIterator for Inspect /// An iterator that yields sequential Fibonacci numbers, and stops on overflow. /// /// ``` -/// #![feature(core)] +/// #![feature(iter_unfold)] /// use std::iter::Unfold; /// /// // This iterator will yield up to the last Fibonacci number before the max diff --git a/src/libcore/marker.rs b/src/libcore/marker.rs index dc3b06977d6c6..dd60164a114db 100644 --- a/src/libcore/marker.rs +++ b/src/libcore/marker.rs @@ -388,7 +388,7 @@ mod impls { /// that function. Here is an example: /// /// ``` -/// #![feature(core)] +/// #![feature(reflect_marker)] /// use std::marker::Reflect; /// use std::any::Any; /// fn foo(x: &T) { diff --git a/src/libcore/option.rs b/src/libcore/option.rs index 9a00d1071473f..c5203c5111b64 100644 --- a/src/libcore/option.rs +++ b/src/libcore/option.rs @@ -274,7 +274,7 @@ impl Option { /// # Examples /// /// ``` - /// # #![feature(core)] + /// # #![feature(as_slice)] /// let mut x = Some("Diamonds"); /// { /// let v = x.as_mut_slice(); diff --git a/src/libcore/ptr.rs b/src/libcore/ptr.rs index 0f1831e8314d3..31cdb6093c8d9 100644 --- a/src/libcore/ptr.rs +++ b/src/libcore/ptr.rs @@ -49,7 +49,7 @@ //! the raw pointer. It doesn't destroy `T` or deallocate any memory. //! //! ``` -//! # #![feature(alloc)] +//! # #![feature(box_raw)] //! use std::boxed; //! //! unsafe { diff --git a/src/libcore/raw.rs b/src/libcore/raw.rs index 85e1318d7a115..43535ddd1d5c5 100644 --- a/src/libcore/raw.rs +++ b/src/libcore/raw.rs @@ -49,7 +49,7 @@ use mem; /// # Examples /// /// ``` -/// # #![feature(core)] +/// # #![feature(raw)] /// use std::raw::{self, Repr}; /// /// let slice: &[u16] = &[1, 2, 3, 4]; @@ -98,7 +98,7 @@ impl Clone for Slice { /// # Examples /// /// ``` -/// # #![feature(core)] +/// # #![feature(raw)] /// use std::mem; /// use std::raw; /// diff --git a/src/libcore/result.rs b/src/libcore/result.rs index 998657a236dec..7fd845edc3f84 100644 --- a/src/libcore/result.rs +++ b/src/libcore/result.rs @@ -420,7 +420,7 @@ impl Result { /// Converts from `Result` to `&mut [T]` (without copying) /// /// ``` - /// # #![feature(core)] + /// # #![feature(as_slice)] /// let mut x: Result<&str, u32> = Ok("Gold"); /// { /// let v = x.as_mut_slice(); diff --git a/src/libcore/simd.rs b/src/libcore/simd.rs index c3447867ce598..7ecd08bea3574 100644 --- a/src/libcore/simd.rs +++ b/src/libcore/simd.rs @@ -19,7 +19,7 @@ //! provided beyond this module. //! //! ```rust -//! # #![feature(core)] +//! # #![feature(core_simd)] //! fn main() { //! use std::simd::f32x4; //! let a = f32x4(40.0, 41.0, 42.0, 43.0); diff --git a/src/libcoretest/lib.rs b/src/libcoretest/lib.rs index 64e34883ee7df..08536e6320475 100644 --- a/src/libcoretest/lib.rs +++ b/src/libcoretest/lib.rs @@ -8,27 +8,45 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// Do not remove on snapshot creation. Needed for bootstrap. (Issue #22364) -#![cfg_attr(stage0, feature(custom_attribute))] - +#![feature(as_unsafe_cell)] +#![feature(borrow_state)] #![feature(box_syntax)] -#![feature(unboxed_closures)] -#![feature(core)] +#![feature(cell_extras)] +#![feature(cmp_partial)] #![feature(const_fn)] -#![feature(test)] -#![feature(rand)] -#![feature(unicode)] -#![feature(std_misc)] -#![feature(libc)] -#![feature(hash)] -#![feature(unique)] -#![feature(step_by)] -#![feature(slice_patterns)] +#![feature(core)] +#![feature(core_float)] +#![feature(float_extras)] #![feature(float_from_str_radix)] -#![feature(cell_extras)] +#![feature(flt2dec)] +#![feature(fmt_radix)] +#![feature(hash_default)] +#![feature(hasher_write)] +#![feature(iter_arith)] +#![feature(iter_arith)] +#![feature(iter_cmp)] #![feature(iter_empty)] +#![feature(iter_idx)] +#![feature(iter_iterate)] +#![feature(iter_min_max)] #![feature(iter_once)] +#![feature(iter_order)] +#![feature(iter_unfold)] +#![feature(libc)] +#![feature(nonzero)] +#![feature(num_bits_bytes)] +#![feature(ptr_as_ref)] +#![feature(rand)] +#![feature(range_inclusive)] +#![feature(raw)] #![feature(result_expect)] +#![feature(slice_bytes)] +#![feature(slice_patterns)] +#![feature(step_by)] +#![feature(test)] +#![feature(unboxed_closures)] +#![feature(unicode)] +#![feature(unique)] extern crate core; extern crate test; diff --git a/src/libcoretest/option.rs b/src/libcoretest/option.rs index 4b445c84e8f58..04271ed5dd1a1 100644 --- a/src/libcoretest/option.rs +++ b/src/libcoretest/option.rs @@ -9,7 +9,6 @@ // except according to those terms. use core::option::*; -use core::marker; use core::mem; use core::clone::Clone; @@ -81,7 +80,8 @@ fn test_option_dance() { #[test] #[should_panic] fn test_option_too_much_dance() { - let mut y = Some(marker::NoCopy); + struct A; + let mut y = Some(A); let _y2 = y.take().unwrap(); let _y3 = y.take().unwrap(); } diff --git a/src/libflate/lib.rs b/src/libflate/lib.rs index 606352ea14b22..58cdf1133ec6a 100644 --- a/src/libflate/lib.rs +++ b/src/libflate/lib.rs @@ -28,7 +28,7 @@ #![feature(libc)] #![feature(staged_api)] #![feature(unique)] -#![cfg_attr(test, feature(rustc_private, rand, collections))] +#![cfg_attr(test, feature(rustc_private, rand, vec_push_all))] #[cfg(test)] #[macro_use] extern crate log; diff --git a/src/librand/lib.rs b/src/librand/lib.rs index 6a6adb0db6b45..ec510b4a5bdfb 100644 --- a/src/librand/lib.rs +++ b/src/librand/lib.rs @@ -37,7 +37,7 @@ #![feature(staged_api)] #![feature(step_by)] -#![cfg_attr(test, feature(test, rand, rustc_private))] +#![cfg_attr(test, feature(test, rand, rustc_private, iter_order))] #![allow(deprecated)] diff --git a/src/librustc/lib.rs b/src/librustc/lib.rs index b557b0f564941..377b60570e5fa 100644 --- a/src/librustc/lib.rs +++ b/src/librustc/lib.rs @@ -40,7 +40,8 @@ #![feature(hash_default)] #![feature(hashmap_hasher)] #![feature(into_cow)] -#![feature(iter_sum)] +#![feature(iter_cmp)] +#![feature(iter_arith)] #![feature(libc)] #![feature(map_in_place)] #![feature(num_bits_bytes)] diff --git a/src/librustc_bitflags/lib.rs b/src/librustc_bitflags/lib.rs index 6d23cad26cb37..b59c24cf12bdb 100644 --- a/src/librustc_bitflags/lib.rs +++ b/src/librustc_bitflags/lib.rs @@ -19,7 +19,7 @@ #![feature(no_std)] #![no_std] #![unstable(feature = "rustc_private")] -#![cfg_attr(test, feature(hash))] +#![cfg_attr(test, feature(hash_default))] //! A typesafe bitmask flag generator. diff --git a/src/librustc_driver/lib.rs b/src/librustc_driver/lib.rs index e369ca46b2c02..052ec4897d131 100644 --- a/src/librustc_driver/lib.rs +++ b/src/librustc_driver/lib.rs @@ -33,7 +33,6 @@ #![feature(rustc_private)] #![feature(set_stdio)] #![feature(staged_api)] -#![feature(str_casing)] #![feature(vec_push_all)] extern crate arena; diff --git a/src/librustc_lint/lib.rs b/src/librustc_lint/lib.rs index d53689bb1d164..c680906dd135b 100644 --- a/src/librustc_lint/lib.rs +++ b/src/librustc_lint/lib.rs @@ -39,7 +39,6 @@ #![feature(rustc_diagnostic_macros)] #![feature(rustc_private)] #![feature(staged_api)] -#![feature(str_casing)] #![feature(str_char)] extern crate syntax; diff --git a/src/librustc_trans/lib.rs b/src/librustc_trans/lib.rs index 978fa4e745b99..a1e1b395d987d 100644 --- a/src/librustc_trans/lib.rs +++ b/src/librustc_trans/lib.rs @@ -30,7 +30,7 @@ #![feature(const_fn)] #![feature(fs)] #![feature(iter_cmp)] -#![feature(iter_sum)] +#![feature(iter_arith)] #![feature(iter_unfold)] #![feature(libc)] #![feature(once_new)] diff --git a/src/librustc_typeck/lib.rs b/src/librustc_typeck/lib.rs index f204fa2b1fd01..764910100360a 100644 --- a/src/librustc_typeck/lib.rs +++ b/src/librustc_typeck/lib.rs @@ -79,7 +79,7 @@ This API is completely unstable and subject to change. #![feature(box_syntax)] #![feature(drain)] #![feature(iter_cmp)] -#![feature(iter_sum)] +#![feature(iter_arith)] #![feature(quote)] #![feature(ref_slice)] #![feature(rustc_diagnostic_macros)] diff --git a/src/librustc_unicode/lib.rs b/src/librustc_unicode/lib.rs index 750df19047d73..b420444d1f5c8 100644 --- a/src/librustc_unicode/lib.rs +++ b/src/librustc_unicode/lib.rs @@ -38,7 +38,7 @@ #![feature(core_prelude)] #![feature(core_slice_ext)] #![feature(core_str_ext)] -#![feature(iter_sum)] +#![feature(iter_arith)] #![feature(lang_items)] #![feature(no_std)] #![feature(staged_api)] diff --git a/src/librustdoc/lib.rs b/src/librustdoc/lib.rs index 38cc120698431..9db9af32baa15 100644 --- a/src/librustdoc/lib.rs +++ b/src/librustdoc/lib.rs @@ -22,18 +22,21 @@ #![feature(box_patterns)] #![feature(box_syntax)] -#![feature(collections)] +#![feature(dynamic_lib)] #![feature(exit_status)] -#![feature(set_stdio)] #![feature(libc)] +#![feature(owned_ascii_ext)] +#![feature(path_ext)] +#![feature(path_relative_from)] #![feature(rustc_private)] +#![feature(set_stdio)] +#![feature(slice_extras)] +#![feature(slice_patterns)] #![feature(staged_api)] -#![feature(std_misc)] +#![feature(subslice_offset)] #![feature(test)] #![feature(unicode)] -#![feature(path_ext)] -#![feature(path_relative_from)] -#![feature(slice_patterns)] +#![feature(vec_push_all)] extern crate arena; extern crate getopts; diff --git a/src/libstd/lib.rs b/src/libstd/lib.rs index fb510ed678271..9f9435f412339 100644 --- a/src/libstd/lib.rs +++ b/src/libstd/lib.rs @@ -149,8 +149,8 @@ #![feature(vec_push_all)] #![feature(wrapping)] #![feature(zero_one)] -#![cfg_attr(test, feature(float_from_str_radix))] -#![cfg_attr(test, feature(test, rustc_private))] +#![cfg_attr(test, feature(float_from_str_radix, range_inclusive, float_extras))] +#![cfg_attr(test, feature(test, rustc_private, float_consts))] // Don't link to std. We are std. #![no_std] diff --git a/src/libstd/sync/future.rs b/src/libstd/sync/future.rs index 76b07999280d0..f5b6650a49833 100644 --- a/src/libstd/sync/future.rs +++ b/src/libstd/sync/future.rs @@ -14,7 +14,7 @@ //! # Examples //! //! ``` -//! # #![feature(std_misc)] +//! # #![feature(future)] //! use std::sync::Future; //! //! // a fake, for now diff --git a/src/libstd/sync/mutex.rs b/src/libstd/sync/mutex.rs index 5f77ee2054591..1d63014295922 100644 --- a/src/libstd/sync/mutex.rs +++ b/src/libstd/sync/mutex.rs @@ -85,6 +85,8 @@ use sys_common::poison::{self, TryLockError, TryLockResult, LockResult}; /// To recover from a poisoned mutex: /// /// ``` +/// #![feature(sync_poison)] +/// /// use std::sync::{Arc, Mutex}; /// use std::thread; /// diff --git a/src/libstd/sync/semaphore.rs b/src/libstd/sync/semaphore.rs index 0278a6c95b982..dc9e467a8b135 100644 --- a/src/libstd/sync/semaphore.rs +++ b/src/libstd/sync/semaphore.rs @@ -25,7 +25,7 @@ use sync::{Mutex, Condvar}; /// # Examples /// /// ``` -/// # #![feature(std_misc)] +/// # #![feature(semaphore)] /// use std::sync::Semaphore; /// /// // Create a semaphore that represents 5 resources diff --git a/src/libtest/lib.rs b/src/libtest/lib.rs index 4664968913466..1507226c3a133 100644 --- a/src/libtest/lib.rs +++ b/src/libtest/lib.rs @@ -41,11 +41,12 @@ #![feature(fnbox)] #![feature(iter_cmp)] #![feature(libc)] +#![feature(rt)] #![feature(rustc_private)] #![feature(set_stdio)] #![feature(slice_extras)] #![feature(staged_api)] -#![feature(std_misc)] +#![feature(thunk)] extern crate getopts; extern crate serialize; diff --git a/src/rustbook/main.rs b/src/rustbook/main.rs index e79462a4aafe2..707493e85189c 100644 --- a/src/rustbook/main.rs +++ b/src/rustbook/main.rs @@ -11,7 +11,7 @@ #![deny(warnings)] #![feature(exit_status)] -#![feature(iter_sum)] +#![feature(iter_arith)] #![feature(path_relative_from)] #![feature(rustc_private)] #![feature(rustdoc)] diff --git a/src/test/auxiliary/linkage-visibility.rs b/src/test/auxiliary/linkage-visibility.rs index 9196a156ad1c9..ce3360787136a 100644 --- a/src/test/auxiliary/linkage-visibility.rs +++ b/src/test/auxiliary/linkage-visibility.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(std_misc)] +#![feature(dynamic_lib)] // We're testing linkage visibility; the compiler warns us, but we want to // do the runtime check that these functions aren't exported. diff --git a/src/test/bench/core-set.rs b/src/test/bench/core-set.rs index eebf6feaffac3..d2537e09901cb 100644 --- a/src/test/bench/core-set.rs +++ b/src/test/bench/core-set.rs @@ -11,6 +11,7 @@ // ignore-pretty very bad with line comments #![feature(unboxed_closures, rand, std_misc, collections, duration, duration_span)] +#![feature(bitset)] extern crate collections; extern crate rand; diff --git a/src/test/bench/core-std.rs b/src/test/bench/core-std.rs index 95d74c6aa7f45..3cc03f5218ceb 100644 --- a/src/test/bench/core-std.rs +++ b/src/test/bench/core-std.rs @@ -10,7 +10,7 @@ // Microbenchmarks for various functions in std and extra -#![feature(rand, collections, std_misc, duration, duration_span)] +#![feature(rand, vec_push_all, duration, duration_span)] use std::iter::repeat; use std::mem::swap; diff --git a/src/test/bench/msgsend-ring-mutex-arcs.rs b/src/test/bench/msgsend-ring-mutex-arcs.rs index 93e3394097bc5..24ecaf4b02471 100644 --- a/src/test/bench/msgsend-ring-mutex-arcs.rs +++ b/src/test/bench/msgsend-ring-mutex-arcs.rs @@ -17,7 +17,7 @@ // no-pretty-expanded FIXME #15189 -#![feature(duration, duration_span, std_misc)] +#![feature(duration, duration_span, future)] use std::env; use std::sync::{Arc, Future, Mutex, Condvar}; diff --git a/src/test/bench/shootout-k-nucleotide.rs b/src/test/bench/shootout-k-nucleotide.rs index 0cbef937e726d..8ae07558c168f 100644 --- a/src/test/bench/shootout-k-nucleotide.rs +++ b/src/test/bench/shootout-k-nucleotide.rs @@ -40,7 +40,7 @@ // ignore-android: FIXME(#10393) hangs without output -#![feature(box_syntax, std_misc, collections)] +#![feature(box_syntax, owned_ascii_ext, vec_push_all)] use std::ascii::OwnedAsciiExt; use std::env; diff --git a/src/test/bench/shootout-mandelbrot.rs b/src/test/bench/shootout-mandelbrot.rs index 4ae788454e3e8..232d6b414f580 100644 --- a/src/test/bench/shootout-mandelbrot.rs +++ b/src/test/bench/shootout-mandelbrot.rs @@ -38,7 +38,7 @@ // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED // OF THE POSSIBILITY OF SUCH DAMAGE. -#![feature(simd, core)] +#![feature(core_simd, core)] // ignore-pretty very bad with line comments diff --git a/src/test/bench/shootout-meteor.rs b/src/test/bench/shootout-meteor.rs index cb89f51210ca7..aa40f6f868c30 100644 --- a/src/test/bench/shootout-meteor.rs +++ b/src/test/bench/shootout-meteor.rs @@ -40,7 +40,7 @@ // no-pretty-expanded FIXME #15189 -#![feature(core)] +#![feature(iter_cmp)] use std::iter::repeat; use std::sync::Arc; diff --git a/src/test/bench/shootout-spectralnorm.rs b/src/test/bench/shootout-spectralnorm.rs index 6ddf232810461..1598b20922338 100644 --- a/src/test/bench/shootout-spectralnorm.rs +++ b/src/test/bench/shootout-spectralnorm.rs @@ -41,14 +41,11 @@ // no-pretty-expanded FIXME #15189 #![allow(non_snake_case)] -#![feature(unboxed_closures, core, os, scoped)] +#![feature(unboxed_closures, iter_arith, core_simd, scoped)] use std::iter::repeat; use std::thread; -use std::mem; -use std::os; use std::env; -use std::raw::Repr; use std::simd::f64x2; fn main() { diff --git a/src/test/bench/std-smallintmap.rs b/src/test/bench/std-smallintmap.rs index d7e556a124fe1..6a39a6db0c728 100644 --- a/src/test/bench/std-smallintmap.rs +++ b/src/test/bench/std-smallintmap.rs @@ -10,7 +10,7 @@ // Microbenchmark for the smallintmap library -#![feature(collections, duration, duration_span)] +#![feature(vecmap, duration, duration_span)] use std::collections::VecMap; use std::env; diff --git a/src/test/bench/task-perf-alloc-unwind.rs b/src/test/bench/task-perf-alloc-unwind.rs index babae4d149f52..3bd7b78125112 100644 --- a/src/test/bench/task-perf-alloc-unwind.rs +++ b/src/test/bench/task-perf-alloc-unwind.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(box_syntax, duration, duration_span, collections)] +#![feature(box_syntax, duration, duration_span, vec_push_all)] use std::env; use std::thread; diff --git a/src/test/compile-fail/feature-gate-simd-ffi.rs b/src/test/compile-fail/feature-gate-simd-ffi.rs index dcd7a0ded812f..32c50b1b8c159 100644 --- a/src/test/compile-fail/feature-gate-simd-ffi.rs +++ b/src/test/compile-fail/feature-gate-simd-ffi.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(simd, core)] +#![feature(simd, core_simd)] #![allow(dead_code)] use std::simd::f32x4; diff --git a/src/test/compile-fail/lint-dead-code-4.rs b/src/test/compile-fail/lint-dead-code-4.rs index 3a9baecb9c60e..529113ace4ef9 100644 --- a/src/test/compile-fail/lint-dead-code-4.rs +++ b/src/test/compile-fail/lint-dead-code-4.rs @@ -11,15 +11,10 @@ #![allow(unused_variables)] #![allow(non_camel_case_types)] #![deny(dead_code)] -#![feature(libc)] -#![feature(core)] - -extern crate libc; struct Foo { x: usize, b: bool, //~ ERROR: struct field is never used - marker: std::marker::NoCopy } fn field_read(f: Foo) -> usize { @@ -50,7 +45,7 @@ struct Bar { #[repr(C)] struct Baz { - x: libc::c_uint + x: u32, } fn field_match_in_let(f: Bar) -> bool { @@ -59,7 +54,7 @@ fn field_match_in_let(f: Bar) -> bool { } fn main() { - field_read(Foo { x: 1, b: false, marker: std::marker::NoCopy }); + field_read(Foo { x: 1, b: false }); field_match_in_patterns(XYZ::Z); field_match_in_let(Bar { x: 42, b: true, _guard: () }); let _ = Baz { x: 0 }; diff --git a/src/test/compile-fail/lint-exceeding-bitshifts.rs b/src/test/compile-fail/lint-exceeding-bitshifts.rs index 1f70828e411ef..5867bc2f09deb 100644 --- a/src/test/compile-fail/lint-exceeding-bitshifts.rs +++ b/src/test/compile-fail/lint-exceeding-bitshifts.rs @@ -12,7 +12,7 @@ #![deny(exceeding_bitshifts)] #![allow(unused_variables)] #![allow(dead_code)] -#![feature(core, negate_unsigned)] +#![feature(num_bits_bytes, negate_unsigned)] fn main() { let n = 1u8 << 7; diff --git a/src/test/debuginfo/constant-debug-locs.rs b/src/test/debuginfo/constant-debug-locs.rs index 8032b53e9dd7c..ec5a6fa3d3f16 100644 --- a/src/test/debuginfo/constant-debug-locs.rs +++ b/src/test/debuginfo/constant-debug-locs.rs @@ -14,8 +14,8 @@ #![allow(dead_code, unused_variables)] #![omit_gdb_pretty_printer_section] -#![feature(std_misc, core)] #![feature(const_fn)] +#![feature(static_mutex)] // This test makes sure that the compiler doesn't crash when trying to assign // debug locations to const-expressions. diff --git a/src/test/debuginfo/simd.rs b/src/test/debuginfo/simd.rs index 7b337ba2cc8a6..6bc8892a83a69 100644 --- a/src/test/debuginfo/simd.rs +++ b/src/test/debuginfo/simd.rs @@ -42,7 +42,7 @@ #![allow(unused_variables)] #![omit_gdb_pretty_printer_section] -#![feature(core)] +#![feature(core_simd)] use std::simd::{i8x16, i16x8,i32x4,i64x2,u8x16,u16x8,u32x4,u64x2,f32x4,f64x2}; diff --git a/src/test/run-make/extern-fn-reachable/main.rs b/src/test/run-make/extern-fn-reachable/main.rs index 244f32b8ee5fc..b53a870e2001c 100644 --- a/src/test/run-make/extern-fn-reachable/main.rs +++ b/src/test/run-make/extern-fn-reachable/main.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(std_misc)] +#![feature(dynamic_lib)] use std::dynamic_lib::DynamicLibrary; use std::path::Path; diff --git a/src/test/run-make/intrinsic-unreachable/exit-unreachable.rs b/src/test/run-make/intrinsic-unreachable/exit-unreachable.rs index 81ed446595ab0..f58d2cd8f91d8 100644 --- a/src/test/run-make/intrinsic-unreachable/exit-unreachable.rs +++ b/src/test/run-make/intrinsic-unreachable/exit-unreachable.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(asm, core)] +#![feature(asm, core_intrinsics)] #![crate_type="lib"] use std::intrinsics; diff --git a/src/test/run-make/volatile-intrinsics/main.rs b/src/test/run-make/volatile-intrinsics/main.rs index 217dee4b881c7..6c6afdc13030c 100644 --- a/src/test/run-make/volatile-intrinsics/main.rs +++ b/src/test/run-make/volatile-intrinsics/main.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(core)] +#![feature(core_intrinsics)] use std::intrinsics::{volatile_load, volatile_store}; diff --git a/src/test/run-pass/binary-heap-panic-safe.rs b/src/test/run-pass/binary-heap-panic-safe.rs index 4888a8b84fc42..61a7fab130928 100644 --- a/src/test/run-pass/binary-heap-panic-safe.rs +++ b/src/test/run-pass/binary-heap-panic-safe.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(std_misc, collections, catch_panic, rand)] +#![feature(std_misc, collections, catch_panic, rand, sync_poison)] use std::__rand::{thread_rng, Rng}; use std::thread; diff --git a/src/test/run-pass/bitv-perf-test.rs b/src/test/run-pass/bitv-perf-test.rs index c9a2e07dd8398..3ab154356c4b6 100644 --- a/src/test/run-pass/bitv-perf-test.rs +++ b/src/test/run-pass/bitv-perf-test.rs @@ -10,16 +10,14 @@ // pretty-expanded FIXME #23616 -#![allow(unknown_features)] -#![feature(box_syntax, collections)] +#![feature(bitvec)] -extern crate collections; use std::collections::BitVec; fn bitv_test() { - let mut v1: Box<_> = box BitVec::from_elem(31, false); - let v2: Box<_> = box BitVec::from_elem(31, true); - v1.union(&*v2); + let mut v1 = BitVec::from_elem(31, false); + let v2 = BitVec::from_elem(31, true); + v1.union(&v2); } pub fn main() { diff --git a/src/test/run-pass/deriving-hash.rs b/src/test/run-pass/deriving-hash.rs index b5fb5205d7c38..ba1d8228863ad 100644 --- a/src/test/run-pass/deriving-hash.rs +++ b/src/test/run-pass/deriving-hash.rs @@ -9,7 +9,7 @@ // except according to those terms. -#![feature(hash)] +#![feature(hash_default)] use std::hash::{Hash, SipHasher}; diff --git a/src/test/run-pass/discriminant_value.rs b/src/test/run-pass/discriminant_value.rs index 217e696f09538..13257529ed9f8 100644 --- a/src/test/run-pass/discriminant_value.rs +++ b/src/test/run-pass/discriminant_value.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(core)] +#![feature(core, core_intrinsics)] extern crate core; use core::intrinsics::discriminant_value; diff --git a/src/test/run-pass/dst-coerce-custom.rs b/src/test/run-pass/dst-coerce-custom.rs index aa28ae00e2772..6eb01e879df57 100644 --- a/src/test/run-pass/dst-coerce-custom.rs +++ b/src/test/run-pass/dst-coerce-custom.rs @@ -10,7 +10,7 @@ // Test a very simple custom DST coercion. -#![feature(core)] +#![feature(unsize, coerce_unsized)] use std::ops::CoerceUnsized; use std::marker::Unsize; diff --git a/src/test/run-pass/enum-null-pointer-opt.rs b/src/test/run-pass/enum-null-pointer-opt.rs index 499d131947a38..dd88dc11ea70e 100644 --- a/src/test/run-pass/enum-null-pointer-opt.rs +++ b/src/test/run-pass/enum-null-pointer-opt.rs @@ -8,8 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. - -#![feature(core)] +#![feature(nonzero, core)] extern crate core; diff --git a/src/test/run-pass/fat-ptr-cast.rs b/src/test/run-pass/fat-ptr-cast.rs index 0926386ef93c4..58296c3f95ef9 100644 --- a/src/test/run-pass/fat-ptr-cast.rs +++ b/src/test/run-pass/fat-ptr-cast.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(core)] +#![feature(raw)] use std::mem; use std::raw; diff --git a/src/test/run-pass/for-loop-no-std.rs b/src/test/run-pass/for-loop-no-std.rs index 6deaec1905960..a1bd77a74f725 100644 --- a/src/test/run-pass/for-loop-no-std.rs +++ b/src/test/run-pass/for-loop-no-std.rs @@ -10,7 +10,7 @@ // pretty-expanded FIXME #23616 -#![feature(lang_items, start, no_std, core, collections)] +#![feature(lang_items, start, no_std, core_slice_ext, core, collections)] #![no_std] extern crate std as other; diff --git a/src/test/run-pass/format-no-std.rs b/src/test/run-pass/format-no-std.rs index 9204cdfd755b6..1452cefbd5c2b 100644 --- a/src/test/run-pass/format-no-std.rs +++ b/src/test/run-pass/format-no-std.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// pretty-expanded FIXME #23616 - #![feature(lang_items, start, no_std, core, collections)] #![no_std] diff --git a/src/test/run-pass/into-iterator-type-inference-shift.rs b/src/test/run-pass/into-iterator-type-inference-shift.rs index 9ccf1c3bbb803..7ec18ef127690 100644 --- a/src/test/run-pass/into-iterator-type-inference-shift.rs +++ b/src/test/run-pass/into-iterator-type-inference-shift.rs @@ -15,10 +15,6 @@ // pretty-expanded FIXME #23616 -#![feature(core)] - -use std::u8; - trait IntoIterator { type Iter: Iterator; @@ -35,7 +31,7 @@ impl IntoIterator for I where I: Iterator { fn desugared_for_loop_bad(byte: u8) -> u8 { let mut result = 0; - let mut x = IntoIterator::into_iter(0..u8::BITS); + let mut x = IntoIterator::into_iter(0..8); let mut y = Iterator::next(&mut x); let mut z = y.unwrap(); byte >> z; diff --git a/src/test/run-pass/intrinsic-assume.rs b/src/test/run-pass/intrinsic-assume.rs index ff7d799f64c5f..41ef62b0ced3d 100644 --- a/src/test/run-pass/intrinsic-assume.rs +++ b/src/test/run-pass/intrinsic-assume.rs @@ -8,8 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. - -#![feature(core)] +#![feature(core_intrinsics)] use std::intrinsics::assume; diff --git a/src/test/run-pass/intrinsic-move-val-cleanups.rs b/src/test/run-pass/intrinsic-move-val-cleanups.rs index bc7a654f867ea..9fd4f2133b70d 100644 --- a/src/test/run-pass/intrinsic-move-val-cleanups.rs +++ b/src/test/run-pass/intrinsic-move-val-cleanups.rs @@ -18,7 +18,7 @@ // introduce temporaries that require cleanup, and SOURCE panics, then // make sure the cleanups still occur. -#![feature(core, std_misc)] +#![feature(core_intrinsics, sync_poison)] use std::cell::RefCell; use std::intrinsics; diff --git a/src/test/run-pass/intrinsic-unreachable.rs b/src/test/run-pass/intrinsic-unreachable.rs index a86fc110ae4eb..0ce446e445c73 100644 --- a/src/test/run-pass/intrinsic-unreachable.rs +++ b/src/test/run-pass/intrinsic-unreachable.rs @@ -8,8 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. - -#![feature(core)] +#![feature(core_intrinsics)] use std::intrinsics; diff --git a/src/test/run-pass/issue-11709.rs b/src/test/run-pass/issue-11709.rs index 3ad78f088f9c9..3eaa5632395b7 100644 --- a/src/test/run-pass/issue-11709.rs +++ b/src/test/run-pass/issue-11709.rs @@ -15,7 +15,7 @@ // when this bug was opened. The cases where the compiler // panics before the fix have a comment. -#![feature(std_misc)] +#![feature(thunk)] use std::thunk::Thunk; diff --git a/src/test/run-pass/issue-11736.rs b/src/test/run-pass/issue-11736.rs index b4621a2d053b1..9b30305a1969d 100644 --- a/src/test/run-pass/issue-11736.rs +++ b/src/test/run-pass/issue-11736.rs @@ -10,7 +10,7 @@ // pretty-expanded FIXME #23616 -#![feature(collections)] +#![feature(bitvec)] use std::collections::BitVec; diff --git a/src/test/run-pass/issue-11958.rs b/src/test/run-pass/issue-11958.rs index def85b4766783..e0c43422c2823 100644 --- a/src/test/run-pass/issue-11958.rs +++ b/src/test/run-pass/issue-11958.rs @@ -11,7 +11,7 @@ // pretty-expanded FIXME #23616 #![forbid(warnings)] -#![feature(std_misc)] +#![feature(thunk)] // Pretty printing tests complain about `use std::predule::*` #![allow(unused_imports)] diff --git a/src/test/run-pass/issue-13494.rs b/src/test/run-pass/issue-13494.rs index 71897ea68c209..e94368925abee 100644 --- a/src/test/run-pass/issue-13494.rs +++ b/src/test/run-pass/issue-13494.rs @@ -11,9 +11,7 @@ // This test may not always fail, but it can be flaky if the race it used to // expose is still present. -// pretty-expanded FIXME #23616 - -#![feature(std_misc)] +#![feature(mpsc_select)] use std::sync::mpsc::{channel, Sender, Receiver}; use std::thread; diff --git a/src/test/run-pass/issue-13763.rs b/src/test/run-pass/issue-13763.rs index e11270c94ca54..0ea38596335d8 100644 --- a/src/test/run-pass/issue-13763.rs +++ b/src/test/run-pass/issue-13763.rs @@ -10,7 +10,7 @@ // pretty-expanded FIXME #23616 -#![feature(core)] +#![feature(num_bits_bytes)] use std::u8; diff --git a/src/test/run-pass/issue-15673.rs b/src/test/run-pass/issue-15673.rs index c478ca041148a..ff9a17323e433 100644 --- a/src/test/run-pass/issue-15673.rs +++ b/src/test/run-pass/issue-15673.rs @@ -8,8 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. - -#![feature(core)] +#![feature(iter_arith)] fn main() { let x: [u64; 3] = [1, 2, 3]; diff --git a/src/test/run-pass/issue-16530.rs b/src/test/run-pass/issue-16530.rs index bc144ee33306d..1f96f071e9d11 100644 --- a/src/test/run-pass/issue-16530.rs +++ b/src/test/run-pass/issue-16530.rs @@ -8,8 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. - -#![feature(hash)] +#![feature(hash_default)] use std::hash::{SipHasher, hash}; diff --git a/src/test/run-pass/issue-17897.rs b/src/test/run-pass/issue-17897.rs index cf8c54fdd8086..227c81e2766fd 100644 --- a/src/test/run-pass/issue-17897.rs +++ b/src/test/run-pass/issue-17897.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(unboxed_closures, std_misc)] +#![feature(thunk)] use std::thunk::Thunk; diff --git a/src/test/run-pass/issue-18188.rs b/src/test/run-pass/issue-18188.rs index 059d25173c2ad..5bcb052282c19 100644 --- a/src/test/run-pass/issue-18188.rs +++ b/src/test/run-pass/issue-18188.rs @@ -10,7 +10,7 @@ // pretty-expanded FIXME #23616 -#![feature(unboxed_closures, std_misc)] +#![feature(thunk)] use std::thunk::Thunk; diff --git a/src/test/run-pass/issue-21058.rs b/src/test/run-pass/issue-21058.rs index c384757c5e4fb..9e8bfc884c984 100644 --- a/src/test/run-pass/issue-21058.rs +++ b/src/test/run-pass/issue-21058.rs @@ -8,8 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. - -#![feature(core)] +#![feature(core_intrinsics)] struct NT(str); struct DST { a: u32, b: str } diff --git a/src/test/run-pass/issue-2190-1.rs b/src/test/run-pass/issue-2190-1.rs index 5c84c30aa7fa3..eeca4498328d3 100644 --- a/src/test/run-pass/issue-2190-1.rs +++ b/src/test/run-pass/issue-2190-1.rs @@ -10,7 +10,7 @@ // pretty-expanded FIXME #23616 -#![feature(std_misc)] +#![feature(thunk)] use std::thread::Builder; use std::thunk::Thunk; diff --git a/src/test/run-pass/issue-23037.rs b/src/test/run-pass/issue-23037.rs index 5257daa047af8..a8abbda32bdfc 100644 --- a/src/test/run-pass/issue-23037.rs +++ b/src/test/run-pass/issue-23037.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(core)] +#![feature(core_simd)] use std::simd::i32x4; fn main() { diff --git a/src/test/run-pass/issue-23550.rs b/src/test/run-pass/issue-23550.rs index 9b5ca23565e0d..4b6d593f592d9 100644 --- a/src/test/run-pass/issue-23550.rs +++ b/src/test/run-pass/issue-23550.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(core)] +#![feature(core_intrinsics)] #![allow(warnings)] use std::intrinsics; diff --git a/src/test/run-pass/issue-6898.rs b/src/test/run-pass/issue-6898.rs index 3138aad2c8cc9..8ea0804af18bf 100644 --- a/src/test/run-pass/issue-6898.rs +++ b/src/test/run-pass/issue-6898.rs @@ -10,9 +10,7 @@ // pretty-expanded FIXME #23616 -#![feature(core)] - -use std::intrinsics; +use std::mem; /// Returns the size of a type pub fn size_of() -> usize { @@ -32,7 +30,7 @@ pub trait TypeInfo { impl TypeInfo for T { /// The size of the type in bytes. fn size_of(_lame_type_hint: Option) -> usize { - unsafe { intrinsics::size_of::() } + mem::size_of::() } /// Returns the size of the type of `self` in bytes. diff --git a/src/test/run-pass/iter-cloned-type-inference.rs b/src/test/run-pass/iter-cloned-type-inference.rs index 59f7569d8c62b..e3351bda3354d 100644 --- a/src/test/run-pass/iter-cloned-type-inference.rs +++ b/src/test/run-pass/iter-cloned-type-inference.rs @@ -11,8 +11,7 @@ // Test to see that the element type of .cloned() can be inferred // properly. Previously this would fail to deduce the type of `sum`. - -#![feature(core)] +#![feature(iter_arith)] fn square_sum(v: &[i64]) -> i64 { let sum: i64 = v.iter().cloned().sum(); diff --git a/src/test/run-pass/linkage-visibility.rs b/src/test/run-pass/linkage-visibility.rs index b8ad7162d2868..e6eaefb049080 100644 --- a/src/test/run-pass/linkage-visibility.rs +++ b/src/test/run-pass/linkage-visibility.rs @@ -13,8 +13,6 @@ // ignore-windows: std::dynamic_lib does not work on Windows well // ignore-musl -#![feature(std_misc)] - extern crate linkage_visibility as foo; pub fn main() { diff --git a/src/test/run-pass/method-mut-self-modifies-mut-slice-lvalue.rs b/src/test/run-pass/method-mut-self-modifies-mut-slice-lvalue.rs index 5b104d4bb0c7e..405a3549cf18c 100644 --- a/src/test/run-pass/method-mut-self-modifies-mut-slice-lvalue.rs +++ b/src/test/run-pass/method-mut-self-modifies-mut-slice-lvalue.rs @@ -13,7 +13,7 @@ // temporary. Issue #19147. -#![feature(core)] +#![feature(slice_bytes)] use std::slice; diff --git a/src/test/run-pass/minmax-stability-issue-23687.rs b/src/test/run-pass/minmax-stability-issue-23687.rs index 86dd1a04532b4..62bde45cd3dc0 100644 --- a/src/test/run-pass/minmax-stability-issue-23687.rs +++ b/src/test/run-pass/minmax-stability-issue-23687.rs @@ -8,7 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(core)] +#![feature(iter_min_max, cmp_partial, iter_cmp)] + use std::fmt::Debug; use std::cmp::{self, PartialOrd, Ordering}; use std::iter::MinMaxResult::MinMax; diff --git a/src/test/run-pass/new-box-syntax.rs b/src/test/run-pass/new-box-syntax.rs index 95168b1bff788..b5a54a90ae758 100644 --- a/src/test/run-pass/new-box-syntax.rs +++ b/src/test/run-pass/new-box-syntax.rs @@ -13,8 +13,8 @@ /* Any copyright is dedicated to the Public Domain. * http://creativecommons.org/publicdomain/zero/1.0/ */ -#![allow(unknown_features)] -#![feature(box_syntax, alloc)] +#![allow(warnings)] +#![feature(box_syntax, box_heap)] // Tests that the new `box` syntax works with unique pointers. diff --git a/src/test/run-pass/realloc-16687.rs b/src/test/run-pass/realloc-16687.rs index cd9cc0901202c..a9bd967ca765a 100644 --- a/src/test/run-pass/realloc-16687.rs +++ b/src/test/run-pass/realloc-16687.rs @@ -13,7 +13,7 @@ // Ideally this would be revised to use no_std, but for now it serves // well enough to reproduce (and illustrate) the bug from #16687. -#![feature(alloc)] +#![feature(heap_api, alloc, oom)] extern crate alloc; diff --git a/src/test/run-pass/running-with-no-runtime.rs b/src/test/run-pass/running-with-no-runtime.rs index db543116d17a5..2b2dcb6efb5d4 100644 --- a/src/test/run-pass/running-with-no-runtime.rs +++ b/src/test/run-pass/running-with-no-runtime.rs @@ -8,11 +8,11 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(start, std_misc)] +#![feature(catch_panic, start)] use std::ffi::CStr; use std::process::{Command, Output}; -use std::rt::unwind::try; +use std::thread; use std::str; #[start] @@ -22,8 +22,8 @@ fn start(argc: isize, argv: *const *const u8) -> isize { match **argv.offset(1) as char { '1' => {} '2' => println!("foo"), - '3' => assert!(try(|| {}).is_ok()), - '4' => assert!(try(|| panic!()).is_err()), + '3' => assert!(thread::catch_panic(|| {}).is_ok()), + '4' => assert!(thread::catch_panic(|| panic!()).is_err()), '5' => assert!(Command::new("test").spawn().is_err()), _ => panic!() } diff --git a/src/test/run-pass/send-is-not-static-par-for.rs b/src/test/run-pass/send-is-not-static-par-for.rs index 5f0902d34d3e8..e40f4d30eb978 100644 --- a/src/test/run-pass/send-is-not-static-par-for.rs +++ b/src/test/run-pass/send-is-not-static-par-for.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// pretty-expanded FIXME #23616 - #![feature(core, std_misc, scoped)] use std::thread; use std::sync::Mutex; diff --git a/src/test/run-pass/simd-binop.rs b/src/test/run-pass/simd-binop.rs index 3ebf2a87361f6..4f5119f6a84e9 100644 --- a/src/test/run-pass/simd-binop.rs +++ b/src/test/run-pass/simd-binop.rs @@ -9,7 +9,7 @@ // except according to those terms. -#![feature(core)] +#![feature(core_simd)] use std::simd::{i32x4, f32x4, u32x4}; diff --git a/src/test/run-pass/simd-issue-10604.rs b/src/test/run-pass/simd-issue-10604.rs index 8dca78b28e802..c3eef0f9c3217 100644 --- a/src/test/run-pass/simd-issue-10604.rs +++ b/src/test/run-pass/simd-issue-10604.rs @@ -10,8 +10,7 @@ // pretty-expanded FIXME #23616 -#![feature(core)] -#![feature(simd)] +#![feature(core_simd)] pub fn main() { let _o = None::; diff --git a/src/test/run-pass/slice-of-zero-size-elements.rs b/src/test/run-pass/slice-of-zero-size-elements.rs index 6fe510586c748..ab22b820503af 100644 --- a/src/test/run-pass/slice-of-zero-size-elements.rs +++ b/src/test/run-pass/slice-of-zero-size-elements.rs @@ -10,7 +10,7 @@ // compile-flags: -C debug-assertions -#![feature(core)] +#![feature(iter_to_slice)] use std::slice; diff --git a/src/test/run-pass/std-sync-right-kind-impls.rs b/src/test/run-pass/std-sync-right-kind-impls.rs index 36314c5e14ac2..b8e05c06c83b7 100644 --- a/src/test/run-pass/std-sync-right-kind-impls.rs +++ b/src/test/run-pass/std-sync-right-kind-impls.rs @@ -10,7 +10,8 @@ // pretty-expanded FIXME #23616 -#![feature(std_misc, alloc, static_condvar)] +#![feature(static_mutex, static_rwlock, static_condvar)] +#![feature(arc_weak, semaphore)] use std::sync; diff --git a/src/test/run-pass/sync-send-iterators-in-libcollections.rs b/src/test/run-pass/sync-send-iterators-in-libcollections.rs index 7a84578859229..0ee04c4463b0f 100644 --- a/src/test/run-pass/sync-send-iterators-in-libcollections.rs +++ b/src/test/run-pass/sync-send-iterators-in-libcollections.rs @@ -10,9 +10,9 @@ // pretty-expanded FIXME #23616 -#![allow(unused_mut)] +#![allow(warnings)] #![feature(collections)] -#![feature(collections_drain)] +#![feature(drain, enumset, collections_bound, btree_range, vecmap)] extern crate collections; diff --git a/src/test/run-pass/sync-send-iterators-in-libcore.rs b/src/test/run-pass/sync-send-iterators-in-libcore.rs index cd99b39fdd068..8dda2365ac704 100644 --- a/src/test/run-pass/sync-send-iterators-in-libcore.rs +++ b/src/test/run-pass/sync-send-iterators-in-libcore.rs @@ -18,6 +18,7 @@ #![feature(iter_once)] use std::iter::{empty, once, range_inclusive, repeat, Unfold}; +>>>>>>> Fallout in tests and docs from feature renamings fn is_sync(_: T) where T: Sync {} fn is_send(_: T) where T: Send {} diff --git a/src/test/run-pass/tydesc-name.rs b/src/test/run-pass/tydesc-name.rs index 1534c301c996c..4a169c0a384aa 100644 --- a/src/test/run-pass/tydesc-name.rs +++ b/src/test/run-pass/tydesc-name.rs @@ -9,7 +9,7 @@ // except according to those terms. -#![feature(core)] +#![feature(core_intrinsics)] use std::intrinsics::type_name; diff --git a/src/test/run-pass/typeid-intrinsic.rs b/src/test/run-pass/typeid-intrinsic.rs index 9741ed0fddec8..feb43dfb9ade2 100644 --- a/src/test/run-pass/typeid-intrinsic.rs +++ b/src/test/run-pass/typeid-intrinsic.rs @@ -12,7 +12,7 @@ // aux-build:typeid-intrinsic2.rs -#![feature(hash, core)] +#![feature(hash_default, core_intrinsics)] extern crate typeid_intrinsic as other1; extern crate typeid_intrinsic2 as other2; diff --git a/src/test/run-pass/ufcs-polymorphic-paths.rs b/src/test/run-pass/ufcs-polymorphic-paths.rs index a8240dfbd1f8b..27f11d0411c47 100644 --- a/src/test/run-pass/ufcs-polymorphic-paths.rs +++ b/src/test/run-pass/ufcs-polymorphic-paths.rs @@ -9,7 +9,8 @@ // except according to those terms. -#![feature(collections, rand, into_cow)] +#![feature(collections, rand, into_cow, map_in_place, bitvec)] +#![allow(warnings)] use std::borrow::{Cow, IntoCow}; use std::collections::BitVec; diff --git a/src/test/run-pass/unfold-cross-crate.rs b/src/test/run-pass/unfold-cross-crate.rs index 938b5dc616729..9d5383fe0603f 100644 --- a/src/test/run-pass/unfold-cross-crate.rs +++ b/src/test/run-pass/unfold-cross-crate.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(core)] +#![feature(iter_unfold)] use std::iter::Unfold; diff --git a/src/test/run-pass/unsized3.rs b/src/test/run-pass/unsized3.rs index 07eec85672aae..6d378cb294e32 100644 --- a/src/test/run-pass/unsized3.rs +++ b/src/test/run-pass/unsized3.rs @@ -11,8 +11,8 @@ // Test structs with always-unsized fields. -#![allow(unknown_features)] -#![feature(box_syntax, core)] +#![allow(warnings)] +#![feature(box_syntax, unsize, raw)] use std::mem; use std::raw; diff --git a/src/test/run-pass/vec-concat.rs b/src/test/run-pass/vec-concat.rs index 658c35ae8d5ea..25c1cfe1f4d42 100644 --- a/src/test/run-pass/vec-concat.rs +++ b/src/test/run-pass/vec-concat.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(collections)] +#![feature(vec_push_all)] use std::vec; diff --git a/src/test/run-pass/vec-macro-no-std.rs b/src/test/run-pass/vec-macro-no-std.rs index 948fe28cc621a..cf3a8796d32c9 100644 --- a/src/test/run-pass/vec-macro-no-std.rs +++ b/src/test/run-pass/vec-macro-no-std.rs @@ -8,9 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// pretty-expanded FIXME #23616 - -#![feature(lang_items, start, no_std, core, libc, collections)] +#![feature(lang_items, start, no_std, core, core_slice_ext, libc, collections)] #![no_std] extern crate std as other; diff --git a/src/test/run-pass/vector-sort-panic-safe.rs b/src/test/run-pass/vector-sort-panic-safe.rs index 209fe22207f49..42b05aeea2910 100644 --- a/src/test/run-pass/vector-sort-panic-safe.rs +++ b/src/test/run-pass/vector-sort-panic-safe.rs @@ -9,7 +9,7 @@ // except according to those terms. -#![feature(rand, core)] +#![feature(rand, num_bits_bytes)] #![feature(const_fn)] use std::sync::atomic::{AtomicUsize, Ordering}; diff --git a/src/test/run-pass/wrapping-int-api.rs b/src/test/run-pass/wrapping-int-api.rs index e195d624fe529..48eea1206230e 100644 --- a/src/test/run-pass/wrapping-int-api.rs +++ b/src/test/run-pass/wrapping-int-api.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(core)] +#![feature(num_wrapping)] // Test inherent wrapping_* methods for {i,u}{size,8,16,32,64}. From 02a8d5b57057a5c76667e85e92ea2c8a95303150 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Wed, 10 Jun 2015 17:59:02 -0700 Subject: [PATCH 06/31] std: Deprecate the RandomAccessIterator trait This trait has not proven itself over time as being core and fundamentally useful to iterators, so it's being deprecated to allow time to iterate on it out of tree. --- src/libcore/iter.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/libcore/iter.rs b/src/libcore/iter.rs index 30c2d3fcb6d5d..9d7585993c33b 100644 --- a/src/libcore/iter.rs +++ b/src/libcore/iter.rs @@ -1230,6 +1230,10 @@ impl<'a, I: DoubleEndedIterator + ?Sized> DoubleEndedIterator for &'a mut I { #[unstable(feature = "iter_idx", reason = "not widely used, may be better decomposed into Index \ and ExactSizeIterator")] +#[deprecated(since = "1.2.0", + reason = "trait has not proven itself as a widely useful \ + abstraction for iterators, and more time may be needed \ + for iteration on the design")] pub trait RandomAccessIterator: Iterator { /// Returns the number of indexable elements. At most `std::usize::MAX` /// elements are indexable, even if the iterator represents a longer range. From 669d1cd9e28aa6a6aa181c29b9d68edd33491f6f Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Wed, 10 Jun 2015 18:01:59 -0700 Subject: [PATCH 07/31] std: Deprecate iter::{Unfold, Iterate} Neither of these iterators has seen enough usage to justify their position in the standard library, so these unstable iterators are being slated for deletion. --- src/libcore/iter.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/libcore/iter.rs b/src/libcore/iter.rs index 9d7585993c33b..053a85a7c51a6 100644 --- a/src/libcore/iter.rs +++ b/src/libcore/iter.rs @@ -2542,6 +2542,9 @@ impl RandomAccessIterator for Inspect /// ``` #[unstable(feature = "iter_unfold")] #[derive(Clone)] +#[deprecated(since = "1.2.0", + reason = "has gained enough traction to retain its position \ + in the standard library")] pub struct Unfold { f: F, /// Internal state that will be passed to the closure on the next iteration @@ -2550,6 +2553,9 @@ pub struct Unfold { } #[unstable(feature = "iter_unfold")] +#[deprecated(since = "1.2.0", + reason = "has gained enough traction to retain its position \ + in the standard library")] 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 @@ -2995,11 +3001,17 @@ type IterateState = (F, Option, bool); /// An iterator that repeatedly applies a given function, starting /// from a given seed value. #[unstable(feature = "iter_iterate")] +#[deprecated(since = "1.2.0", + reason = "has gained enough traction to retain its position \ + in the standard library")] 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 = "iter_iterate")] +#[deprecated(since = "1.2.0", + reason = "has gained enough traction to retain its position \ + in the standard library")] pub fn iterate(seed: T, f: F) -> Iterate where T: Clone, F: FnMut(T) -> T, From 153de4c5d9e7846a029f9c79fb9940f72f5961f9 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Wed, 10 Jun 2015 18:03:13 -0700 Subject: [PATCH 08/31] std: Deprecate the copy_{,mut_}lifetime functions Unsafe patterns such as `slice::from_raw_parts` and `CStr::from_ptr` have shown that dealing with lifetimes, while useful, is often a hindrance. Consequently these functions are rarely called today and are being deprecated. --- src/libcore/mem.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/libcore/mem.rs b/src/libcore/mem.rs index 4e9613454ab97..15e7cdbde408d 100644 --- a/src/libcore/mem.rs +++ b/src/libcore/mem.rs @@ -462,6 +462,10 @@ pub unsafe fn transmute_copy(src: &T) -> U { #[unstable(feature = "copy_lifetime", reason = "this function may be removed in the future due to its \ questionable utility")] +#[deprecated(since = "1.2.0", + reason = "unclear that this function buys more safety and \ + lifetimes are generally not handled as such in unsafe \ + code today")] pub unsafe fn copy_lifetime<'a, S: ?Sized, T: ?Sized + 'a>(_ptr: &'a S, ptr: &T) -> &'a T { transmute(ptr) @@ -472,6 +476,10 @@ pub unsafe fn copy_lifetime<'a, S: ?Sized, T: ?Sized + 'a>(_ptr: &'a S, #[unstable(feature = "copy_lifetime", reason = "this function may be removed in the future due to its \ questionable utility")] +#[deprecated(since = "1.2.0", + reason = "unclear that this function buys more safety and \ + lifetimes are generally not handled as such in unsafe \ + code today")] pub unsafe fn copy_mut_lifetime<'a, S: ?Sized, T: ?Sized + 'a>(_ptr: &'a S, ptr: &mut T) -> &'a mut T From c72e01ef7f317a0bad3c3e780cb02858f2017f43 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Wed, 10 Jun 2015 18:04:49 -0700 Subject: [PATCH 09/31] std: Deprecate result::fold This function has seen very little use and it seems better to explore this functionality through iterator adaptors instead of specialized functions. --- src/libcore/result.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/libcore/result.rs b/src/libcore/result.rs index 7fd845edc3f84..d87c1020dcc2f 100644 --- a/src/libcore/result.rs +++ b/src/libcore/result.rs @@ -968,6 +968,9 @@ impl> FromIterator> for Result { #[inline] #[unstable(feature = "result_fold", reason = "unclear if this function should exist")] +#[deprecated(since = "1.2.0", + reason = "has not seen enough usage to justify its position in \ + the standard library")] pub fn fold Date: Wed, 10 Jun 2015 18:06:12 -0700 Subject: [PATCH 10/31] std: Deprecate the IntSliceExt trait This trait has seen very little usage and while safe, may not belong in the standard library. --- src/libcore/slice.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/libcore/slice.rs b/src/libcore/slice.rs index c979b97731b4f..91acb0d695545 100644 --- a/src/libcore/slice.rs +++ b/src/libcore/slice.rs @@ -1501,6 +1501,10 @@ impl PartialOrd for [T] { /// Extension methods for slices containing integers. #[unstable(feature = "int_slice")] +#[deprecated(since = "1.2.0", + reason = "has not seen much usage and may want to live in the \ + standard library now that most slice methods are \ + on an inherent implementation block")] 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]; From a05ed9936d97414efdfd460f1e25505c366689d3 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Wed, 10 Jun 2015 18:10:12 -0700 Subject: [PATCH 11/31] std: Remove two internal `str_internals` functions These were just exposed to be used elsewhere at some point, but neither is currently being used so just make them private again. --- src/libcore/str/mod.rs | 6 ++---- src/libstd/sys/common/wtf8.rs | 25 ------------------------- 2 files changed, 2 insertions(+), 29 deletions(-) diff --git a/src/libcore/str/mod.rs b/src/libcore/str/mod.rs index 13c6ad367257d..7092df7b4c2c4 100644 --- a/src/libcore/str/mod.rs +++ b/src/libcore/str/mod.rs @@ -227,9 +227,8 @@ 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 = "str_internals")] #[inline] -pub fn next_code_point_reverse(bytes: &mut slice::Iter) -> Option { +fn next_code_point_reverse(bytes: &mut slice::Iter) -> Option { // Decode UTF-8 let w = match bytes.next_back() { None => return None, @@ -1873,8 +1872,7 @@ impl AsRef<[u8]> 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(feature = "str_internals")] -pub fn char_range_at_raw(bytes: &[u8], i: usize) -> (u32, usize) { +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/libstd/sys/common/wtf8.rs b/src/libstd/sys/common/wtf8.rs index b2dc01e3ccb19..428c8560d8847 100644 --- a/src/libstd/sys/common/wtf8.rs +++ b/src/libstd/sys/common/wtf8.rs @@ -480,31 +480,6 @@ impl Wtf8 { } } - /// Returns the code point at `position`. - /// - /// # Panics - /// - /// Panics if `position` is not at a code point boundary, - /// or is beyond the end of the string. - #[inline] - pub fn code_point_at(&self, position: usize) -> CodePoint { - let (code_point, _) = self.code_point_range_at(position); - code_point - } - - /// Returns the code point at `position` - /// and the position of the next code point. - /// - /// # Panics - /// - /// Panics if `position` is not at a code point boundary, - /// or is beyond the end of the string. - #[inline] - pub fn code_point_range_at(&self, position: usize) -> (CodePoint, usize) { - let (c, n) = char_range_at_raw(&self.bytes, position); - (CodePoint { value: c }, n) - } - /// Returns an iterator for the string’s code points. #[inline] pub fn code_points(&self) -> Wtf8CodePoints { From 8797c9ec6ee2a00e2398ab736b0467c8e38cb496 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Wed, 10 Jun 2015 18:27:58 -0700 Subject: [PATCH 12/31] std: Deprecate f{32,64}::consts::PI_2 These constants have been unstable for some time now already --- src/libcore/num/f32.rs | 1 + src/libcore/num/f64.rs | 1 + 2 files changed, 2 insertions(+) diff --git a/src/libcore/num/f32.rs b/src/libcore/num/f32.rs index 229414fe76664..aade9061657b7 100644 --- a/src/libcore/num/f32.rs +++ b/src/libcore/num/f32.rs @@ -73,6 +73,7 @@ pub mod consts { /// pi * 2.0 #[unstable(feature = "float_consts", reason = "unclear naming convention/usefulness")] + #[deprecated(since = "1.2.0", reason = "unclear on usefulness")] pub const PI_2: f32 = 6.28318530717958647692528676655900576_f32; /// pi/2.0 diff --git a/src/libcore/num/f64.rs b/src/libcore/num/f64.rs index bbc1bdacde713..7c9e846af9b10 100644 --- a/src/libcore/num/f64.rs +++ b/src/libcore/num/f64.rs @@ -73,6 +73,7 @@ pub mod consts { /// pi * 2.0 #[unstable(feature = "float_consts", reason = "unclear naming convention/usefulness")] + #[deprecated(since = "1.2.0", reason = "unclear on usefulness")] pub const PI_2: f64 = 6.28318530717958647692528676655900576_f64; /// pi/2.0 From cdb69e2747e41db25d64cf77e99721e9134aa5b7 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Wed, 10 Jun 2015 18:31:15 -0700 Subject: [PATCH 13/31] std: Stabilize the remaining wrapping_* functions This commit stabilizes the remaining `wrapping_*` functions on the primitive integer types as they follow the same conventions as other wrapping methods are were likely just initially unstable to be conservative. --- src/libcore/num/mod.rs | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/libcore/num/mod.rs b/src/libcore/num/mod.rs index c8a0ae47637d2..6af2148d4ed3d 100644 --- a/src/libcore/num/mod.rs +++ b/src/libcore/num/mod.rs @@ -468,7 +468,7 @@ macro_rules! int_impl { /// 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 = "num_wrapping")] + #[stable(feature = "num_wrapping", since = "1.2.0")] #[inline(always)] pub fn wrapping_div(self, rhs: Self) -> Self { self.overflowing_div(rhs).0 @@ -481,7 +481,7 @@ macro_rules! int_impl { /// 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 = "num_wrapping")] + #[stable(feature = "num_wrapping", since = "1.2.0")] #[inline(always)] pub fn wrapping_rem(self, rhs: Self) -> Self { self.overflowing_rem(rhs).0 @@ -495,7 +495,7 @@ macro_rules! int_impl { /// 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 = "num_wrapping")] + #[stable(feature = "num_wrapping", since = "1.2.0")] #[inline(always)] pub fn wrapping_neg(self) -> Self { self.overflowing_neg().0 @@ -504,7 +504,7 @@ macro_rules! int_impl { /// 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 = "num_wrapping")] + #[stable(feature = "num_wrapping", since = "1.2.0")] #[inline(always)] pub fn wrapping_shl(self, rhs: u32) -> Self { self.overflowing_shl(rhs).0 @@ -513,7 +513,7 @@ macro_rules! int_impl { /// 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 = "num_wrapping")] + #[stable(feature = "num_wrapping", since = "1.2.0")] #[inline(always)] pub fn wrapping_shr(self, rhs: u32) -> Self { self.overflowing_shr(rhs).0 @@ -1038,7 +1038,7 @@ macro_rules! uint_impl { /// 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 = "num_wrapping")] + #[stable(feature = "num_wrapping", since = "1.2.0")] #[inline(always)] pub fn wrapping_div(self, rhs: Self) -> Self { self.overflowing_div(rhs).0 @@ -1051,7 +1051,7 @@ macro_rules! uint_impl { /// 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 = "num_wrapping")] + #[stable(feature = "num_wrapping", since = "1.2.0")] #[inline(always)] pub fn wrapping_rem(self, rhs: Self) -> Self { self.overflowing_rem(rhs).0 @@ -1065,7 +1065,7 @@ macro_rules! uint_impl { /// 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 = "num_wrapping")] + #[stable(feature = "num_wrapping", since = "1.2.0")] #[inline(always)] pub fn wrapping_neg(self) -> Self { self.overflowing_neg().0 @@ -1074,7 +1074,7 @@ macro_rules! uint_impl { /// 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 = "num_wrapping")] + #[stable(feature = "num_wrapping", since = "1.2.0")] #[inline(always)] pub fn wrapping_shl(self, rhs: u32) -> Self { self.overflowing_shl(rhs).0 @@ -1083,7 +1083,7 @@ macro_rules! uint_impl { /// 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 = "num_wrapping")] + #[stable(feature = "num_wrapping", since = "1.2.0")] #[inline(always)] pub fn wrapping_shr(self, rhs: u32) -> Self { self.overflowing_shr(rhs).0 From f85c4f62d8e3f703f9d7c801b982d5cd5afbd081 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Wed, 10 Jun 2015 18:33:55 -0700 Subject: [PATCH 14/31] std: Deprecate all permutation-related slice methods These methods have been unstable for quite some time, and it's not clear that these should remain in the standard library. --- src/libcollections/slice.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/libcollections/slice.rs b/src/libcollections/slice.rs index be678d4a55c86..7d74f83552d07 100644 --- a/src/libcollections/slice.rs +++ b/src/libcollections/slice.rs @@ -872,6 +872,7 @@ impl [T] { /// assert_eq!(Some(vec![3, 1, 2]), perms.next()); /// ``` #[unstable(feature = "permutations")] + #[deprecated(since = "1.2.0", reason = "not clear this should be in the stdlib")] #[inline] pub fn permutations(&self) -> Permutations where T: Clone { // NB see hack module in this file @@ -897,6 +898,7 @@ impl [T] { /// ``` #[unstable(feature = "permutations", reason = "uncertain if this merits inclusion in std")] + #[deprecated(since = "1.2.0", reason = "not clear this should be in the stdlib")] pub fn next_permutation(&mut self) -> bool where T: Ord { core_slice::SliceExt::next_permutation(self) } @@ -920,6 +922,7 @@ impl [T] { /// ``` #[unstable(feature = "permutations", reason = "uncertain if this merits inclusion in std")] + #[deprecated(since = "1.2.0", reason = "not clear this should be in the stdlib")] pub fn prev_permutation(&mut self) -> bool where T: Ord { core_slice::SliceExt::prev_permutation(self) } @@ -1066,6 +1069,7 @@ impl> SliceConcatExt for [V] { /// sequence to its initial order. #[unstable(feature = "permutations")] #[derive(Clone)] +#[deprecated(since = "1.2.0", reason = "not clear this should be in the stdlib")] pub struct ElementSwaps { sdir: Vec, /// If `true`, emit the last swap that returns the sequence to initial @@ -1077,6 +1081,7 @@ pub struct ElementSwaps { impl ElementSwaps { /// Creates an `ElementSwaps` iterator for a sequence of `length` elements. #[unstable(feature = "permutations")] + #[deprecated(since = "1.2.0", reason = "not clear this should be in the stdlib")] pub fn new(length: usize) -> ElementSwaps { // Initialize `sdir` with a direction that position should move in // (all negative at the beginning) and the `size` of the @@ -1199,6 +1204,7 @@ impl Iterator for ElementSwaps { /// /// Generates even and odd permutations alternately. #[unstable(feature = "permutations")] +#[deprecated(since = "1.2.0", reason = "not clear this should be in the stdlib")] pub struct Permutations { swaps: ElementSwaps, v: Vec, From 68b628b165c91e6abe1bccf9d94eb7c7ef7cdda3 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Wed, 10 Jun 2015 18:40:20 -0700 Subject: [PATCH 15/31] std: Deprecate Vec::from_raw_buf This function is more naturally expressed as slice::from_raw_buf plus a call to to_vec. --- src/libcollections/vec.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/libcollections/vec.rs b/src/libcollections/vec.rs index 3d7c82c9a94a6..6b1e4bb4f8e6f 100644 --- a/src/libcollections/vec.rs +++ b/src/libcollections/vec.rs @@ -278,6 +278,8 @@ impl Vec { #[inline] #[unstable(feature = "vec_from_raw_buf", reason = "may be better expressed via composition")] + #[deprecated(since = "1.2.0", + reason = "use slice::from_raw_parts + .to_vec() instead")] pub unsafe fn from_raw_buf(ptr: *const T, elts: usize) -> Vec { let mut dst = Vec::with_capacity(elts); dst.set_len(elts); From c032d6fd397d95ccfa7c9bbefc8cc508906b8d34 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Wed, 10 Jun 2015 18:43:08 -0700 Subject: [PATCH 16/31] std: Stabilize the sync_poison feature These accessor/constructor methods for a `PoisonError` are quite standard for a wrapper type and enable manipulation of the underlying type. --- src/libstd/sync/mutex.rs | 2 +- src/libstd/sync/rwlock.rs | 2 +- src/libstd/sys/common/poison.rs | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/libstd/sync/mutex.rs b/src/libstd/sync/mutex.rs index 1d63014295922..64a5027cc8937 100644 --- a/src/libstd/sync/mutex.rs +++ b/src/libstd/sync/mutex.rs @@ -238,7 +238,7 @@ impl Mutex { /// time. You should not trust a `false` value for program correctness /// without additional synchronization. #[inline] - #[unstable(feature = "sync_poison")] + #[stable(feature = "sync_poison", since = "1.2.0")] pub fn is_poisoned(&self) -> bool { self.inner.poison.get() } diff --git a/src/libstd/sync/rwlock.rs b/src/libstd/sync/rwlock.rs index 5a6bf987fd717..4ca2e282f707d 100644 --- a/src/libstd/sync/rwlock.rs +++ b/src/libstd/sync/rwlock.rs @@ -253,7 +253,7 @@ impl RwLock { /// time. You should not trust a `false` value for program correctness /// without additional synchronization. #[inline] - #[unstable(feature = "sync_poison")] + #[stable(feature = "sync_poison", since = "1.2.0")] pub fn is_poisoned(&self) -> bool { self.inner.poison.get() } diff --git a/src/libstd/sys/common/poison.rs b/src/libstd/sys/common/poison.rs index 75f85879fd1f4..065b1d6c9acfc 100644 --- a/src/libstd/sys/common/poison.rs +++ b/src/libstd/sys/common/poison.rs @@ -120,24 +120,24 @@ impl Error for PoisonError { impl PoisonError { /// Creates a `PoisonError`. - #[unstable(feature = "sync_poison")] + #[stable(feature = "sync_poison", since = "1.2.0")] pub fn new(guard: T) -> PoisonError { PoisonError { guard: guard } } /// Consumes this error indicating that a lock is poisoned, returning the /// underlying guard to allow access regardless. - #[unstable(feature = "sync_poison")] + #[stable(feature = "sync_poison", since = "1.2.0")] pub fn into_inner(self) -> T { self.guard } /// Reaches into this error indicating that a lock is poisoned, returning a /// reference to the underlying guard to allow access regardless. - #[unstable(feature = "sync_poison")] + #[stable(feature = "sync_poison", since = "1.2.0")] pub fn get_ref(&self) -> &T { &self.guard } /// Reaches into this error indicating that a lock is poisoned, returning a /// mutable reference to the underlying guard to allow access regardless. - #[unstable(feature = "sync_poi")] + #[stable(feature = "sync_poison", since = "1.2.0")] pub fn get_mut(&mut self) -> &mut T { &mut self.guard } } From f3580879b90f451b24b9d6008f571745fc6cbd6c Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Wed, 10 Jun 2015 18:44:11 -0700 Subject: [PATCH 17/31] std: Stabilize the `once_new` feature This function follows the well-established "constructor" pattern and the initialization constant will likely be deprecated in favor of it once `const_fn` is stabilized. --- src/libstd/sync/once.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libstd/sync/once.rs b/src/libstd/sync/once.rs index 1e0aa271b4dcd..0bda6a975a244 100644 --- a/src/libstd/sync/once.rs +++ b/src/libstd/sync/once.rs @@ -48,7 +48,7 @@ pub const ONCE_INIT: Once = Once::new(); impl Once { /// Creates a new `Once` value. - #[unstable(feature = "once_new")] + #[stable(feature = "once_new", since = "1.2.0")] pub const fn new() -> Once { Once { mutex: StaticMutex::new(), From 17a1059d8343ffd66fe3f3c51e3bf9b493cdf2f3 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Wed, 10 Jun 2015 18:45:48 -0700 Subject: [PATCH 18/31] std: Stabilize the `iter_{once,empty}` features This commit stabilizes these two iterator primitives as they have gone through the RFC process and had some time to bake now. --- src/libcore/iter.rs | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/libcore/iter.rs b/src/libcore/iter.rs index 053a85a7c51a6..2f45ffd141820 100644 --- a/src/libcore/iter.rs +++ b/src/libcore/iter.rs @@ -3043,10 +3043,10 @@ pub fn repeat(elt: T) -> Repeat { } /// An iterator that yields nothing. -#[unstable(feature="iter_empty", reason = "new addition")] +#[stable(feature = "iter_empty", since = "1.2.0")] pub struct Empty(marker::PhantomData); -#[unstable(feature="iter_empty", reason = "new addition")] +#[stable(feature = "iter_empty", since = "1.2.0")] impl Iterator for Empty { type Item = T; @@ -3059,14 +3059,14 @@ impl Iterator for Empty { } } -#[unstable(feature="iter_empty", reason = "new addition")] +#[stable(feature = "iter_empty", since = "1.2.0")] impl DoubleEndedIterator for Empty { fn next_back(&mut self) -> Option { None } } -#[unstable(feature="iter_empty", reason = "new addition")] +#[stable(feature = "iter_empty", since = "1.2.0")] impl ExactSizeIterator for Empty { fn len(&self) -> usize { 0 @@ -3075,7 +3075,7 @@ impl ExactSizeIterator for Empty { // not #[derive] because that adds a Clone bound on T, // which isn't necessary. -#[unstable(feature="iter_empty", reason = "new addition")] +#[stable(feature = "iter_empty", since = "1.2.0")] impl Clone for Empty { fn clone(&self) -> Empty { Empty(marker::PhantomData) @@ -3084,7 +3084,7 @@ impl Clone for Empty { // not #[derive] because that adds a Default bound on T, // which isn't necessary. -#[unstable(feature="iter_empty", reason = "new addition")] +#[stable(feature = "iter_empty", since = "1.2.0")] impl Default for Empty { fn default() -> Empty { Empty(marker::PhantomData) @@ -3092,19 +3092,19 @@ impl Default for Empty { } /// Creates an iterator that yields nothing. -#[unstable(feature="iter_empty", reason = "new addition")] +#[stable(feature = "iter_empty", since = "1.2.0")] pub fn empty() -> Empty { Empty(marker::PhantomData) } /// An iterator that yields an element exactly once. #[derive(Clone)] -#[unstable(feature="iter_once", reason = "new addition")] +#[stable(feature = "iter_once", since = "1.2.0")] pub struct Once { inner: ::option::IntoIter } -#[unstable(feature="iter_once", reason = "new addition")] +#[stable(feature = "iter_once", since = "1.2.0")] impl Iterator for Once { type Item = T; @@ -3117,14 +3117,14 @@ impl Iterator for Once { } } -#[unstable(feature="iter_once", reason = "new addition")] +#[stable(feature = "iter_once", since = "1.2.0")] impl DoubleEndedIterator for Once { fn next_back(&mut self) -> Option { self.inner.next_back() } } -#[unstable(feature="iter_once", reason = "new addition")] +#[stable(feature = "iter_once", since = "1.2.0")] impl ExactSizeIterator for Once { fn len(&self) -> usize { self.inner.len() @@ -3132,7 +3132,7 @@ impl ExactSizeIterator for Once { } /// Creates an iterator that yields an element exactly once. -#[unstable(feature="iter_once", reason = "new addition")] +#[stable(feature = "iter_once", since = "1.2.0")] pub fn once(value: T) -> Once { Once { inner: Some(value).into_iter() } } From 2d389c125e2ba7fdb6762120e1fa4e783fa7adad Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Wed, 10 Jun 2015 18:49:26 -0700 Subject: [PATCH 19/31] std: Stabilize the `str_matches` feature This commit stabilizes the `str::{matches, rmatches}` functions and iterators, but renames the unstable feature for the `str::{matches,rmatches}_indices` function to `str_match_indices` due to the comment present on the functions about the iterator's return value. --- src/libcollections/str.rs | 10 ++++------ src/libcore/str/mod.rs | 4 ++-- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/libcollections/str.rs b/src/libcollections/str.rs index d41e062cac3d8..55265aac99f8e 100644 --- a/src/libcollections/str.rs +++ b/src/libcollections/str.rs @@ -1527,8 +1527,7 @@ impl str { /// let v: Vec<&str> = "1abc2abc3".matches(char::is_numeric).collect(); /// assert_eq!(v, ["1", "2", "3"]); /// ``` - #[unstable(feature = "str_matches", - reason = "method got recently added")] + #[stable(feature = "str_matches", since = "1.2.0")] pub fn matches<'a, P: Pattern<'a>>(&'a self, pat: P) -> Matches<'a, P> { core_str::StrExt::matches(self, pat) } @@ -1560,8 +1559,7 @@ impl str { /// let v: Vec<&str> = "1abc2abc3".rmatches(char::is_numeric).collect(); /// assert_eq!(v, ["3", "2", "1"]); /// ``` - #[unstable(feature = "str_matches", - reason = "method got recently added")] + #[stable(feature = "str_matches", since = "1.2.0")] pub fn rmatches<'a, P: Pattern<'a>>(&'a self, pat: P) -> RMatches<'a, P> where P::Searcher: ReverseSearcher<'a> { @@ -1605,7 +1603,7 @@ impl str { /// let v: Vec<(usize, usize)> = "ababa".match_indices("aba").collect(); /// assert_eq!(v, [(0, 3)]); // only the first `aba` /// ``` - #[unstable(feature = "str_matches", + #[unstable(feature = "str_match_indices", reason = "might have its iterator type changed")] // NB: Right now MatchIndices yields `(usize, usize)`, but it would // be more consistent with `matches` and `char_indices` to return `(usize, &str)` @@ -1649,7 +1647,7 @@ impl str { /// let v: Vec<(usize, usize)> = "ababa".rmatch_indices("aba").collect(); /// assert_eq!(v, [(2, 5)]); // only the last `aba` /// ``` - #[unstable(feature = "str_matches", + #[unstable(feature = "str_match_indices", reason = "might have its iterator type changed")] // NB: Right now RMatchIndices yields `(usize, usize)`, but it would // be more consistent with `rmatches` and `char_indices` to return `(usize, &str)` diff --git a/src/libcore/str/mod.rs b/src/libcore/str/mod.rs index 7092df7b4c2c4..5a621176c4a81 100644 --- a/src/libcore/str/mod.rs +++ b/src/libcore/str/mod.rs @@ -738,7 +738,7 @@ generate_pattern_iterators! { #[doc="Created with the method `.rmatch_indices()`."] struct RMatchIndices; stability: - #[unstable(feature = "str_internals", + #[unstable(feature = "str_match_indices", reason = "type may be removed or have its iterator impl changed")] internal: MatchIndicesInternal yielding ((usize, usize)); @@ -779,7 +779,7 @@ generate_pattern_iterators! { #[doc="Created with the method `.rmatches()`."] struct RMatches; stability: - #[unstable(feature = "str_internals", reason = "type got recently added")] + #[stable(feature = "str_matches", since = "1.2.0")] internal: MatchesInternal yielding (&'a str); delegate double ended; From 0d818b4ee4a978babc8781ece028a7d0e9ed2e36 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Wed, 10 Jun 2015 18:52:57 -0700 Subject: [PATCH 20/31] std: Deprecate the io::BufStream type Questions about the utility of this type has caused it to move to crates.io in the `bufstream` crate, so this type can be deprecated. --- src/libstd/io/buffered.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/libstd/io/buffered.rs b/src/libstd/io/buffered.rs index c355be9bc78d2..95363870cd08f 100644 --- a/src/libstd/io/buffered.rs +++ b/src/libstd/io/buffered.rs @@ -454,6 +454,8 @@ impl Read for InternalBufWriter { #[unstable(feature = "buf_stream", reason = "unsure about semantics of buffering two directions, \ leading to issues like #17136")] +#[deprecated(since = "1.2.0", + reason = "use the crates.io `bufstream` crate instead")] pub struct BufStream { inner: BufReader> } @@ -461,6 +463,8 @@ pub struct BufStream { #[unstable(feature = "buf_stream", reason = "unsure about semantics of buffering two directions, \ leading to issues like #17136")] +#[deprecated(since = "1.2.0", + reason = "use the crates.io `bufstream` crate instead")] impl BufStream { /// Creates a new buffered stream with explicitly listed capacities for the /// reader/writer buffer. From 96cce02924b83227b53799c2992f5040340528fc Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Wed, 10 Jun 2015 18:54:35 -0700 Subject: [PATCH 21/31] std: Deprecate the `exit_status` feature These two functions should be replaceable with the `process::exit` function. --- src/libstd/env.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/libstd/env.rs b/src/libstd/env.rs index 7f83f0763c640..2e00e126e2378 100644 --- a/src/libstd/env.rs +++ b/src/libstd/env.rs @@ -486,6 +486,7 @@ static EXIT_STATUS: AtomicIsize = AtomicIsize::new(0); /// /// Note that this is not synchronized against modifications of other threads. #[unstable(feature = "exit_status", reason = "managing the exit status may change")] +#[deprecated(since = "1.2.0", reason = "use process::exit instead")] pub fn set_exit_status(code: i32) { EXIT_STATUS.store(code as isize, Ordering::SeqCst) } @@ -493,6 +494,7 @@ pub fn set_exit_status(code: i32) { /// Fetches the process's current exit code. This defaults to 0 and can change /// by calling `set_exit_status`. #[unstable(feature = "exit_status", reason = "managing the exit status may change")] +#[deprecated(since = "1.2.0", reason = "use process::exit instead")] pub fn get_exit_status() -> i32 { EXIT_STATUS.load(Ordering::SeqCst) as i32 } From 04f7eba909ffc5a6473087391c92a7a1489ae94b Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Wed, 10 Jun 2015 18:56:10 -0700 Subject: [PATCH 22/31] std: Deprecate the `future` feature This commit deprecates the `sync::Future` type to be developed outside in crates.io instead. --- src/libstd/sync/future.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/libstd/sync/future.rs b/src/libstd/sync/future.rs index f5b6650a49833..e3ddc1034a540 100644 --- a/src/libstd/sync/future.rs +++ b/src/libstd/sync/future.rs @@ -32,6 +32,10 @@ reason = "futures as-is have yet to be deeply reevaluated with recent \ core changes to Rust's synchronization story, and will likely \ become stable in the future but are unstable until that time")] +#[deprecated(since = "1.2.0", + reason = "implementation does not match the quality of the \ + standard library and this will likely be prototyped \ + outside in crates.io first")] use core::prelude::*; use core::mem::replace; From d645f8fc286af1841f1a352ddc7282c6e9a7dd8f Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Wed, 10 Jun 2015 19:04:51 -0700 Subject: [PATCH 23/31] std: Deprecate the `scoped` feature The `thread::scoped` function will never be stabilized as-is and the API will likely change significantly if it does, so this function is deprecated for removal. --- src/libstd/thread/mod.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/libstd/thread/mod.rs b/src/libstd/thread/mod.rs index 153b04360877b..da9cde8e3cd34 100644 --- a/src/libstd/thread/mod.rs +++ b/src/libstd/thread/mod.rs @@ -297,6 +297,9 @@ impl Builder { /// the OS level. #[unstable(feature = "scoped", reason = "memory unsafe if destructor is avoided, see #24292")] + #[deprecated(since = "1.2.0", + reason = "this unsafe API is unlikely to ever be stabilized \ + in this form")] pub fn scoped<'a, T, F>(self, f: F) -> io::Result> where T: Send + 'a, F: FnOnce() -> T, F: Send + 'a { @@ -398,6 +401,9 @@ pub fn spawn(f: F) -> JoinHandle where /// to recover from such errors. #[unstable(feature = "scoped", reason = "memory unsafe if destructor is avoided, see #24292")] +#[deprecated(since = "1.2.0", + reason = "this unsafe API is unlikely to ever be stabilized \ + in this form")] pub fn scoped<'a, T, F>(f: F) -> JoinGuard<'a, T> where T: Send + 'a, F: FnOnce() -> T, F: Send + 'a { From 3346fb044285c0b10480099ca3af921a053c38be Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Wed, 10 Jun 2015 19:06:45 -0700 Subject: [PATCH 24/31] std: Deprecate the `thunk` module This has been replaced with `FnBox` --- src/libstd/thunk.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/libstd/thunk.rs b/src/libstd/thunk.rs index 084893314a8e5..f1dc91f135fe5 100644 --- a/src/libstd/thunk.rs +++ b/src/libstd/thunk.rs @@ -11,6 +11,7 @@ // Because this module is temporary... #![allow(missing_docs)] #![unstable(feature = "thunk")] +#![deprecated(since = "1.2.0", reason = "use FnBox instead")] use alloc::boxed::{Box, FnBox}; use core::marker::Send; From aa931e9c6f92557b99978f1cc562c99051190f79 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Wed, 10 Jun 2015 19:14:35 -0700 Subject: [PATCH 25/31] std: Move free-functions to associated functions This commit moves the free functions in the `rc`, `arc`, and `boxed` modules to associated functions on their respective types, following the recent trend towards this pattern. The previous free functions are all left in-place with `#[deprecated]` pointers towards the new locations. This commit also deprecates `arc::get_mut` and `Arc::make_unique` with no replacement as they are racy in the face of weak pointers. --- src/liballoc/arc.rs | 26 +++++++-- src/liballoc/boxed.rs | 29 ++++++++- src/liballoc/rc.rs | 133 +++++++++++++++++++++++++++++++++--------- 3 files changed, 153 insertions(+), 35 deletions(-) diff --git a/src/liballoc/arc.rs b/src/liballoc/arc.rs index c1ad367c234b3..282fca8d6c29e 100644 --- a/src/liballoc/arc.rs +++ b/src/liballoc/arc.rs @@ -205,9 +205,21 @@ impl Arc { self.inner().weak.fetch_add(1, Relaxed); Weak { _ptr: self._ptr } } -} -impl Arc { + /// Get the number of weak references to this value. + #[inline] + #[unstable(feature = "arc_counts")] + pub fn weak_count(this: &Arc) -> usize { + this.inner().weak.load(SeqCst) - 1 + } + + /// Get the number of strong references to this value. + #[inline] + #[unstable(feature = "arc_counts")] + pub fn strong_count(this: &Arc) -> usize { + this.inner().strong.load(SeqCst) + } + #[inline] fn inner(&self) -> &ArcInner { // This unsafety is ok because while this arc is alive we're guaranteed @@ -237,12 +249,14 @@ impl Arc { /// Get the number of weak references to this value. #[inline] #[unstable(feature = "arc_counts")] -pub fn weak_count(this: &Arc) -> usize { this.inner().weak.load(SeqCst) - 1 } +#[deprecated(since = "1.2.0", reason = "renamed to Arc::weak_count")] +pub fn weak_count(this: &Arc) -> usize { Arc::weak_count(this) } /// Get the number of strong references to this value. #[inline] #[unstable(feature = "arc_counts")] -pub fn strong_count(this: &Arc) -> usize { this.inner().strong.load(SeqCst) } +#[deprecated(since = "1.2.0", reason = "renamed to Arc::strong_count")] +pub fn strong_count(this: &Arc) -> usize { Arc::strong_count(this) } /// Returns a mutable reference to the contained value if the `Arc` is unique. @@ -272,6 +286,8 @@ pub fn strong_count(this: &Arc) -> usize { this.inner().strong.loa /// ``` #[inline] #[unstable(feature = "arc_unique")] +#[deprecated(since = "1.2.0", + reason = "this function is unsafe with weak pointers")] pub unsafe fn get_mut(this: &mut Arc) -> Option<&mut T> { // FIXME(#24880) potential race with upgraded weak pointers here if strong_count(this) == 1 && weak_count(this) == 0 { @@ -353,6 +369,8 @@ impl Arc { /// ``` #[inline] #[unstable(feature = "arc_unique")] + #[deprecated(since = "1.2.0", + reason = "this function is unsafe with weak pointers")] pub unsafe fn make_unique(&mut self) -> &mut T { // FIXME(#24880) potential race with upgraded weak pointers here // diff --git a/src/liballoc/boxed.rs b/src/liballoc/boxed.rs index b59a5685f0d8f..0e6554702bef9 100644 --- a/src/liballoc/boxed.rs +++ b/src/liballoc/boxed.rs @@ -127,6 +127,29 @@ impl Box { pub unsafe fn from_raw(raw: *mut T) -> Self { mem::transmute(raw) } + + /// Consumes the `Box`, returning the wrapped raw pointer. + /// + /// After call to this function, caller is responsible for the memory + /// previously managed by `Box`, in particular caller should properly + /// destroy `T` and release memory. The proper way to do it is to + /// convert pointer back to `Box` with `Box::from_raw` function, because + /// `Box` does not specify, how memory is allocated. + /// + /// # Examples + /// ``` + /// # #![feature(box_raw)] + /// use std::boxed; + /// + /// let seventeen = Box::new(17u32); + /// let raw = boxed::into_raw(seventeen); + /// let boxed_again = unsafe { Box::from_raw(raw) }; + /// ``` + #[unstable(feature = "box_raw", reason = "may be renamed")] + #[inline] + pub fn into_raw(b: Box) -> *mut T { + unsafe { mem::transmute(b) } + } } /// Consumes the `Box`, returning the wrapped raw pointer. @@ -146,11 +169,11 @@ impl Box { /// let raw = boxed::into_raw(seventeen); /// let boxed_again = unsafe { Box::from_raw(raw) }; /// ``` -#[unstable(feature = "box_raw", - reason = "may be renamed")] +#[unstable(feature = "box_raw", reason = "may be renamed")] +#[deprecated(since = "1.2.0", reason = "renamed to Box::into_raw")] #[inline] pub fn into_raw(b: Box) -> *mut T { - unsafe { mem::transmute(b) } + Box::into_raw(b) } #[stable(feature = "rust1", since = "1.0.0")] diff --git a/src/liballoc/rc.rs b/src/liballoc/rc.rs index 802591a6171d5..bdf02b23ff489 100644 --- a/src/liballoc/rc.rs +++ b/src/liballoc/rc.rs @@ -220,6 +220,42 @@ impl Rc { } } } + + /// Unwraps the contained value if the `Rc` is unique. + /// + /// If the `Rc` is not unique, an `Err` is returned with the same + /// `Rc`. + /// + /// # Examples + /// + /// ``` + /// # #![feature(rc_unique)] + /// use std::rc::{self, Rc}; + /// + /// let x = Rc::new(3); + /// assert_eq!(rc::try_unwrap(x), Ok(3)); + /// + /// let x = Rc::new(4); + /// let _y = x.clone(); + /// assert_eq!(rc::try_unwrap(x), Err(Rc::new(4))); + /// ``` + #[inline] + #[unstable(feature = "rc_unique")] + pub fn try_unwrap(rc: Rc) -> Result> { + if Rc::is_unique(&rc) { + unsafe { + let val = ptr::read(&*rc); // copy the contained object + // destruct the box and skip our Drop + // we can ignore the refcounts because we know we're unique + deallocate(*rc._ptr as *mut u8, size_of::>(), + min_align_of::>()); + forget(rc); + Ok(val) + } + } else { + Err(rc) + } + } } impl Rc { @@ -241,17 +277,78 @@ impl Rc { self.inc_weak(); Weak { _ptr: self._ptr } } + + /// Get the number of weak references to this value. + #[inline] + #[unstable(feature = "rc_counts")] + pub fn weak_count(this: &Rc) -> usize { this.weak() - 1 } + + /// Get the number of strong references to this value. + #[inline] + #[unstable(feature = "rc_counts")] + pub fn strong_count(this: &Rc) -> usize { this.strong() } + + /// Returns true if there are no other `Rc` or `Weak` values that share + /// the same inner value. + /// + /// # Examples + /// + /// ``` + /// # #![feature(rc_unique)] + /// use std::rc; + /// use std::rc::Rc; + /// + /// let five = Rc::new(5); + /// + /// rc::is_unique(&five); + /// ``` + #[inline] + #[unstable(feature = "rc_unique")] + pub fn is_unique(rc: &Rc) -> bool { + weak_count(rc) == 0 && strong_count(rc) == 1 + } + + /// Returns a mutable reference to the contained value if the `Rc` is + /// unique. + /// + /// Returns `None` if the `Rc` is not unique. + /// + /// # Examples + /// + /// ``` + /// # #![feature(rc_unique)] + /// use std::rc::{self, Rc}; + /// + /// let mut x = Rc::new(3); + /// *rc::get_mut(&mut x).unwrap() = 4; + /// assert_eq!(*x, 4); + /// + /// let _y = x.clone(); + /// assert!(rc::get_mut(&mut x).is_none()); + /// ``` + #[inline] + #[unstable(feature = "rc_unique")] + pub fn get_mut(rc: &mut Rc) -> Option<&mut T> { + if Rc::is_unique(rc) { + let inner = unsafe { &mut **rc._ptr }; + Some(&mut inner.value) + } else { + None + } + } } /// Get the number of weak references to this value. #[inline] #[unstable(feature = "rc_counts")] -pub fn weak_count(this: &Rc) -> usize { this.weak() - 1 } +#[deprecated(since = "1.2.0", reason = "renamed to Rc::weak_count")] +pub fn weak_count(this: &Rc) -> usize { Rc::weak_count(this) } /// Get the number of strong references to this value. #[inline] #[unstable(feature = "rc_counts")] -pub fn strong_count(this: &Rc) -> usize { this.strong() } +#[deprecated(since = "1.2.0", reason = "renamed to Rc::strong_count")] +pub fn strong_count(this: &Rc) -> usize { Rc::strong_count(this) } /// Returns true if there are no other `Rc` or `Weak` values that share the /// same inner value. @@ -269,9 +366,8 @@ pub fn strong_count(this: &Rc) -> usize { this.strong() } /// ``` #[inline] #[unstable(feature = "rc_unique")] -pub fn is_unique(rc: &Rc) -> bool { - weak_count(rc) == 0 && strong_count(rc) == 1 -} +#[deprecated(since = "1.2.0", reason = "renamed to Rc::is_unique")] +pub fn is_unique(rc: &Rc) -> bool { Rc::is_unique(rc) } /// Unwraps the contained value if the `Rc` is unique. /// @@ -292,21 +388,8 @@ pub fn is_unique(rc: &Rc) -> bool { /// ``` #[inline] #[unstable(feature = "rc_unique")] -pub fn try_unwrap(rc: Rc) -> Result> { - if is_unique(&rc) { - unsafe { - let val = ptr::read(&*rc); // copy the contained object - // destruct the box and skip our Drop - // we can ignore the refcounts because we know we're unique - deallocate(*rc._ptr as *mut u8, size_of::>(), - min_align_of::>()); - forget(rc); - Ok(val) - } - } else { - Err(rc) - } -} +#[deprecated(since = "1.2.0", reason = "renamed to Rc::try_unwrap")] +pub fn try_unwrap(rc: Rc) -> Result> { Rc::try_unwrap(rc) } /// Returns a mutable reference to the contained value if the `Rc` is unique. /// @@ -327,14 +410,8 @@ pub fn try_unwrap(rc: Rc) -> Result> { /// ``` #[inline] #[unstable(feature = "rc_unique")] -pub fn get_mut(rc: &mut Rc) -> Option<&mut T> { - if is_unique(rc) { - let inner = unsafe { &mut **rc._ptr }; - Some(&mut inner.value) - } else { - None - } -} +#[deprecated(since = "1.2.0", reason = "renamed to Rc::get_mut")] +pub fn get_mut(rc: &mut Rc) -> Option<&mut T> { Rc::get_mut(rc) } impl Rc { /// Make a mutable reference from the given `Rc`. From b4a2823cd6c6f1a560469587f902f3a1f49d3c79 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Wed, 10 Jun 2015 19:33:04 -0700 Subject: [PATCH 26/31] More test fixes and fallout of stability changes --- src/liballoc/arc.rs | 2 +- src/liballoc/boxed.rs | 2 +- src/liballoc/rc.rs | 41 ++++++++++++++---------------- src/libcollections/bit.rs | 2 ++ src/libcollections/btree/map.rs | 5 +--- src/libcollections/lib.rs | 3 +-- src/libcollections/slice.rs | 9 +++++++ src/libcollections/str.rs | 6 ++--- src/libcollections/vec.rs | 2 ++ src/libcollections/vec_deque.rs | 1 + src/libcollectionstest/lib.rs | 2 +- src/libcore/iter.rs | 22 ++++++++++++++-- src/libcore/slice.rs | 4 +++ src/liblog/lib.rs | 6 ++--- src/librustc/lib.rs | 2 +- src/librustc_driver/lib.rs | 4 +-- src/librustc_trans/back/write.rs | 4 +-- src/librustc_trans/lib.rs | 2 -- src/librustdoc/lib.rs | 4 +-- src/libserialize/lib.rs | 1 - src/libstd/error.rs | 4 +-- src/libstd/ffi/c_str.rs | 5 ++-- src/libstd/io/buffered.rs | 5 ++++ src/libstd/io/lazy.rs | 3 +-- src/libstd/lib.rs | 1 - src/libstd/rt/at_exit_imp.rs | 11 ++++---- src/libstd/rt/mod.rs | 4 ++- src/libstd/rt/unwind/gcc.rs | 3 +-- src/libstd/sync/future.rs | 9 ++++--- src/libstd/sync/mod.rs | 1 + src/libstd/sync/mpsc/mpsc_queue.rs | 3 +-- src/libstd/sync/mpsc/spsc_queue.rs | 3 +-- src/libstd/sync/mutex.rs | 2 -- src/libstd/sys/common/wtf8.rs | 26 +------------------ src/libstd/thread/local.rs | 3 +-- src/libstd/thread/mod.rs | 1 + src/libtest/lib.rs | 7 ++--- src/rustbook/main.rs | 6 ++++- src/rustbook/term.rs | 4 +-- src/test/run-pass/issue-11958.rs | 8 ------ 40 files changed, 111 insertions(+), 122 deletions(-) diff --git a/src/liballoc/arc.rs b/src/liballoc/arc.rs index 282fca8d6c29e..7bfeaec36d729 100644 --- a/src/liballoc/arc.rs +++ b/src/liballoc/arc.rs @@ -290,7 +290,7 @@ pub fn strong_count(this: &Arc) -> usize { Arc::strong_count(this) reason = "this function is unsafe with weak pointers")] pub unsafe fn get_mut(this: &mut Arc) -> Option<&mut T> { // FIXME(#24880) potential race with upgraded weak pointers here - if strong_count(this) == 1 && weak_count(this) == 0 { + if Arc::strong_count(this) == 1 && Arc::weak_count(this) == 0 { // This unsafety is ok because we're guaranteed that the pointer // returned is the *only* pointer that will ever be returned to T. Our // reference count is guaranteed to be 1 at this point, and we required diff --git a/src/liballoc/boxed.rs b/src/liballoc/boxed.rs index 0e6554702bef9..1a360ebc05c71 100644 --- a/src/liballoc/boxed.rs +++ b/src/liballoc/boxed.rs @@ -267,7 +267,7 @@ impl Box { if self.is::() { unsafe { // Get the raw representation of the trait object - let raw = into_raw(self); + let raw = Box::into_raw(self); let to: TraitObject = mem::transmute::<*mut Any, TraitObject>(raw); diff --git a/src/liballoc/rc.rs b/src/liballoc/rc.rs index bdf02b23ff489..d5b6c86ef359a 100644 --- a/src/liballoc/rc.rs +++ b/src/liballoc/rc.rs @@ -148,26 +148,24 @@ //! ``` #![stable(feature = "rust1", since = "1.0.0")] + +use core::prelude::*; + #[cfg(not(test))] -use boxed; +use boxed::Box; #[cfg(test)] -use std::boxed; +use std::boxed::Box; + use core::cell::Cell; -use core::clone::Clone; -use core::cmp::{PartialEq, PartialOrd, Eq, Ord, Ordering}; -use core::default::Default; +use core::cmp::Ordering; use core::fmt; use core::hash::{Hasher, Hash}; use core::intrinsics::{assume, drop_in_place}; -use core::marker::{self, Sized, Unsize}; +use core::marker::{self, Unsize}; use core::mem::{self, min_align_of, size_of, min_align_of_val, size_of_val, forget}; use core::nonzero::NonZero; -use core::ops::{CoerceUnsized, Deref, Drop}; -use core::option::Option; -use core::option::Option::{Some, None}; +use core::ops::{CoerceUnsized, Deref}; use core::ptr; -use core::result::Result; -use core::result::Result::{Ok, Err}; use heap::deallocate; @@ -212,7 +210,7 @@ impl Rc { // pointers, which ensures that the weak destructor never frees // the allocation while the strong destructor is running, even // if the weak pointer is stored inside the strong one. - _ptr: NonZero::new(boxed::into_raw(box RcBox { + _ptr: NonZero::new(Box::into_raw(box RcBox { strong: Cell::new(1), weak: Cell::new(1), value: value @@ -230,14 +228,14 @@ impl Rc { /// /// ``` /// # #![feature(rc_unique)] - /// use std::rc::{self, Rc}; + /// use std::rc::Rc; /// /// let x = Rc::new(3); - /// assert_eq!(rc::try_unwrap(x), Ok(3)); + /// assert_eq!(Rc::try_unwrap(x), Ok(3)); /// /// let x = Rc::new(4); /// let _y = x.clone(); - /// assert_eq!(rc::try_unwrap(x), Err(Rc::new(4))); + /// assert_eq!(Rc::try_unwrap(x), Err(Rc::new(4))); /// ``` #[inline] #[unstable(feature = "rc_unique")] @@ -295,17 +293,16 @@ impl Rc { /// /// ``` /// # #![feature(rc_unique)] - /// use std::rc; /// use std::rc::Rc; /// /// let five = Rc::new(5); /// - /// rc::is_unique(&five); + /// assert!(Rc::is_unique(&five)); /// ``` #[inline] #[unstable(feature = "rc_unique")] pub fn is_unique(rc: &Rc) -> bool { - weak_count(rc) == 0 && strong_count(rc) == 1 + Rc::weak_count(rc) == 0 && Rc::strong_count(rc) == 1 } /// Returns a mutable reference to the contained value if the `Rc` is @@ -317,14 +314,14 @@ impl Rc { /// /// ``` /// # #![feature(rc_unique)] - /// use std::rc::{self, Rc}; + /// use std::rc::Rc; /// /// let mut x = Rc::new(3); - /// *rc::get_mut(&mut x).unwrap() = 4; + /// *Rc::get_mut(&mut x).unwrap() = 4; /// assert_eq!(*x, 4); /// /// let _y = x.clone(); - /// assert!(rc::get_mut(&mut x).is_none()); + /// assert!(Rc::get_mut(&mut x).is_none()); /// ``` #[inline] #[unstable(feature = "rc_unique")] @@ -432,7 +429,7 @@ impl Rc { #[inline] #[unstable(feature = "rc_unique")] pub fn make_unique(&mut self) -> &mut T { - if !is_unique(self) { + if !Rc::is_unique(self) { *self = Rc::new((**self).clone()) } // This unsafety is ok because we're guaranteed that the pointer diff --git a/src/libcollections/bit.rs b/src/libcollections/bit.rs index 6a07c2c47eb24..51914900fdd99 100644 --- a/src/libcollections/bit.rs +++ b/src/libcollections/bit.rs @@ -86,6 +86,7 @@ use core::cmp::Ordering; use core::cmp; use core::fmt; use core::hash; +#[allow(deprecated)] use core::iter::RandomAccessIterator; use core::iter::{Chain, Enumerate, Repeat, Skip, Take, repeat, Cloned}; use core::iter::{self, FromIterator}; @@ -1188,6 +1189,7 @@ impl<'a> DoubleEndedIterator for Iter<'a> { impl<'a> ExactSizeIterator for Iter<'a> {} #[stable(feature = "rust1", since = "1.0.0")] +#[allow(deprecated)] impl<'a> RandomAccessIterator for Iter<'a> { #[inline] fn indexable(&self) -> usize { diff --git a/src/libcollections/btree/map.rs b/src/libcollections/btree/map.rs index d27d04c3a6cec..27b10213ecd7c 100644 --- a/src/libcollections/btree/map.rs +++ b/src/libcollections/btree/map.rs @@ -685,10 +685,7 @@ mod stack { /// tied to the original tree. pub fn into_top(mut self) -> &'a mut V { unsafe { - mem::copy_mut_lifetime( - self.map, - self.top.from_raw_mut().val_mut() - ) + &mut *(self.top.from_raw_mut().val_mut() as *mut V) } } } diff --git a/src/libcollections/lib.rs b/src/libcollections/lib.rs index b08a3b85e4cbf..8d0f57de4c595 100644 --- a/src/libcollections/lib.rs +++ b/src/libcollections/lib.rs @@ -34,7 +34,6 @@ #![feature(box_patterns)] #![feature(box_raw)] #![feature(box_syntax)] -#![feature(copy_lifetime)] #![feature(core)] #![feature(core_intrinsics)] #![feature(core_prelude)] @@ -56,7 +55,7 @@ #![feature(staged_api)] #![feature(step_by)] #![feature(str_char)] -#![feature(str_internals)] +#![feature(str_match_indices)] #![feature(unboxed_closures)] #![feature(unicode)] #![feature(unique)] diff --git a/src/libcollections/slice.rs b/src/libcollections/slice.rs index 7d74f83552d07..d49463911e66e 100644 --- a/src/libcollections/slice.rs +++ b/src/libcollections/slice.rs @@ -151,6 +151,7 @@ mod hack { } } + #[allow(deprecated)] pub fn permutations(s: &[T]) -> Permutations where T: Clone { Permutations{ swaps: ElementSwaps::new(s.len()), @@ -871,6 +872,7 @@ impl [T] { /// assert_eq!(Some(vec![1, 3, 2]), perms.next()); /// assert_eq!(Some(vec![3, 1, 2]), perms.next()); /// ``` + #[allow(deprecated)] #[unstable(feature = "permutations")] #[deprecated(since = "1.2.0", reason = "not clear this should be in the stdlib")] #[inline] @@ -896,6 +898,7 @@ impl [T] { /// let b: &mut [_] = &mut [1, 0, 2]; /// assert!(v == b); /// ``` + #[allow(deprecated)] #[unstable(feature = "permutations", reason = "uncertain if this merits inclusion in std")] #[deprecated(since = "1.2.0", reason = "not clear this should be in the stdlib")] @@ -920,6 +923,7 @@ impl [T] { /// let b: &mut [_] = &mut [0, 1, 2]; /// assert!(v == b); /// ``` + #[allow(deprecated)] #[unstable(feature = "permutations", reason = "uncertain if this merits inclusion in std")] #[deprecated(since = "1.2.0", reason = "not clear this should be in the stdlib")] @@ -1067,6 +1071,7 @@ impl> SliceConcatExt for [V] { /// /// The last generated swap is always (0, 1), and it returns the /// sequence to its initial order. +#[allow(deprecated)] #[unstable(feature = "permutations")] #[derive(Clone)] #[deprecated(since = "1.2.0", reason = "not clear this should be in the stdlib")] @@ -1078,6 +1083,7 @@ pub struct ElementSwaps { swaps_made : usize, } +#[allow(deprecated)] impl ElementSwaps { /// Creates an `ElementSwaps` iterator for a sequence of `length` elements. #[unstable(feature = "permutations")] @@ -1137,6 +1143,7 @@ struct SizeDirection { } #[stable(feature = "rust1", since = "1.0.0")] +#[allow(deprecated)] impl Iterator for ElementSwaps { type Item = (usize, usize); @@ -1205,12 +1212,14 @@ impl Iterator for ElementSwaps { /// Generates even and odd permutations alternately. #[unstable(feature = "permutations")] #[deprecated(since = "1.2.0", reason = "not clear this should be in the stdlib")] +#[allow(deprecated)] pub struct Permutations { swaps: ElementSwaps, v: Vec, } #[unstable(feature = "permutations", reason = "trait is unstable")] +#[allow(deprecated)] impl Iterator for Permutations { type Item = Vec; diff --git a/src/libcollections/str.rs b/src/libcollections/str.rs index 55265aac99f8e..5e8a9bca342b0 100644 --- a/src/libcollections/str.rs +++ b/src/libcollections/str.rs @@ -1520,7 +1520,6 @@ impl str { /// # Examples /// /// ``` - /// # #![feature(str_matches)] /// let v: Vec<&str> = "abcXXXabcYYYabc".matches("abc").collect(); /// assert_eq!(v, ["abc", "abc", "abc"]); /// @@ -1552,7 +1551,6 @@ impl str { /// # Examples /// /// ``` - /// # #![feature(str_matches)] /// let v: Vec<&str> = "abcXXXabcYYYabc".rmatches("abc").collect(); /// assert_eq!(v, ["abc", "abc", "abc"]); /// @@ -1593,7 +1591,7 @@ impl str { /// # Examples /// /// ``` - /// # #![feature(str_matches)] + /// # #![feature(str_match_indices)] /// let v: Vec<(usize, usize)> = "abcXXXabcYYYabc".match_indices("abc").collect(); /// assert_eq!(v, [(0, 3), (6, 9), (12, 15)]); /// @@ -1637,7 +1635,7 @@ impl str { /// # Examples /// /// ``` - /// # #![feature(str_matches)] + /// # #![feature(str_match_indices)] /// let v: Vec<(usize, usize)> = "abcXXXabcYYYabc".rmatch_indices("abc").collect(); /// assert_eq!(v, [(12, 15), (6, 9), (0, 3)]); /// diff --git a/src/libcollections/vec.rs b/src/libcollections/vec.rs index 6b1e4bb4f8e6f..54528c50f1d1e 100644 --- a/src/libcollections/vec.rs +++ b/src/libcollections/vec.rs @@ -1709,12 +1709,14 @@ impl<'a, T> FromIterator for Cow<'a, [T]> where T: Clone { } } +#[allow(deprecated)] impl<'a, T: 'a> IntoCow<'a, [T]> for Vec where T: Clone { fn into_cow(self) -> Cow<'a, [T]> { Cow::Owned(self) } } +#[allow(deprecated)] impl<'a, T> IntoCow<'a, [T]> for &'a [T] where T: Clone { fn into_cow(self) -> Cow<'a, [T]> { Cow::Borrowed(self) diff --git a/src/libcollections/vec_deque.rs b/src/libcollections/vec_deque.rs index c80fcfc5fedcc..edcd1008747fd 100644 --- a/src/libcollections/vec_deque.rs +++ b/src/libcollections/vec_deque.rs @@ -1530,6 +1530,7 @@ impl<'a, T> DoubleEndedIterator for Iter<'a, T> { impl<'a, T> ExactSizeIterator for Iter<'a, T> {} #[stable(feature = "rust1", since = "1.0.0")] +#[allow(deprecated)] impl<'a, T> RandomAccessIterator for Iter<'a, T> { #[inline] fn indexable(&self) -> usize { diff --git a/src/libcollectionstest/lib.rs b/src/libcollectionstest/lib.rs index 437657cec1658..20a3625fe5add 100644 --- a/src/libcollectionstest/lib.rs +++ b/src/libcollectionstest/lib.rs @@ -43,7 +43,7 @@ #![feature(step_by)] #![feature(str_char)] #![feature(str_escape)] -#![feature(str_matches)] +#![feature(str_match_indices)] #![feature(str_utf16)] #![feature(subslice_offset)] #![feature(test)] diff --git a/src/libcore/iter.rs b/src/libcore/iter.rs index 2f45ffd141820..3026f91e853ee 100644 --- a/src/libcore/iter.rs +++ b/src/libcore/iter.rs @@ -1234,6 +1234,7 @@ impl<'a, I: DoubleEndedIterator + ?Sized> DoubleEndedIterator for &'a mut I { reason = "trait has not proven itself as a widely useful \ abstraction for iterators, and more time may be needed \ for iteration on the design")] +#[allow(deprecated)] pub trait RandomAccessIterator: Iterator { /// Returns the number of indexable elements. At most `std::usize::MAX` /// elements are indexable, even if the iterator represents a longer range. @@ -1313,6 +1314,7 @@ impl DoubleEndedIterator for Rev where I: DoubleEndedIterator { } #[unstable(feature = "iter_idx", reason = "trait is experimental")] +#[allow(deprecated)] impl RandomAccessIterator for Rev where I: DoubleEndedIterator + RandomAccessIterator { @@ -1416,6 +1418,7 @@ impl<'a, I, T: 'a> ExactSizeIterator for Cloned {} #[unstable(feature = "iter_idx", reason = "trait is experimental")] +#[allow(deprecated)] impl<'a, I, T: 'a> RandomAccessIterator for Cloned where I: RandomAccessIterator, T: Clone { @@ -1463,6 +1466,7 @@ impl Iterator for Cycle where I: Clone + Iterator { } #[unstable(feature = "iter_idx", reason = "trait is experimental")] +#[allow(deprecated)] impl RandomAccessIterator for Cycle where I: Clone + RandomAccessIterator, { @@ -1577,6 +1581,7 @@ impl DoubleEndedIterator for Chain where } #[unstable(feature = "iter_idx", reason = "trait is experimental")] +#[allow(deprecated)] impl RandomAccessIterator for Chain where A: RandomAccessIterator, B: RandomAccessIterator, @@ -1665,6 +1670,7 @@ impl DoubleEndedIterator for Zip where } #[unstable(feature = "iter_idx", reason = "trait is experimental")] +#[allow(deprecated)] impl RandomAccessIterator for Zip where A: RandomAccessIterator, B: RandomAccessIterator @@ -1719,6 +1725,7 @@ impl DoubleEndedIterator for Map where } #[unstable(feature = "iter_idx", reason = "trait is experimental")] +#[allow(deprecated)] impl RandomAccessIterator for Map where F: FnMut(I::Item) -> B, { @@ -1893,6 +1900,7 @@ impl DoubleEndedIterator for Enumerate where } #[unstable(feature = "iter_idx", reason = "trait is experimental")] +#[allow(deprecated)] impl RandomAccessIterator for Enumerate where I: RandomAccessIterator { #[inline] fn indexable(&self) -> usize { @@ -2143,6 +2151,7 @@ impl Iterator for Skip where I: Iterator { } #[unstable(feature = "iter_idx", reason = "trait is experimental")] +#[allow(deprecated)] impl RandomAccessIterator for Skip where I: RandomAccessIterator{ #[inline] fn indexable(&self) -> usize { @@ -2215,6 +2224,7 @@ impl Iterator for Take where I: Iterator{ } #[unstable(feature = "iter_idx", reason = "trait is experimental")] +#[allow(deprecated)] impl RandomAccessIterator for Take where I: RandomAccessIterator{ #[inline] fn indexable(&self) -> usize { @@ -2416,6 +2426,7 @@ impl DoubleEndedIterator for Fuse where I: DoubleEndedIterator { // Allow RandomAccessIterators to be fused without affecting random-access behavior #[unstable(feature = "iter_idx", reason = "trait is experimental")] +#[allow(deprecated)] impl RandomAccessIterator for Fuse where I: RandomAccessIterator { #[inline] fn indexable(&self) -> usize { @@ -2491,6 +2502,7 @@ impl DoubleEndedIterator for Inspect } #[unstable(feature = "iter_idx", reason = "trait is experimental")] +#[allow(deprecated)] impl RandomAccessIterator for Inspect where F: FnMut(&I::Item), { @@ -2545,6 +2557,7 @@ impl RandomAccessIterator for Inspect #[deprecated(since = "1.2.0", reason = "has gained enough traction to retain its position \ in the standard library")] +#[allow(deprecated)] pub struct Unfold { f: F, /// Internal state that will be passed to the closure on the next iteration @@ -2556,6 +2569,7 @@ pub struct Unfold { #[deprecated(since = "1.2.0", reason = "has gained enough traction to retain its position \ in the standard library")] +#[allow(deprecated)] 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 @@ -2569,6 +2583,7 @@ impl Unfold where F: FnMut(&mut St) -> Option { } #[stable(feature = "rust1", since = "1.0.0")] +#[allow(deprecated)] impl Iterator for Unfold where F: FnMut(&mut St) -> Option { type Item = A; @@ -2977,7 +2992,7 @@ impl Iterator for Repeat { type Item = A; #[inline] - fn next(&mut self) -> Option { self.idx(0) } + fn next(&mut self) -> Option { Some(self.element.clone()) } #[inline] fn size_hint(&self) -> (usize, Option) { (usize::MAX, None) } } @@ -2985,10 +3000,11 @@ impl Iterator for Repeat { #[stable(feature = "rust1", since = "1.0.0")] impl DoubleEndedIterator for Repeat { #[inline] - fn next_back(&mut self) -> Option { self.idx(0) } + fn next_back(&mut self) -> Option { Some(self.element.clone()) } } #[unstable(feature = "iter_idx", reason = "trait is experimental")] +#[allow(deprecated)] impl RandomAccessIterator for Repeat { #[inline] fn indexable(&self) -> usize { usize::MAX } @@ -3004,6 +3020,7 @@ type IterateState = (F, Option, bool); #[deprecated(since = "1.2.0", reason = "has gained enough traction to retain its position \ in the standard library")] +#[allow(deprecated)] pub type Iterate = Unfold, fn(&mut IterateState) -> Option>; /// Creates a new iterator that produces an infinite sequence of @@ -3012,6 +3029,7 @@ pub type Iterate = Unfold, fn(&mut IterateState) #[deprecated(since = "1.2.0", reason = "has gained enough traction to retain its position \ in the standard library")] +#[allow(deprecated)] pub fn iterate(seed: T, f: F) -> Iterate where T: Clone, F: FnMut(T) -> T, diff --git a/src/libcore/slice.rs b/src/libcore/slice.rs index 91acb0d695545..a8c995f37cce4 100644 --- a/src/libcore/slice.rs +++ b/src/libcore/slice.rs @@ -802,6 +802,7 @@ impl<'a, T> Clone for Iter<'a, T> { } #[unstable(feature = "iter_idx", reason = "trait is experimental")] +#[allow(deprecated)] impl<'a, T> RandomAccessIterator for Iter<'a, T> { #[inline] fn indexable(&self) -> usize { @@ -1174,6 +1175,7 @@ impl<'a, T> DoubleEndedIterator for Windows<'a, T> { impl<'a, T> ExactSizeIterator for Windows<'a, T> {} #[unstable(feature = "iter_idx", reason = "trait is experimental")] +#[allow(deprecated)] impl<'a, T> RandomAccessIterator for Windows<'a, T> { #[inline] fn indexable(&self) -> usize { @@ -1261,6 +1263,7 @@ impl<'a, T> DoubleEndedIterator for Chunks<'a, T> { impl<'a, T> ExactSizeIterator for Chunks<'a, T> {} #[unstable(feature = "iter_idx", reason = "trait is experimental")] +#[allow(deprecated)] impl<'a, T> RandomAccessIterator for Chunks<'a, T> { #[inline] fn indexable(&self) -> usize { @@ -1520,6 +1523,7 @@ pub trait IntSliceExt { macro_rules! impl_int_slice { ($u:ty, $s:ty, $t:ty) => { #[unstable(feature = "int_slice")] + #[allow(deprecated)] impl IntSliceExt<$u, $s> for [$t] { #[inline] fn as_unsigned(&self) -> &[$u] { unsafe { transmute(self) } } diff --git a/src/liblog/lib.rs b/src/liblog/lib.rs index 246b59098658a..7bafd9382f059 100644 --- a/src/liblog/lib.rs +++ b/src/liblog/lib.rs @@ -173,12 +173,10 @@ #![feature(box_syntax)] #![feature(const_fn)] #![feature(iter_cmp)] -#![feature(once_new)] #![feature(rt)] #![feature(staged_api)] #![feature(static_mutex)] -use std::boxed; use std::cell::RefCell; use std::fmt; use std::io::{self, Stderr}; @@ -437,12 +435,12 @@ fn init() { assert!(FILTER.is_null()); match filter { - Some(f) => FILTER = boxed::into_raw(box f), + Some(f) => FILTER = Box::into_raw(box f), None => {} } assert!(DIRECTIVES.is_null()); - DIRECTIVES = boxed::into_raw(box directives); + DIRECTIVES = Box::into_raw(box directives); // Schedule the cleanup for the globals for when the runtime exits. let _ = rt::at_exit(move || { diff --git a/src/librustc/lib.rs b/src/librustc/lib.rs index 377b60570e5fa..240aaae0e55af 100644 --- a/src/librustc/lib.rs +++ b/src/librustc/lib.rs @@ -57,7 +57,7 @@ #![feature(slice_position_elem)] #![feature(staged_api)] #![feature(str_char)] -#![feature(str_matches)] +#![feature(str_match_indices)] #![feature(vec_push_all)] #![feature(wrapping)] #![cfg_attr(test, feature(test))] diff --git a/src/librustc_driver/lib.rs b/src/librustc_driver/lib.rs index 052ec4897d131..fe3ffe9798151 100644 --- a/src/librustc_driver/lib.rs +++ b/src/librustc_driver/lib.rs @@ -26,7 +26,6 @@ html_root_url = "http://doc.rust-lang.org/nightly/")] #![feature(box_syntax)] -#![feature(exit_status)] #![feature(libc)] #![feature(quote)] #![feature(rustc_diagnostic_macros)] @@ -73,6 +72,7 @@ use std::env; use std::io::{self, Read, Write}; use std::iter::repeat; use std::path::PathBuf; +use std::process; use std::str; use std::sync::{Arc, Mutex}; use std::thread; @@ -861,5 +861,5 @@ pub fn diagnostics_registry() -> diagnostics::registry::Registry { pub fn main() { let result = run(env::args().collect()); - std::env::set_exit_status(result as i32); + process::exit(result as i32); } diff --git a/src/librustc_trans/back/write.rs b/src/librustc_trans/back/write.rs index 1b8f049972f21..267f0b6d95329 100644 --- a/src/librustc_trans/back/write.rs +++ b/src/librustc_trans/back/write.rs @@ -25,7 +25,6 @@ use syntax::diagnostic::{Emitter, Handler, Level}; use std::ffi::{CStr, CString}; use std::fs; -use std::iter::Unfold; use std::mem; use std::path::Path; use std::process::{Command, Stdio}; @@ -913,11 +912,10 @@ fn run_work_singlethreaded(sess: &Session, reachable: &[String], work_items: Vec) { let cgcx = CodegenContext::new_with_session(sess, reachable); - let mut work_items = work_items; // Since we're running single-threaded, we can pass the session to // the proc, allowing `optimize_and_codegen` to perform LTO. - for work in Unfold::new((), |_| work_items.pop()) { + for work in work_items.into_iter().rev() { execute_work_item(&cgcx, work); } } diff --git a/src/librustc_trans/lib.rs b/src/librustc_trans/lib.rs index a1e1b395d987d..8ced85d336b74 100644 --- a/src/librustc_trans/lib.rs +++ b/src/librustc_trans/lib.rs @@ -31,9 +31,7 @@ #![feature(fs)] #![feature(iter_cmp)] #![feature(iter_arith)] -#![feature(iter_unfold)] #![feature(libc)] -#![feature(once_new)] #![feature(path_ext)] #![feature(path_ext)] #![feature(path_relative_from)] diff --git a/src/librustdoc/lib.rs b/src/librustdoc/lib.rs index 9db9af32baa15..17d912dd4cb33 100644 --- a/src/librustdoc/lib.rs +++ b/src/librustdoc/lib.rs @@ -23,7 +23,6 @@ #![feature(box_patterns)] #![feature(box_syntax)] #![feature(dynamic_lib)] -#![feature(exit_status)] #![feature(libc)] #![feature(owned_ascii_ext)] #![feature(path_ext)] @@ -61,6 +60,7 @@ use std::env; use std::fs::File; use std::io::{self, Read, Write}; use std::path::PathBuf; +use std::process; use std::rc::Rc; use std::sync::mpsc::channel; @@ -134,7 +134,7 @@ pub fn main() { let s = env::args().collect::>(); main_args(&s) }).unwrap().join().unwrap(); - env::set_exit_status(res as i32); + process::exit(res as i32); } pub fn opts() -> Vec { diff --git a/src/libserialize/lib.rs b/src/libserialize/lib.rs index 5951e4f823e7c..e7d9751cf4bc6 100644 --- a/src/libserialize/lib.rs +++ b/src/libserialize/lib.rs @@ -32,7 +32,6 @@ Core encoding and decoding interfaces. #![feature(enumset)] #![feature(hashmap_hasher)] #![feature(num_bits_bytes)] -#![feature(num_wrapping)] #![feature(rustc_private)] #![feature(staged_api)] #![feature(str_char)] diff --git a/src/libstd/error.rs b/src/libstd/error.rs index 1677f95ca9039..17e8859d63f28 100644 --- a/src/libstd/error.rs +++ b/src/libstd/error.rs @@ -48,7 +48,7 @@ // reconsider what crate these items belong in. use any::TypeId; -use boxed::{self, Box}; +use boxed::Box; use convert::From; use fmt::{self, Debug, Display}; use marker::{Send, Sync, Reflect}; @@ -249,7 +249,7 @@ impl Error { if self.is::() { unsafe { // Get the raw representation of the trait object - let raw = boxed::into_raw(self); + let raw = Box::into_raw(self); let to: TraitObject = transmute::<*mut Error, TraitObject>(raw); diff --git a/src/libstd/ffi/c_str.rs b/src/libstd/ffi/c_str.rs index d5df9b3aa72b2..becc697bcd9a0 100644 --- a/src/libstd/ffi/c_str.rs +++ b/src/libstd/ffi/c_str.rs @@ -8,9 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. - use borrow::{Cow, ToOwned}; -use boxed::{self, Box}; +use boxed::Box; use clone::Clone; use convert::{Into, From}; use cmp::{PartialEq, Eq, PartialOrd, Ord, Ordering}; @@ -226,7 +225,7 @@ impl CString { // It is important that the bytes be sized to fit - we need // the capacity to be determinable from the string length, and // shrinking to fit is the only way to be sure. - boxed::into_raw(self.inner) as *const libc::c_char + Box::into_raw(self.inner) as *const libc::c_char } /// Returns the contents of this `CString` as a slice of bytes. diff --git a/src/libstd/io/buffered.rs b/src/libstd/io/buffered.rs index 95363870cd08f..1d0152e275117 100644 --- a/src/libstd/io/buffered.rs +++ b/src/libstd/io/buffered.rs @@ -465,6 +465,7 @@ pub struct BufStream { leading to issues like #17136")] #[deprecated(since = "1.2.0", reason = "use the crates.io `bufstream` crate instead")] +#[allow(deprecated)] impl BufStream { /// Creates a new buffered stream with explicitly listed capacities for the /// reader/writer buffer. @@ -516,6 +517,7 @@ impl BufStream { #[unstable(feature = "buf_stream", reason = "unsure about semantics of buffering two directions, \ leading to issues like #17136")] +#[allow(deprecated)] impl BufRead for BufStream { fn fill_buf(&mut self) -> io::Result<&[u8]> { self.inner.fill_buf() } fn consume(&mut self, amt: usize) { self.inner.consume(amt) } @@ -524,6 +526,7 @@ impl BufRead for BufStream { #[unstable(feature = "buf_stream", reason = "unsure about semantics of buffering two directions, \ leading to issues like #17136")] +#[allow(deprecated)] impl Read for BufStream { fn read(&mut self, buf: &mut [u8]) -> io::Result { self.inner.read(buf) @@ -533,6 +536,7 @@ impl Read for BufStream { #[unstable(feature = "buf_stream", reason = "unsure about semantics of buffering two directions, \ leading to issues like #17136")] +#[allow(deprecated)] impl Write for BufStream { fn write(&mut self, buf: &[u8]) -> io::Result { self.inner.inner.get_mut().write(buf) @@ -545,6 +549,7 @@ impl Write for BufStream { #[unstable(feature = "buf_stream", reason = "unsure about semantics of buffering two directions, \ leading to issues like #17136")] +#[allow(deprecated)] impl fmt::Debug for BufStream where S: fmt::Debug { fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { let reader = &self.inner; diff --git a/src/libstd/io/lazy.rs b/src/libstd/io/lazy.rs index d398cb88af458..c3e309d182b95 100644 --- a/src/libstd/io/lazy.rs +++ b/src/libstd/io/lazy.rs @@ -10,7 +10,6 @@ use prelude::v1::*; -use boxed; use cell::Cell; use rt; use sync::{StaticMutex, Arc}; @@ -60,7 +59,7 @@ impl Lazy { }); let ret = (self.init)(); if registered.is_ok() { - self.ptr.set(boxed::into_raw(Box::new(ret.clone()))); + self.ptr.set(Box::into_raw(Box::new(ret.clone()))); } return ret } diff --git a/src/libstd/lib.rs b/src/libstd/lib.rs index 9f9435f412339..251f962c5e35e 100644 --- a/src/libstd/lib.rs +++ b/src/libstd/lib.rs @@ -106,7 +106,6 @@ #![feature(alloc)] #![feature(allow_internal_unstable)] #![feature(associated_consts)] -#![feature(borrow_state)] #![feature(box_raw)] #![feature(box_syntax)] #![feature(char_internals)] diff --git a/src/libstd/rt/at_exit_imp.rs b/src/libstd/rt/at_exit_imp.rs index 19a17be4ccf49..17d2940a6f10c 100644 --- a/src/libstd/rt/at_exit_imp.rs +++ b/src/libstd/rt/at_exit_imp.rs @@ -16,13 +16,12 @@ // segfaults (the queue's memory is mysteriously gone), so // instead the cleanup is tied to the `std::rt` entry point. -use boxed; +use alloc::boxed::FnBox; use boxed::Box; -use vec::Vec; -use thunk::Thunk; use sys_common::mutex::Mutex; +use vec::Vec; -type Queue = Vec>; +type Queue = Vec>; // NB these are specifically not types from `std::sync` as they currently rely // on poisoning and this module needs to operate at a lower level than requiring @@ -40,7 +39,7 @@ const ITERS: usize = 10; unsafe fn init() -> bool { if QUEUE.is_null() { let state: Box = box Vec::new(); - QUEUE = boxed::into_raw(state); + QUEUE = Box::into_raw(state); } else if QUEUE as usize == 1 { // can't re-init after a cleanup return false @@ -71,7 +70,7 @@ pub fn cleanup() { } } -pub fn push(f: Thunk<'static>) -> bool { +pub fn push(f: Box) -> bool { let mut ret = true; unsafe { LOCK.lock(); diff --git a/src/libstd/rt/mod.rs b/src/libstd/rt/mod.rs index 1b8e81e2b7913..1729d20da205c 100644 --- a/src/libstd/rt/mod.rs +++ b/src/libstd/rt/mod.rs @@ -139,7 +139,9 @@ fn lang_start(main: *const u8, argc: isize, argv: *const *const u8) -> isize { if failed { rt::DEFAULT_ERROR_CODE } else { - env::get_exit_status() as isize + #[allow(deprecated)] + fn exit_status() -> isize { env::get_exit_status() as isize } + exit_status() } } diff --git a/src/libstd/rt/unwind/gcc.rs b/src/libstd/rt/unwind/gcc.rs index 39b32a3f08e49..84c6d6864a9e5 100644 --- a/src/libstd/rt/unwind/gcc.rs +++ b/src/libstd/rt/unwind/gcc.rs @@ -11,7 +11,6 @@ use prelude::v1::*; use any::Any; -use boxed; use libc::c_void; use rt::libunwind as uw; @@ -29,7 +28,7 @@ pub unsafe fn panic(data: Box) -> ! { }, cause: Some(data), }; - let exception_param = boxed::into_raw(exception) as *mut uw::_Unwind_Exception; + let exception_param = Box::into_raw(exception) as *mut uw::_Unwind_Exception; let error = uw::_Unwind_RaiseException(exception_param); rtabort!("Could not unwind stack, error = {}", error as isize); diff --git a/src/libstd/sync/future.rs b/src/libstd/sync/future.rs index e3ddc1034a540..28dc124f0334f 100644 --- a/src/libstd/sync/future.rs +++ b/src/libstd/sync/future.rs @@ -32,10 +32,11 @@ reason = "futures as-is have yet to be deeply reevaluated with recent \ core changes to Rust's synchronization story, and will likely \ become stable in the future but are unstable until that time")] -#[deprecated(since = "1.2.0", - reason = "implementation does not match the quality of the \ - standard library and this will likely be prototyped \ - outside in crates.io first")] +#![deprecated(since = "1.2.0", + reason = "implementation does not match the quality of the \ + standard library and this will likely be prototyped \ + outside in crates.io first")] +#![allow(deprecated)] use core::prelude::*; use core::mem::replace; diff --git a/src/libstd/sync/mod.rs b/src/libstd/sync/mod.rs index 91e9714fbef48..ab8d4587cfd3d 100644 --- a/src/libstd/sync/mod.rs +++ b/src/libstd/sync/mod.rs @@ -30,6 +30,7 @@ pub use self::rwlock::{RwLockReadGuard, RwLockWriteGuard}; pub use self::rwlock::{RwLock, StaticRwLock, RW_LOCK_INIT}; pub use self::semaphore::{Semaphore, SemaphoreGuard}; +#[allow(deprecated)] pub use self::future::Future; pub mod mpsc; diff --git a/src/libstd/sync/mpsc/mpsc_queue.rs b/src/libstd/sync/mpsc/mpsc_queue.rs index f3edf0d68c759..d6d173e5e7e7e 100644 --- a/src/libstd/sync/mpsc/mpsc_queue.rs +++ b/src/libstd/sync/mpsc/mpsc_queue.rs @@ -42,7 +42,6 @@ pub use self::PopResult::*; use core::prelude::*; -use alloc::boxed; use alloc::boxed::Box; use core::ptr; use core::cell::UnsafeCell; @@ -80,7 +79,7 @@ unsafe impl Sync for Queue { } impl Node { unsafe fn new(v: Option) -> *mut Node { - boxed::into_raw(box Node { + Box::into_raw(box Node { next: AtomicPtr::new(ptr::null_mut()), value: v, }) diff --git a/src/libstd/sync/mpsc/spsc_queue.rs b/src/libstd/sync/mpsc/spsc_queue.rs index 770068a66bec6..3cf75de5a46dd 100644 --- a/src/libstd/sync/mpsc/spsc_queue.rs +++ b/src/libstd/sync/mpsc/spsc_queue.rs @@ -35,7 +35,6 @@ use core::prelude::*; -use alloc::boxed; use alloc::boxed::Box; use core::ptr; use core::cell::UnsafeCell; @@ -78,7 +77,7 @@ unsafe impl Sync for Queue { } impl Node { fn new() -> *mut Node { - boxed::into_raw(box Node { + Box::into_raw(box Node { value: None, next: AtomicPtr::new(ptr::null_mut::>()), }) diff --git a/src/libstd/sync/mutex.rs b/src/libstd/sync/mutex.rs index 64a5027cc8937..41cd11e4c6900 100644 --- a/src/libstd/sync/mutex.rs +++ b/src/libstd/sync/mutex.rs @@ -85,8 +85,6 @@ use sys_common::poison::{self, TryLockError, TryLockResult, LockResult}; /// To recover from a poisoned mutex: /// /// ``` -/// #![feature(sync_poison)] -/// /// use std::sync::{Arc, Mutex}; /// use std::thread; /// diff --git a/src/libstd/sys/common/wtf8.rs b/src/libstd/sys/common/wtf8.rs index 428c8560d8847..8ea673d2162d1 100644 --- a/src/libstd/sys/common/wtf8.rs +++ b/src/libstd/sys/common/wtf8.rs @@ -28,7 +28,7 @@ use core::prelude::*; use core::char::{encode_utf8_raw, encode_utf16_raw}; -use core::str::{char_range_at_raw, next_code_point}; +use core::str::next_code_point; use ascii::*; use borrow::Cow; @@ -1148,30 +1148,6 @@ mod tests { assert_eq!(slice.ascii_byte_at(4), b'\xFF'); } - #[test] - fn wtf8_code_point_at() { - let mut string = Wtf8Buf::from_str("aé "); - string.push(CodePoint::from_u32(0xD83D).unwrap()); - string.push_char('💩'); - assert_eq!(string.code_point_at(0), CodePoint::from_char('a')); - assert_eq!(string.code_point_at(1), CodePoint::from_char('é')); - assert_eq!(string.code_point_at(3), CodePoint::from_char(' ')); - assert_eq!(string.code_point_at(4), CodePoint::from_u32(0xD83D).unwrap()); - assert_eq!(string.code_point_at(7), CodePoint::from_char('💩')); - } - - #[test] - fn wtf8_code_point_range_at() { - let mut string = Wtf8Buf::from_str("aé "); - string.push(CodePoint::from_u32(0xD83D).unwrap()); - string.push_char('💩'); - assert_eq!(string.code_point_range_at(0), (CodePoint::from_char('a'), 1)); - assert_eq!(string.code_point_range_at(1), (CodePoint::from_char('é'), 3)); - assert_eq!(string.code_point_range_at(3), (CodePoint::from_char(' '), 4)); - assert_eq!(string.code_point_range_at(4), (CodePoint::from_u32(0xD83D).unwrap(), 7)); - assert_eq!(string.code_point_range_at(7), (CodePoint::from_char('💩'), 11)); - } - #[test] fn wtf8_code_points() { fn c(value: u32) -> CodePoint { CodePoint::from_u32(value).unwrap() } diff --git a/src/libstd/thread/local.rs b/src/libstd/thread/local.rs index 2b5e3fb18eb16..2c4b716cc6e94 100644 --- a/src/libstd/thread/local.rs +++ b/src/libstd/thread/local.rs @@ -326,7 +326,6 @@ mod imp { // Due to rust-lang/rust#18804, make sure this is not generic! #[cfg(target_os = "linux")] unsafe fn register_dtor(t: *mut u8, dtor: unsafe extern fn(*mut u8)) { - use boxed; use mem; use ptr; use libc; @@ -360,7 +359,7 @@ mod imp { type List = Vec<(*mut u8, unsafe extern fn(*mut u8))>; if DTORS.get().is_null() { let v: Box = box Vec::new(); - DTORS.set(boxed::into_raw(v) as *mut u8); + DTORS.set(Box::into_raw(v) as *mut u8); } let list: &mut List = &mut *(DTORS.get() as *mut List); list.push((t, dtor)); diff --git a/src/libstd/thread/mod.rs b/src/libstd/thread/mod.rs index da9cde8e3cd34..dbb7d3233bc39 100644 --- a/src/libstd/thread/mod.rs +++ b/src/libstd/thread/mod.rs @@ -404,6 +404,7 @@ pub fn spawn(f: F) -> JoinHandle where #[deprecated(since = "1.2.0", reason = "this unsafe API is unlikely to ever be stabilized \ in this form")] +#[allow(deprecated)] pub fn scoped<'a, T, F>(f: F) -> JoinGuard<'a, T> where T: Send + 'a, F: FnOnce() -> T, F: Send + 'a { diff --git a/src/libtest/lib.rs b/src/libtest/lib.rs index 1507226c3a133..f800b4863c669 100644 --- a/src/libtest/lib.rs +++ b/src/libtest/lib.rs @@ -46,7 +46,6 @@ #![feature(set_stdio)] #![feature(slice_extras)] #![feature(staged_api)] -#![feature(thunk)] extern crate getopts; extern crate serialize; @@ -82,7 +81,6 @@ use std::path::PathBuf; use std::sync::mpsc::{channel, Sender}; use std::sync::{Arc, Mutex}; use std::thread; -use std::thunk::Thunk; use std::time::Duration; // to be used by rustc to compile tests in libtest @@ -155,7 +153,7 @@ pub enum TestFn { StaticTestFn(fn()), StaticBenchFn(fn(&mut Bencher)), StaticMetricFn(fn(&mut MetricMap)), - DynTestFn(Thunk<'static>), + DynTestFn(Box), DynMetricFn(Box), DynBenchFn(Box) } @@ -961,7 +959,7 @@ pub fn run_test(opts: &TestOpts, fn run_test_inner(desc: TestDesc, monitor_ch: Sender, nocapture: bool, - testfn: Thunk<'static>) { + testfn: Box) { struct Sink(Arc>>); impl Write for Sink { fn write(&mut self, data: &[u8]) -> io::Result { @@ -1229,7 +1227,6 @@ mod tests { TestDesc, TestDescAndFn, TestOpts, run_test, MetricMap, StaticTestName, DynTestName, DynTestFn, ShouldPanic}; - use std::thunk::Thunk; use std::sync::mpsc::channel; #[test] diff --git a/src/rustbook/main.rs b/src/rustbook/main.rs index 707493e85189c..acb1c5cbd90ba 100644 --- a/src/rustbook/main.rs +++ b/src/rustbook/main.rs @@ -10,7 +10,6 @@ #![deny(warnings)] -#![feature(exit_status)] #![feature(iter_arith)] #![feature(path_relative_from)] #![feature(rustc_private)] @@ -21,6 +20,8 @@ extern crate rustc_back; use std::env; use std::error::Error; +use std::process; +use std::sync::atomic::{AtomicIsize, ATOMIC_ISIZE_INIT, Ordering}; use subcommand::Subcommand; use term::Term; @@ -37,6 +38,8 @@ mod test; mod css; mod javascript; +static EXIT_STATUS: AtomicIsize = ATOMIC_ISIZE_INIT; + #[cfg(not(test))] // thanks #12327 fn main() { let mut term = Term::new(); @@ -70,4 +73,5 @@ fn main() { } } } + process::exit(EXIT_STATUS.load(Ordering::SeqCst) as i32); } diff --git a/src/rustbook/term.rs b/src/rustbook/term.rs index 060297beb758b..cdd25e67c8ff1 100644 --- a/src/rustbook/term.rs +++ b/src/rustbook/term.rs @@ -11,9 +11,9 @@ //! An abstraction of the terminal. Eventually, provide color and //! verbosity support. For now, just a wrapper around stdout/stderr. -use std::env; use std::io; use std::io::prelude::*; +use std::sync::atomic::Ordering; pub struct Term { err: Box @@ -29,6 +29,6 @@ impl Term { pub fn err(&mut self, msg: &str) { // swallow any errors let _ = writeln!(&mut self.err, "{}", msg); - env::set_exit_status(101); + ::EXIT_STATUS.store(101, Ordering::SeqCst); } } diff --git a/src/test/run-pass/issue-11958.rs b/src/test/run-pass/issue-11958.rs index e0c43422c2823..05de69cb966ad 100644 --- a/src/test/run-pass/issue-11958.rs +++ b/src/test/run-pass/issue-11958.rs @@ -8,19 +8,11 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// pretty-expanded FIXME #23616 - #![forbid(warnings)] -#![feature(thunk)] - -// Pretty printing tests complain about `use std::predule::*` -#![allow(unused_imports)] // We shouldn't need to rebind a moved upvar as mut if it's already // marked as mut -use std::thunk::Thunk; - pub fn main() { let mut x = 1; let _thunk = Box::new(move|| { x = 2; }); From 252ef28593458b2479735b4f85c8568bb0f0a3d5 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Thu, 11 Jun 2015 09:54:43 -0700 Subject: [PATCH 27/31] std: Update stable since for `core::char` Also add `#[doc(hidden)]` to a few internal functions. --- src/libcore/char.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/libcore/char.rs b/src/libcore/char.rs index 9f5944d3c9c71..12aa06667a1dd 100644 --- a/src/libcore/char.rs +++ b/src/libcore/char.rs @@ -14,7 +14,7 @@ #![allow(non_snake_case)] #![doc(primitive = "char")] -#![stable(feature = "rust1", since = "1.0.0")] +#![stable(feature = "core_char", since = "1.2.0")] use iter::Iterator; use mem::transmute; @@ -225,6 +225,7 @@ impl CharExt for char { #[inline] #[unstable(feature = "char_internals", reason = "this function should not be exposed publicly")] +#[doc(hidden)] 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() { @@ -258,6 +259,7 @@ pub fn encode_utf8_raw(code: u32, dst: &mut [u8]) -> Option { #[inline] #[unstable(feature = "char_internals", reason = "this function should not be exposed publicly")] +#[doc(hidden)] 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() { From edf933538bc508052320889f9c05f24d75dd6b07 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Thu, 11 Jun 2015 09:56:13 -0700 Subject: [PATCH 28/31] std: Hide some internal functions more aggressively * Add `#[doc(hidden)]` * Rename away from `Error::description` --- src/libcore/num/mod.rs | 6 ++++-- src/libstd/error.rs | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/libcore/num/mod.rs b/src/libcore/num/mod.rs index 6af2148d4ed3d..c1297d3c19c1a 100644 --- a/src/libcore/num/mod.rs +++ b/src/libcore/num/mod.rs @@ -1514,7 +1514,8 @@ impl ParseIntError { #[unstable(feature = "int_error_internals", reason = "available through Error trait and this method should \ not be exposed publicly")] - pub fn description(&self) -> &str { + #[doc(hidden)] + pub fn __description(&self) -> &str { match self.kind { IntErrorKind::Empty => "cannot parse integer from empty string", IntErrorKind::InvalidDigit => "invalid digit found in string", @@ -1527,7 +1528,7 @@ impl ParseIntError { #[stable(feature = "rust1", since = "1.0.0")] impl fmt::Display for ParseIntError { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - self.description().fmt(f) + self.__description().fmt(f) } } @@ -1544,6 +1545,7 @@ pub struct ParseFloatError { #[derive(Debug, Clone, PartialEq)] #[unstable(feature = "float_error_internals", reason = "should not be exposed publicly")] +#[doc(hidden)] pub enum FloatErrorKind { Empty, Invalid, diff --git a/src/libstd/error.rs b/src/libstd/error.rs index 17e8859d63f28..b21b2edf2ecd8 100644 --- a/src/libstd/error.rs +++ b/src/libstd/error.rs @@ -140,7 +140,7 @@ impl Error for str::Utf8Error { #[stable(feature = "rust1", since = "1.0.0")] impl Error for num::ParseIntError { fn description(&self) -> &str { - self.description() + self.__description() } } From c9b40a30c0a8c5776920aec54039d0571e903f5a Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Thu, 11 Jun 2015 11:15:19 -0700 Subject: [PATCH 29/31] std: Stabilize vec_map::Entry::or_insert{,_with} These functions mirror the other Entry APIs of other maps, and were mistakenly just not stabilized the first time around. --- src/libcollections/vec_map.rs | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/libcollections/vec_map.rs b/src/libcollections/vec_map.rs index 98ecd045b9ace..685bb5dc4b4f3 100644 --- a/src/libcollections/vec_map.rs +++ b/src/libcollections/vec_map.rs @@ -646,10 +646,9 @@ impl<'a, V> Entry<'a, V> { } } - #[unstable(feature = "entry", - reason = "matches entry v3 specification, waiting for dust to settle")] - /// Ensures a value is in the entry by inserting the default if empty, and returns - /// a mutable reference to the value in the entry. + #[stable(feature = "vecmap_entry", since = "1.2.0")] + /// Ensures a value is in the entry by inserting the default if empty, and + /// returns a mutable reference to the value in the entry. pub fn or_insert(self, default: V) -> &'a mut V { match self { Occupied(entry) => entry.into_mut(), @@ -657,10 +656,10 @@ impl<'a, V> Entry<'a, V> { } } - #[unstable(feature = "entry", - reason = "matches entry v3 specification, waiting for dust to settle")] - /// Ensures a value is in the entry by inserting the result of the default function if empty, - /// and returns a mutable reference to the value in the entry. + #[stable(feature = "vecmap_entry", since = "1.2.0")] + /// Ensures a value is in the entry by inserting the result of the default + /// function if empty, and returns a mutable reference to the value in the + /// entry. pub fn or_insert_with V>(self, default: F) -> &'a mut V { match self { Occupied(entry) => entry.into_mut(), From 913c2273eba32c7a33e068a5ac68007d7f8419d1 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Thu, 11 Jun 2015 11:26:16 -0700 Subject: [PATCH 30/31] Add comment about stabilizing CString::from_ptr This naming needs to consider the raw vs ptr naming of Box/CStr/CString/slice/etc. --- src/liballoc/boxed.rs | 2 ++ src/libstd/ffi/c_str.rs | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/src/liballoc/boxed.rs b/src/liballoc/boxed.rs index 1a360ebc05c71..1039756363e9f 100644 --- a/src/liballoc/boxed.rs +++ b/src/liballoc/boxed.rs @@ -124,6 +124,7 @@ impl Box { #[unstable(feature = "box_raw", reason = "may be renamed or moved out of Box scope")] #[inline] + // NB: may want to be called from_ptr, see comments on CStr::from_ptr pub unsafe fn from_raw(raw: *mut T) -> Self { mem::transmute(raw) } @@ -147,6 +148,7 @@ impl Box { /// ``` #[unstable(feature = "box_raw", reason = "may be renamed")] #[inline] + // NB: may want to be called into_ptr, see comments on CStr::from_ptr pub fn into_raw(b: Box) -> *mut T { unsafe { mem::transmute(b) } } diff --git a/src/libstd/ffi/c_str.rs b/src/libstd/ffi/c_str.rs index becc697bcd9a0..ffc204ada60fb 100644 --- a/src/libstd/ffi/c_str.rs +++ b/src/libstd/ffi/c_str.rs @@ -206,6 +206,9 @@ impl CString { /// `into_ptr`. The length of the string will be recalculated /// using the pointer. #[unstable(feature = "cstr_memory", reason = "recently added")] + // NB: may want to be called from_raw, needs to consider CStr::from_ptr, + // Box::from_raw (or whatever it's currently called), and + // slice::from_raw_parts pub unsafe fn from_ptr(ptr: *const libc::c_char) -> CString { let len = libc::strlen(ptr) + 1; // Including the NUL byte let slice = slice::from_raw_parts(ptr, len as usize); @@ -221,6 +224,7 @@ impl CString { /// /// Failure to call `from_ptr` will lead to a memory leak. #[unstable(feature = "cstr_memory", reason = "recently added")] + // NB: may want to be called into_raw, see comments on from_ptr pub fn into_ptr(self) -> *const libc::c_char { // It is important that the bytes be sized to fit - we need // the capacity to be determinable from the string length, and From ec333380e03eb1fb94c4938db888d5bed40b8fd6 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Fri, 12 Jun 2015 10:49:39 -0700 Subject: [PATCH 31/31] Fix libstd tests --- src/librustc_trans/lib.rs | 1 - src/librustc_typeck/lib.rs | 1 + src/libstd/lib.rs | 5 ++++- src/libstd/sys/windows/thread_local.rs | 3 +-- src/libstd/thread/local.rs | 3 +-- src/test/run-pass/issue-13259-windows-tcb-trash.rs | 2 -- src/test/run-pass/sync-send-iterators-in-libcore.rs | 10 +++++----- src/test/run-pass/x86stdcall2.rs | 2 -- 8 files changed, 12 insertions(+), 15 deletions(-) diff --git a/src/librustc_trans/lib.rs b/src/librustc_trans/lib.rs index 8ced85d336b74..bb7e95cd4ae44 100644 --- a/src/librustc_trans/lib.rs +++ b/src/librustc_trans/lib.rs @@ -28,7 +28,6 @@ #![feature(box_patterns)] #![feature(box_syntax)] #![feature(const_fn)] -#![feature(fs)] #![feature(iter_cmp)] #![feature(iter_arith)] #![feature(libc)] diff --git a/src/librustc_typeck/lib.rs b/src/librustc_typeck/lib.rs index 764910100360a..7519cd0519569 100644 --- a/src/librustc_typeck/lib.rs +++ b/src/librustc_typeck/lib.rs @@ -75,6 +75,7 @@ This API is completely unstable and subject to change. #![allow(non_camel_case_types)] +#![feature(append)] #![feature(box_patterns)] #![feature(box_syntax)] #![feature(drain)] diff --git a/src/libstd/lib.rs b/src/libstd/lib.rs index 251f962c5e35e..e5242c5bf861a 100644 --- a/src/libstd/lib.rs +++ b/src/libstd/lib.rs @@ -106,6 +106,7 @@ #![feature(alloc)] #![feature(allow_internal_unstable)] #![feature(associated_consts)] +#![feature(borrow_state)] #![feature(box_raw)] #![feature(box_syntax)] #![feature(char_internals)] @@ -130,7 +131,6 @@ #![feature(slice_concat_ext)] #![feature(slice_position_elem)] #![feature(no_std)] -#![feature(num_bits_bytes)] #![feature(oom)] #![feature(optin_builtin_traits)] #![feature(rand)] @@ -148,6 +148,9 @@ #![feature(vec_push_all)] #![feature(wrapping)] #![feature(zero_one)] +#![cfg_attr(all(unix, not(target_os = "macos"), not(target_os = "ios")), + feature(num_bits_bytes))] +#![cfg_attr(windows, feature(str_utf16))] #![cfg_attr(test, feature(float_from_str_radix, range_inclusive, float_extras))] #![cfg_attr(test, feature(test, rustc_private, float_consts))] diff --git a/src/libstd/sys/windows/thread_local.rs b/src/libstd/sys/windows/thread_local.rs index a3d522d1757a9..5002de559884d 100644 --- a/src/libstd/sys/windows/thread_local.rs +++ b/src/libstd/sys/windows/thread_local.rs @@ -12,7 +12,6 @@ use prelude::v1::*; use libc::types::os::arch::extra::{DWORD, LPVOID, BOOL}; -use boxed; use ptr; use rt; use sys_common::mutex::Mutex; @@ -143,7 +142,7 @@ unsafe fn init_dtors() { DTOR_LOCK.unlock(); }); if res.is_ok() { - DTORS = boxed::into_raw(dtors); + DTORS = Box::into_raw(dtors); } else { DTORS = 1 as *mut _; } diff --git a/src/libstd/thread/local.rs b/src/libstd/thread/local.rs index 2c4b716cc6e94..60563340d1021 100644 --- a/src/libstd/thread/local.rs +++ b/src/libstd/thread/local.rs @@ -405,7 +405,6 @@ mod imp { mod imp { use prelude::v1::*; - use alloc::boxed; use cell::{Cell, UnsafeCell}; use marker; use ptr; @@ -447,7 +446,7 @@ mod imp { key: self, value: UnsafeCell::new(None), }; - let ptr = boxed::into_raw(ptr); + let ptr = Box::into_raw(ptr); self.os.set(ptr as *mut u8); Some(&(*ptr).value) } diff --git a/src/test/run-pass/issue-13259-windows-tcb-trash.rs b/src/test/run-pass/issue-13259-windows-tcb-trash.rs index 9ebbddf5141b7..2e03a9a724420 100644 --- a/src/test/run-pass/issue-13259-windows-tcb-trash.rs +++ b/src/test/run-pass/issue-13259-windows-tcb-trash.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// pretty-expanded FIXME #23616 - #![feature(libc, std_misc)] extern crate libc; diff --git a/src/test/run-pass/sync-send-iterators-in-libcore.rs b/src/test/run-pass/sync-send-iterators-in-libcore.rs index 8dda2365ac704..d76bf89d05396 100644 --- a/src/test/run-pass/sync-send-iterators-in-libcore.rs +++ b/src/test/run-pass/sync-send-iterators-in-libcore.rs @@ -10,15 +10,15 @@ // pretty-expanded FIXME #23616 -#![allow(unused_mut)] -#![feature(core)] -#![feature(collections)] -#![feature(step_by)] +#![allow(warnings)] #![feature(iter_empty)] #![feature(iter_once)] +#![feature(iter_unfold)] +#![feature(range_inclusive)] +#![feature(step_by)] +#![feature(str_escape)] use std::iter::{empty, once, range_inclusive, repeat, Unfold}; ->>>>>>> Fallout in tests and docs from feature renamings fn is_sync(_: T) where T: Sync {} fn is_send(_: T) where T: Send {} diff --git a/src/test/run-pass/x86stdcall2.rs b/src/test/run-pass/x86stdcall2.rs index 62da9c9d14be2..c9742b0645e1d 100644 --- a/src/test/run-pass/x86stdcall2.rs +++ b/src/test/run-pass/x86stdcall2.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// pretty-expanded FIXME #23616 - #![feature(std_misc)] pub type HANDLE = u32;