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 616071f0df709..7bfeaec36d729 100644 --- a/src/liballoc/arc.rs +++ b/src/liballoc/arc.rs @@ -134,7 +134,7 @@ impl<T: ?Sized + Unsize<U>, U: ?Sized> CoerceUnsized<Arc<U>> for Arc<T> {} /// 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<T: ?Sized> { // FIXME #12808: strange name to try to avoid interfering with @@ -191,23 +191,35 @@ impl<T: ?Sized> Arc<T> { /// # Examples /// /// ``` - /// # #![feature(alloc)] + /// # #![feature(arc_weak)] /// use std::sync::Arc; /// /// let five = Arc::new(5); /// /// 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<T> { // See the clone() impl for why this is relaxed self.inner().weak.fetch_add(1, Relaxed); Weak { _ptr: self._ptr } } -} -impl<T: ?Sized> Arc<T> { + /// Get the number of weak references to this value. + #[inline] + #[unstable(feature = "arc_counts")] + pub fn weak_count(this: &Arc<T>) -> 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<T>) -> usize { + this.inner().strong.load(SeqCst) + } + #[inline] fn inner(&self) -> &ArcInner<T> { // This unsafety is ok because while this arc is alive we're guaranteed @@ -236,13 +248,15 @@ impl<T: ?Sized> Arc<T> { /// Get the number of weak references to this value. #[inline] -#[unstable(feature = "alloc")] -pub fn weak_count<T: ?Sized>(this: &Arc<T>) -> usize { this.inner().weak.load(SeqCst) - 1 } +#[unstable(feature = "arc_counts")] +#[deprecated(since = "1.2.0", reason = "renamed to Arc::weak_count")] +pub fn weak_count<T: ?Sized>(this: &Arc<T>) -> usize { Arc::weak_count(this) } /// Get the number of strong references to this value. #[inline] -#[unstable(feature = "alloc")] -pub fn strong_count<T: ?Sized>(this: &Arc<T>) -> usize { this.inner().strong.load(SeqCst) } +#[unstable(feature = "arc_counts")] +#[deprecated(since = "1.2.0", reason = "renamed to Arc::strong_count")] +pub fn strong_count<T: ?Sized>(this: &Arc<T>) -> usize { Arc::strong_count(this) } /// Returns a mutable reference to the contained value if the `Arc<T>` is unique. @@ -255,7 +269,7 @@ pub fn strong_count<T: ?Sized>(this: &Arc<T>) -> usize { this.inner().strong.loa /// # Examples /// /// ``` -/// # #![feature(alloc)] +/// # #![feature(arc_unique, alloc)] /// extern crate alloc; /// # fn main() { /// use alloc::arc::{Arc, get_mut}; @@ -271,10 +285,12 @@ pub fn strong_count<T: ?Sized>(this: &Arc<T>) -> usize { this.inner().strong.loa /// # } /// ``` #[inline] -#[unstable(feature = "alloc")] +#[unstable(feature = "arc_unique")] +#[deprecated(since = "1.2.0", + reason = "this function is unsafe with weak pointers")] pub unsafe fn get_mut<T: ?Sized>(this: &mut Arc<T>) -> 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 @@ -342,7 +358,7 @@ impl<T: Clone> Arc<T> { /// # Examples /// /// ``` - /// # #![feature(alloc)] + /// # #![feature(arc_unique)] /// use std::sync::Arc; /// /// # unsafe { @@ -352,7 +368,9 @@ impl<T: Clone> Arc<T> { /// # } /// ``` #[inline] - #[unstable(feature = "alloc")] + #[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 // @@ -438,7 +456,7 @@ impl<T: ?Sized> Drop for Arc<T> { } } -#[unstable(feature = "alloc", +#[unstable(feature = "arc_weak", reason = "Weak pointers may not belong in this module.")] impl<T: ?Sized> Weak<T> { /// Upgrades a weak reference to a strong reference. @@ -451,7 +469,7 @@ impl<T: ?Sized> Weak<T> { /// # Examples /// /// ``` - /// # #![feature(alloc)] + /// # #![feature(arc_weak)] /// use std::sync::Arc; /// /// let five = Arc::new(5); @@ -479,7 +497,7 @@ impl<T: ?Sized> Weak<T> { } } -#[unstable(feature = "alloc", +#[unstable(feature = "arc_weak", reason = "Weak pointers may not belong in this module.")] impl<T: ?Sized> Clone for Weak<T> { /// Makes a clone of the `Weak<T>`. @@ -489,7 +507,7 @@ impl<T: ?Sized> Clone for Weak<T> { /// # Examples /// /// ``` - /// # #![feature(alloc)] + /// # #![feature(arc_weak)] /// use std::sync::Arc; /// /// let weak_five = Arc::new(5).downgrade(); @@ -513,7 +531,7 @@ impl<T: ?Sized> Drop for Weak<T> { /// # Examples /// /// ``` - /// # #![feature(alloc)] + /// # #![feature(arc_weak)] /// use std::sync::Arc; /// /// { diff --git a/src/liballoc/boxed.rs b/src/liballoc/boxed.rs index 4ee500faa22c4..1039756363e9f 100644 --- a/src/liballoc/boxed.rs +++ b/src/liballoc/boxed.rs @@ -10,9 +10,9 @@ //! A pointer type for heap allocation. //! -//! `Box<T>`, 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<T>`, 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<T>), //! ``` //! -//! 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")] @@ -69,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; /// @@ -79,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: () = (); @@ -119,12 +121,37 @@ impl<T : ?Sized> Box<T> { /// 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] + // 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) } + + /// 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] + // NB: may want to be called into_ptr, see comments on CStr::from_ptr + pub fn into_raw(b: Box<T>) -> *mut T { + unsafe { mem::transmute(b) } + } } /// Consumes the `Box`, returning the wrapped raw pointer. @@ -137,18 +164,18 @@ impl<T : ?Sized> Box<T> { /// /// # Examples /// ``` -/// # #![feature(alloc)] +/// # #![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 = "alloc", - 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<T : ?Sized>(b: Box<T>) -> *mut T { - unsafe { mem::transmute(b) } + Box::into_raw(b) } #[stable(feature = "rust1", since = "1.0.0")] @@ -181,7 +208,7 @@ impl<T: Clone> Clone for Box<T> { /// # Examples /// /// ``` - /// # #![feature(alloc, core)] + /// # #![feature(box_raw)] /// let x = Box::new(5); /// let mut y = Box::new(10); /// @@ -242,7 +269,7 @@ impl Box<Any> { if self.is::<T>() { 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); @@ -334,7 +361,7 @@ impl<I: ExactSizeIterator + ?Sized> ExactSizeIterator for Box<I> {} /// -> i32>`. /// /// ``` -/// #![feature(core)] +/// #![feature(fnbox)] /// /// use std::boxed::FnBox; /// use std::collections::HashMap; @@ -355,7 +382,7 @@ impl<I: ExactSizeIterator + ?Sized> ExactSizeIterator for Box<I> {} /// } /// ``` #[rustc_paren_sugar] -#[unstable(feature = "core", reason = "Newly introduced")] +#[unstable(feature = "fnbox", reason = "Newly introduced")] pub trait FnBox<A> { type Output; 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 5541a5f34c41c..7dcf7a76da083 100644 --- a/src/liballoc/lib.rs +++ b/src/liballoc/lib.rs @@ -59,32 +59,40 @@ // Do not remove on snapshot creation. Needed for bootstrap. (Issue #22364) #![cfg_attr(stage0, feature(custom_attribute))] #![crate_name = "alloc"] -#![unstable(feature = "alloc")] -#![feature(staged_api)] -#![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/")] -#![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)] -#![cfg_attr(test, feature(test, alloc, rustc_private))] +#![feature(unsafe_no_drop_flag, filling_drop)] +#![feature(unsize)] + +#![cfg_attr(test, feature(test, alloc, rustc_private, box_raw))] #![cfg_attr(all(not(feature = "external_funcs"), not(feature = "external_crate")), feature(libc))] - #[macro_use] extern crate core; @@ -118,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 @@ -138,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..d5b6c86ef359a 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; @@ -149,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; @@ -213,7 +210,7 @@ impl<T> Rc<T> { // 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 @@ -221,6 +218,42 @@ impl<T> Rc<T> { } } } + + /// Unwraps the contained value if the `Rc<T>` is unique. + /// + /// If the `Rc<T>` is not unique, an `Err` is returned with the same + /// `Rc<T>`. + /// + /// # Examples + /// + /// ``` + /// # #![feature(rc_unique)] + /// use std::rc::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<T>) -> Result<T, Rc<T>> { + 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::<RcBox<T>>(), + min_align_of::<RcBox<T>>()); + forget(rc); + Ok(val) + } + } else { + Err(rc) + } + } } impl<T: ?Sized> Rc<T> { @@ -229,30 +262,90 @@ impl<T: ?Sized> Rc<T> { /// # Examples /// /// ``` - /// # #![feature(alloc)] + /// # #![feature(rc_weak)] /// use std::rc::Rc; /// /// let five = Rc::new(5); /// /// 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<T> { 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<T>) -> usize { this.weak() - 1 } + + /// Get the number of strong references to this value. + #[inline] + #[unstable(feature = "rc_counts")] + pub fn strong_count(this: &Rc<T>) -> usize { this.strong() } + + /// Returns true if there are no other `Rc` or `Weak<T>` values that share + /// the same inner value. + /// + /// # Examples + /// + /// ``` + /// # #![feature(rc_unique)] + /// use std::rc::Rc; + /// + /// let five = Rc::new(5); + /// + /// assert!(Rc::is_unique(&five)); + /// ``` + #[inline] + #[unstable(feature = "rc_unique")] + pub fn is_unique(rc: &Rc<T>) -> bool { + Rc::weak_count(rc) == 0 && Rc::strong_count(rc) == 1 + } + + /// Returns a mutable reference to the contained value if the `Rc<T>` is + /// unique. + /// + /// Returns `None` if the `Rc<T>` is not unique. + /// + /// # Examples + /// + /// ``` + /// # #![feature(rc_unique)] + /// use std::rc::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<T>) -> 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 = "alloc")] -pub fn weak_count<T: ?Sized>(this: &Rc<T>) -> usize { this.weak() - 1 } +#[unstable(feature = "rc_counts")] +#[deprecated(since = "1.2.0", reason = "renamed to Rc::weak_count")] +pub fn weak_count<T: ?Sized>(this: &Rc<T>) -> usize { Rc::weak_count(this) } /// Get the number of strong references to this value. #[inline] -#[unstable(feature = "alloc")] -pub fn strong_count<T: ?Sized>(this: &Rc<T>) -> usize { this.strong() } +#[unstable(feature = "rc_counts")] +#[deprecated(since = "1.2.0", reason = "renamed to Rc::strong_count")] +pub fn strong_count<T: ?Sized>(this: &Rc<T>) -> usize { Rc::strong_count(this) } /// Returns true if there are no other `Rc` or `Weak<T>` values that share the /// same inner value. @@ -260,7 +353,7 @@ pub fn strong_count<T: ?Sized>(this: &Rc<T>) -> usize { this.strong() } /// # Examples /// /// ``` -/// # #![feature(alloc)] +/// # #![feature(rc_unique)] /// use std::rc; /// use std::rc::Rc; /// @@ -269,10 +362,9 @@ pub fn strong_count<T: ?Sized>(this: &Rc<T>) -> usize { this.strong() } /// rc::is_unique(&five); /// ``` #[inline] -#[unstable(feature = "alloc")] -pub fn is_unique<T>(rc: &Rc<T>) -> bool { - weak_count(rc) == 0 && strong_count(rc) == 1 -} +#[unstable(feature = "rc_unique")] +#[deprecated(since = "1.2.0", reason = "renamed to Rc::is_unique")] +pub fn is_unique<T>(rc: &Rc<T>) -> bool { Rc::is_unique(rc) } /// Unwraps the contained value if the `Rc<T>` is unique. /// @@ -281,7 +373,7 @@ pub fn is_unique<T>(rc: &Rc<T>) -> bool { /// # Examples /// /// ``` -/// # #![feature(alloc)] +/// # #![feature(rc_unique)] /// use std::rc::{self, Rc}; /// /// let x = Rc::new(3); @@ -292,22 +384,9 @@ pub fn is_unique<T>(rc: &Rc<T>) -> bool { /// assert_eq!(rc::try_unwrap(x), Err(Rc::new(4))); /// ``` #[inline] -#[unstable(feature = "alloc")] -pub fn try_unwrap<T>(rc: Rc<T>) -> Result<T, Rc<T>> { - 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::<RcBox<T>>(), - min_align_of::<RcBox<T>>()); - forget(rc); - Ok(val) - } - } else { - Err(rc) - } -} +#[unstable(feature = "rc_unique")] +#[deprecated(since = "1.2.0", reason = "renamed to Rc::try_unwrap")] +pub fn try_unwrap<T>(rc: Rc<T>) -> Result<T, Rc<T>> { Rc::try_unwrap(rc) } /// Returns a mutable reference to the contained value if the `Rc<T>` is unique. /// @@ -316,7 +395,7 @@ pub fn try_unwrap<T>(rc: Rc<T>) -> Result<T, Rc<T>> { /// # Examples /// /// ``` -/// # #![feature(alloc)] +/// # #![feature(rc_unique)] /// use std::rc::{self, Rc}; /// /// let mut x = Rc::new(3); @@ -327,15 +406,9 @@ pub fn try_unwrap<T>(rc: Rc<T>) -> Result<T, Rc<T>> { /// assert!(rc::get_mut(&mut x).is_none()); /// ``` #[inline] -#[unstable(feature = "alloc")] -pub fn get_mut<T>(rc: &mut Rc<T>) -> Option<&mut T> { - if is_unique(rc) { - let inner = unsafe { &mut **rc._ptr }; - Some(&mut inner.value) - } else { - None - } -} +#[unstable(feature = "rc_unique")] +#[deprecated(since = "1.2.0", reason = "renamed to Rc::get_mut")] +pub fn get_mut<T>(rc: &mut Rc<T>) -> Option<&mut T> { Rc::get_mut(rc) } impl<T: Clone> Rc<T> { /// Make a mutable reference from the given `Rc<T>`. @@ -346,7 +419,7 @@ impl<T: Clone> Rc<T> { /// # Examples /// /// ``` - /// # #![feature(alloc)] + /// # #![feature(rc_unique)] /// use std::rc::Rc; /// /// let mut five = Rc::new(5); @@ -354,9 +427,9 @@ impl<T: Clone> Rc<T> { /// let mut_five = five.make_unique(); /// ``` #[inline] - #[unstable(feature = "alloc")] + #[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 @@ -390,7 +463,6 @@ impl<T: ?Sized> Drop for Rc<T> { /// # Examples /// /// ``` - /// # #![feature(alloc)] /// use std::rc::Rc; /// /// { @@ -443,7 +515,6 @@ impl<T: ?Sized> Clone for Rc<T> { /// # Examples /// /// ``` - /// # #![feature(alloc)] /// use std::rc::Rc; /// /// let five = Rc::new(5); @@ -652,7 +723,7 @@ impl<T> fmt::Pointer for Rc<T> { /// /// 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<T: ?Sized> { // FIXME #12808: strange names to try to avoid interfering with @@ -663,7 +734,7 @@ pub struct Weak<T: ?Sized> { impl<T: ?Sized> !marker::Send for Weak<T> {} impl<T: ?Sized> !marker::Sync for Weak<T> {} -#[unstable(feature = "alloc", +#[unstable(feature = "rc_weak", reason = "Weak pointers may not belong in this module.")] impl<T: ?Sized> Weak<T> { @@ -677,7 +748,7 @@ impl<T: ?Sized> Weak<T> { /// # Examples /// /// ``` - /// # #![feature(alloc)] + /// # #![feature(rc_weak)] /// use std::rc::Rc; /// /// let five = Rc::new(5); @@ -705,7 +776,7 @@ impl<T: ?Sized> Drop for Weak<T> { /// # Examples /// /// ``` - /// # #![feature(alloc)] + /// # #![feature(rc_weak)] /// use std::rc::Rc; /// /// { @@ -741,7 +812,7 @@ impl<T: ?Sized> Drop for Weak<T> { } } -#[unstable(feature = "alloc", +#[unstable(feature = "rc_weak", reason = "Weak pointers may not belong in this module.")] impl<T: ?Sized> Clone for Weak<T> { @@ -752,7 +823,7 @@ impl<T: ?Sized> Clone for Weak<T> { /// # Examples /// /// ``` - /// # #![feature(alloc)] + /// # #![feature(rc_weak)] /// use std::rc::Rc; /// /// let weak_five = Rc::new(5).downgrade(); diff --git a/src/libarena/lib.rs b/src/libarena/lib.rs index 9bd23494da3d9..109ad8a942c84 100644 --- a/src/libarena/lib.rs +++ b/src/libarena/lib.rs @@ -32,9 +32,12 @@ #![feature(alloc)] #![feature(box_syntax)] -#![feature(core)] +#![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/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<T: Ord> BinaryHeap<T> { /// /// 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<T> { Drain { iter: self.data.drain(..) } } @@ -678,7 +680,7 @@ impl<T> DoubleEndedIterator for IntoIter<T> { impl<T> ExactSizeIterator for IntoIter<T> {} /// 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..51914900fdd99 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; //! @@ -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}; @@ -133,7 +134,7 @@ const FALSE: &'static bool = &false; /// # Examples /// /// ``` -/// # #![feature(collections)] +/// # #![feature(bitvec)] /// use std::collections::BitVec; /// /// let mut bv = BitVec::from_elem(10, false); @@ -156,8 +157,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<u32>, @@ -181,14 +181,16 @@ impl Index<usize> 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 +204,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 @@ -248,7 +251,7 @@ impl BitVec { /// # Examples /// /// ``` - /// # #![feature(collections)] + /// # #![feature(bitvec)] /// use std::collections::BitVec; /// let mut bv = BitVec::new(); /// ``` @@ -263,7 +266,7 @@ impl BitVec { /// # Examples /// /// ``` - /// # #![feature(collections)] + /// # #![feature(bitvec)] /// use std::collections::BitVec; /// /// let bv = BitVec::from_elem(10, false); @@ -304,7 +307,7 @@ impl BitVec { /// # Examples /// /// ``` - /// # #![feature(collections)] + /// # #![feature(bitvec)] /// use std::collections::BitVec; /// /// let bv = BitVec::from_bytes(&[0b10100000, 0b00010010]); @@ -347,7 +350,7 @@ impl BitVec { /// # Examples /// /// ``` - /// # #![feature(collections)] + /// # #![feature(bitvec)] /// use std::collections::BitVec; /// /// let bv = BitVec::from_fn(5, |i| { i % 2 == 0 }); @@ -366,7 +369,7 @@ impl BitVec { /// # Examples /// /// ``` - /// # #![feature(collections)] + /// # #![feature(bitvec)] /// use std::collections::BitVec; /// /// let bv = BitVec::from_bytes(&[0b01100000]); @@ -399,7 +402,7 @@ impl BitVec { /// # Examples /// /// ``` - /// # #![feature(collections)] + /// # #![feature(bitvec)] /// use std::collections::BitVec; /// /// let mut bv = BitVec::from_elem(5, false); @@ -407,8 +410,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; @@ -424,7 +425,7 @@ impl BitVec { /// # Examples /// /// ``` - /// # #![feature(collections)] + /// # #![feature(bitvec)] /// use std::collections::BitVec; /// /// let before = 0b01100000; @@ -445,7 +446,7 @@ impl BitVec { /// # Examples /// /// ``` - /// # #![feature(collections)] + /// # #![feature(bitvec)] /// use std::collections::BitVec; /// /// let before = 0b01100000; @@ -474,7 +475,7 @@ impl BitVec { /// # Examples /// /// ``` - /// # #![feature(collections)] + /// # #![feature(bitvec)] /// use std::collections::BitVec; /// /// let a = 0b01100100; @@ -505,7 +506,7 @@ impl BitVec { /// # Examples /// /// ``` - /// # #![feature(collections)] + /// # #![feature(bitvec)] /// use std::collections::BitVec; /// /// let a = 0b01100100; @@ -536,7 +537,7 @@ impl BitVec { /// # Examples /// /// ``` - /// # #![feature(collections)] + /// # #![feature(bitvec)] /// use std::collections::BitVec; /// /// let a = 0b01100100; @@ -566,7 +567,7 @@ impl BitVec { /// # Examples /// /// ``` - /// # #![feature(collections)] + /// # #![feature(bitvec)] /// use std::collections::BitVec; /// /// let mut bv = BitVec::from_elem(5, true); @@ -591,7 +592,7 @@ impl BitVec { /// # Examples /// /// ``` - /// # #![feature(collections)] + /// # #![feature(bitvec)] /// use std::collections::BitVec; /// /// let bv = BitVec::from_bytes(&[0b01110100, 0b10010010]); @@ -608,7 +609,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 +622,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 +652,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 +667,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"); @@ -712,7 +713,7 @@ impl BitVec { /// # Examples /// /// ``` - /// # #![feature(collections)] + /// # #![feature(bitvec)] /// use std::collections::BitVec; /// /// let mut bv = BitVec::from_elem(10, false); @@ -730,7 +731,7 @@ impl BitVec { /// # Examples /// /// ``` - /// # #![feature(collections)] + /// # #![feature(bitvec)] /// use std::collections::BitVec; /// /// let mut bv = BitVec::from_elem(10, false); @@ -752,7 +753,7 @@ impl BitVec { /// # Examples /// /// ``` - /// # #![feature(collections)] + /// # #![feature(bitvec)] /// use std::collections::BitVec; /// /// let mut bv = BitVec::from_elem(3, true); @@ -800,7 +801,7 @@ impl BitVec { /// # Examples /// /// ``` - /// # #![feature(collections)] + /// # #![feature(bitvec)] /// use std::collections::BitVec; /// /// let bv = BitVec::from_bytes(&[0b10100000]); @@ -821,7 +822,7 @@ impl BitVec { /// # Examples /// /// ``` - /// # #![feature(collections)] + /// # #![feature(bitvec)] /// use std::collections::BitVec; /// /// let mut bv = BitVec::from_bytes(&[0b01001011]); @@ -848,7 +849,7 @@ impl BitVec { /// # Examples /// /// ``` - /// # #![feature(collections)] + /// # #![feature(bitvec)] /// use std::collections::BitVec; /// /// let mut bv = BitVec::from_elem(3, false); @@ -879,7 +880,7 @@ impl BitVec { /// # Examples /// /// ``` - /// # #![feature(collections)] + /// # #![feature(bitvec)] /// use std::collections::BitVec; /// /// let mut bv = BitVec::from_elem(3, false); @@ -902,7 +903,7 @@ impl BitVec { /// # Examples /// /// ``` - /// # #![feature(collections)] + /// # #![feature(bitvec)] /// use std::collections::BitVec; /// /// let mut bv = BitVec::new(); @@ -924,7 +925,7 @@ impl BitVec { /// # Examples /// /// ``` - /// # #![feature(collections)] + /// # #![feature(bitvec)] /// use std::collections::BitVec; /// /// let mut bv = BitVec::from_bytes(&[0b01001011]); @@ -975,7 +976,7 @@ impl BitVec { /// # Examples /// /// ``` - /// # #![feature(collections)] + /// # #![feature(bitvec)] /// use std::collections::BitVec; /// /// let mut bv = BitVec::from_bytes(&[0b01001001]); @@ -1006,7 +1007,7 @@ impl BitVec { /// # Examples /// /// ``` - /// # #![feature(collections)] + /// # #![feature(bitvec)] /// use std::collections::BitVec; /// /// let mut bv = BitVec::new(); @@ -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 { @@ -1224,7 +1226,7 @@ impl<'a> IntoIterator for &'a BitVec { /// # Examples /// /// ``` -/// # #![feature(collections)] +/// # #![feature(bitvec, bitset)] /// use std::collections::{BitSet, BitVec}; /// /// // It's a regular set @@ -1254,8 +1256,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,13 +1323,14 @@ 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`. /// /// # Examples /// /// ``` - /// # #![feature(collections)] + /// # #![feature(bitset)] /// use std::collections::BitSet; /// /// let mut s = BitSet::new(); @@ -1345,7 +1347,7 @@ impl BitSet { /// # Examples /// /// ``` - /// # #![feature(collections)] + /// # #![feature(bitset)] /// use std::collections::BitSet; /// /// let mut s = BitSet::with_capacity(100); @@ -1363,7 +1365,7 @@ impl BitSet { /// # Examples /// /// ``` - /// # #![feature(collections)] + /// # #![feature(bitset, bitvec)] /// use std::collections::{BitVec, BitSet}; /// /// let bv = BitVec::from_bytes(&[0b01100000]); @@ -1385,7 +1387,7 @@ impl BitSet { /// # Examples /// /// ``` - /// # #![feature(collections)] + /// # #![feature(bitset)] /// use std::collections::BitSet; /// /// let mut s = BitSet::with_capacity(100); @@ -1397,9 +1399,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 +1409,7 @@ impl BitSet { /// # Examples /// /// ``` - /// # #![feature(collections)] + /// # #![feature(bitset)] /// use std::collections::BitSet; /// /// let mut s = BitSet::new(); @@ -1422,19 +1424,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 +1457,7 @@ impl BitSet { /// # Examples /// /// ``` - /// # #![feature(collections)] + /// # #![feature(bitset)] /// use std::collections::BitSet; /// /// let mut s = BitSet::new(); @@ -1476,7 +1478,7 @@ impl BitSet { /// # Examples /// /// ``` - /// # #![feature(collections)] + /// # #![feature(bitset)] /// use std::collections::BitSet; /// /// let mut s = BitSet::new(); @@ -1523,7 +1525,7 @@ impl BitSet { /// # Examples /// /// ``` - /// # #![feature(collections)] + /// # #![feature(bitset)] /// use std::collections::BitSet; /// /// let mut s = BitSet::new(); @@ -1556,7 +1558,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 +1580,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 +1604,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 +1635,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 +1671,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 +1707,7 @@ impl BitSet { /// # Examples /// /// ``` - /// # #![feature(collections)] + /// # #![feature(bitset, bitvec)] /// use std::collections::{BitSet, BitVec}; /// /// let a = 0b01101000; @@ -1726,7 +1731,7 @@ impl BitSet { /// # Examples /// /// ``` - /// # #![feature(collections)] + /// # #![feature(bitset, bitvec)] /// use std::collections::{BitSet, BitVec}; /// /// let a = 0b01101000; @@ -1751,7 +1756,7 @@ impl BitSet { /// # Examples /// /// ``` - /// # #![feature(collections)] + /// # #![feature(bitset, bitvec)] /// use std::collections::{BitSet, BitVec}; /// /// let a = 0b01101000; @@ -1784,7 +1789,7 @@ impl BitSet { /// # Examples /// /// ``` - /// # #![feature(collections)] + /// # #![feature(bitset, bitvec)] /// use std::collections::{BitSet, BitVec}; /// /// let a = 0b01101000; @@ -1808,7 +1813,7 @@ impl BitSet { /// # Examples /// /// ``` - /// # #![feature(collections, bit_set_append_split_off)] + /// # #![feature(bitset, bitvec, append)] /// use std::collections::{BitVec, BitSet}; /// /// let mut a = BitSet::new(); @@ -1826,7 +1831,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 +1844,7 @@ impl BitSet { /// # Examples /// /// ``` - /// # #![feature(collections, bit_set_append_split_off)] + /// # #![feature(bitset, bitvec, split_off)] /// use std::collections::{BitSet, BitVec}; /// let mut a = BitSet::new(); /// a.insert(2); @@ -1854,7 +1859,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..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) } } } @@ -1151,7 +1148,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`")] @@ -1507,7 +1504,7 @@ impl<K: Ord, V> BTreeMap<K, V> { /// # Examples /// /// ``` - /// # #![feature(collections)] + /// # #![feature(btree_range, collections_bound)] /// use std::collections::BTreeMap; /// use std::collections::Bound::{Included, Unbounded}; /// @@ -1520,7 +1517,7 @@ impl<K: Ord, V> BTreeMap<K, V> { /// } /// 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, []) @@ -1534,7 +1531,7 @@ impl<K: Ord, V> BTreeMap<K, V> { /// # Examples /// /// ``` - /// # #![feature(collections)] + /// # #![feature(btree_range, collections_bound)] /// use std::collections::BTreeMap; /// use std::collections::Bound::{Included, Excluded}; /// @@ -1548,7 +1545,7 @@ impl<K: Ord, V> BTreeMap<K, V> { /// 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..7c4cda305adf2 100644 --- a/src/libcollections/btree/set.rs +++ b/src/libcollections/btree/set.rs @@ -102,7 +102,7 @@ impl<T: Ord> BTreeSet<T> { /// 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<T> { BTreeSet { map: BTreeMap::with_b(b) } @@ -141,7 +141,7 @@ impl<T: Ord> BTreeSet<T> { /// # Examples /// /// ``` - /// # #![feature(collections)] + /// # #![feature(btree_range, collections_bound)] /// use std::collections::BTreeSet; /// use std::collections::Bound::{Included, Unbounded}; /// @@ -154,7 +154,7 @@ impl<T: Ord> BTreeSet<T> { /// } /// 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, B>((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<E> { // We must maintain the invariant that no bits are set // for which no variant exists @@ -93,22 +98,16 @@ fn bit<E:CLike>(e: &E) -> usize { impl<E:CLike> EnumSet<E> { /// Returns an empty `EnumSet`. - #[unstable(feature = "collections", - reason = "matches collection reform specification, waiting for dust to settle")] pub fn new() -> EnumSet<E> { 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<E:CLike> EnumSet<E> { } /// 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<E>) -> 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<E>) -> 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<E>) -> bool { other.is_superset(self) } @@ -151,8 +144,6 @@ impl<E:CLike> EnumSet<E> { } /// 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<E:CLike> EnumSet<E> { } /// 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<E:CLike> EnumSet<E> { } /// 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<E> { Iter::new(self.bits) } 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 6c233a31149e7..8d0f57de4c595 100644 --- a/src/libcollections/lib.rs +++ b/src/libcollections/lib.rs @@ -10,37 +10,58 @@ //! 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/", - 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_raw)] +#![feature(box_syntax)] #![feature(core)] +#![feature(core_intrinsics)] +#![feature(core_prelude)] +#![feature(core_slice_ext)] +#![feature(core_str_ext)] +#![feature(heap_api)] +#![feature(iter_cmp)] +#![feature(iter_idx)] +#![feature(iter_order)] +#![feature(iter_arith)] +#![feature(iter_arith)] #![feature(lang_items)] +#![feature(num_bits_bytes)] +#![feature(oom)] +#![feature(pattern)] +#![feature(ptr_as_ref)] +#![feature(raw)] +#![feature(slice_patterns)] #![feature(staged_api)] +#![feature(step_by)] +#![feature(str_char)] +#![feature(str_match_indices)] #![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)] @@ -88,14 +109,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; @@ -114,6 +133,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))] @@ -122,6 +142,7 @@ mod std { } /// An endpoint of a range of keys. +#[unstable(feature = "collections_bound")] #[derive(Clone, Copy, Debug, Hash, PartialEq, Eq)] pub enum Bound<T> { /// An inclusive bound. diff --git a/src/libcollections/linked_list.rs b/src/libcollections/linked_list.rs index 8ff49efe9d7d2..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(); @@ -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)) @@ -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(); @@ -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 @@ // <LICENSE-MIT or http://opensource.org/licenses/MIT>, 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..d49463911e66e 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. @@ -149,6 +151,7 @@ mod hack { } } + #[allow(deprecated)] pub fn permutations<T>(s: &[T]) -> Permutations<T> where T: Clone { Permutations{ swaps: ElementSwaps::new(s.len()), @@ -278,14 +281,14 @@ impl<T> [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 +296,14 @@ impl<T> [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 +730,13 @@ impl<T> [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<usize> 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<usize> where T: PartialEq { core_slice::SliceExt::rposition_elem(self, t) } @@ -849,7 +852,7 @@ impl<T> [T] { /// # Examples /// /// ```rust - /// # #![feature(collections)] + /// # #![feature(permutations)] /// let v = [1, 2, 3]; /// let mut perms = v.permutations(); /// @@ -861,7 +864,7 @@ impl<T> [T] { /// Iterating through permutations one by one. /// /// ```rust - /// # #![feature(collections)] + /// # #![feature(permutations)] /// let v = [1, 2, 3]; /// let mut perms = v.permutations(); /// @@ -869,7 +872,9 @@ impl<T> [T] { /// assert_eq!(Some(vec![1, 3, 2]), perms.next()); /// assert_eq!(Some(vec![3, 1, 2]), perms.next()); /// ``` - #[unstable(feature = "collections")] + #[allow(deprecated)] + #[unstable(feature = "permutations")] + #[deprecated(since = "1.2.0", reason = "not clear this should be in the stdlib")] #[inline] pub fn permutations(&self) -> Permutations<T> where T: Clone { // NB see hack module in this file @@ -884,7 +889,7 @@ impl<T> [T] { /// # Example /// /// ```rust - /// # #![feature(collections)] + /// # #![feature(permutations)] /// let v: &mut [_] = &mut [0, 1, 2]; /// v.next_permutation(); /// let b: &mut [_] = &mut [0, 2, 1]; @@ -893,8 +898,10 @@ impl<T> [T] { /// let b: &mut [_] = &mut [1, 0, 2]; /// assert!(v == b); /// ``` - #[unstable(feature = "collections", + #[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")] pub fn next_permutation(&mut self) -> bool where T: Ord { core_slice::SliceExt::next_permutation(self) } @@ -907,7 +914,7 @@ impl<T> [T] { /// # Example /// /// ```rust - /// # #![feature(collections)] + /// # #![feature(permutations)] /// let v: &mut [_] = &mut [1, 0, 2]; /// v.prev_permutation(); /// let b: &mut [_] = &mut [0, 2, 1]; @@ -916,8 +923,10 @@ impl<T> [T] { /// let b: &mut [_] = &mut [0, 1, 2]; /// assert!(v == b); /// ``` - #[unstable(feature = "collections", + #[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")] pub fn prev_permutation(&mut self) -> bool where T: Ord { core_slice::SliceExt::prev_permutation(self) } @@ -929,7 +938,7 @@ impl<T> [T] { /// # Example /// /// ```rust - /// # #![feature(collections)] + /// # #![feature(clone_from_slice)] /// let mut dst = [0, 0, 0]; /// let src = [1, 2]; /// @@ -940,7 +949,7 @@ impl<T> [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) } @@ -960,14 +969,14 @@ impl<T> [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); /// 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<T>, start: usize, end: usize) -> usize { @@ -997,10 +1006,12 @@ impl<T> [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<T: ?Sized> { - #[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 +1025,8 @@ pub trait SliceConcatExt<T: ?Sized> { #[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,8 +1071,10 @@ impl<T: Clone, V: Borrow<[T]>> SliceConcatExt<T> for [V] { /// /// The last generated swap is always (0, 1), and it returns the /// sequence to its initial order. -#[unstable(feature = "collections")] +#[allow(deprecated)] +#[unstable(feature = "permutations")] #[derive(Clone)] +#[deprecated(since = "1.2.0", reason = "not clear this should be in the stdlib")] pub struct ElementSwaps { sdir: Vec<SizeDirection>, /// If `true`, emit the last swap that returns the sequence to initial @@ -1070,9 +1083,11 @@ pub struct ElementSwaps { swaps_made : usize, } +#[allow(deprecated)] impl ElementSwaps { /// Creates an `ElementSwaps` iterator for a sequence of `length` elements. - #[unstable(feature = "collections")] + #[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 @@ -1128,6 +1143,7 @@ struct SizeDirection { } #[stable(feature = "rust1", since = "1.0.0")] +#[allow(deprecated)] impl Iterator for ElementSwaps { type Item = (usize, usize); @@ -1194,13 +1210,16 @@ impl Iterator for ElementSwaps { /// swap applied. /// /// Generates even and odd permutations alternately. -#[unstable(feature = "collections")] +#[unstable(feature = "permutations")] +#[deprecated(since = "1.2.0", reason = "not clear this should be in the stdlib")] +#[allow(deprecated)] pub struct Permutations<T> { swaps: ElementSwaps, v: Vec<T>, } -#[unstable(feature = "collections", reason = "trait is unstable")] +#[unstable(feature = "permutations", reason = "trait is unstable")] +#[allow(deprecated)] impl<T: Clone> Iterator for Permutations<T> { type Item = Vec<T>; diff --git a/src/libcollections/str.rs b/src/libcollections/str.rs index 39e1812512f44..5e8a9bca342b0 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<Chars<'a>> } @@ -585,13 +585,13 @@ impl str { /// # Examples /// /// ``` - /// # #![feature(collections)] + /// # #![feature(slice_chars)] /// let s = "Löwe 老虎 Léopard"; /// /// 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()) } @@ -1520,15 +1520,13 @@ impl str { /// # Examples /// /// ``` - /// # #![feature(collections)] /// let v: Vec<&str> = "abcXXXabcYYYabc".matches("abc").collect(); /// assert_eq!(v, ["abc", "abc", "abc"]); /// /// let v: Vec<&str> = "1abc2abc3".matches(char::is_numeric).collect(); /// assert_eq!(v, ["1", "2", "3"]); /// ``` - #[unstable(feature = "collections", - 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) } @@ -1553,15 +1551,13 @@ impl str { /// # Examples /// /// ``` - /// # #![feature(collections)] /// let v: Vec<&str> = "abcXXXabcYYYabc".rmatches("abc").collect(); /// assert_eq!(v, ["abc", "abc", "abc"]); /// /// let v: Vec<&str> = "1abc2abc3".rmatches(char::is_numeric).collect(); /// assert_eq!(v, ["3", "2", "1"]); /// ``` - #[unstable(feature = "collections", - 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> { @@ -1595,7 +1591,7 @@ impl str { /// # Examples /// /// ``` - /// # #![feature(collections)] + /// # #![feature(str_match_indices)] /// let v: Vec<(usize, usize)> = "abcXXXabcYYYabc".match_indices("abc").collect(); /// assert_eq!(v, [(0, 3), (6, 9), (12, 15)]); /// @@ -1605,7 +1601,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_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)` @@ -1639,7 +1635,7 @@ impl str { /// # Examples /// /// ``` - /// # #![feature(collections)] + /// # #![feature(str_match_indices)] /// let v: Vec<(usize, usize)> = "abcXXXabcYYYabc".rmatch_indices("abc").collect(); /// assert_eq!(v, [(12, 15), (6, 9), (0, 3)]); /// @@ -1649,7 +1645,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_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)` @@ -1669,7 +1665,7 @@ impl str { /// # Examples /// /// ``` - /// # #![feature(collections)] + /// # #![feature(subslice_offset)] /// let string = "a\nb\nc"; /// let lines: Vec<&str> = string.lines().collect(); /// @@ -1677,7 +1673,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) @@ -1863,7 +1859,7 @@ impl str { /// # Examples /// /// ``` - /// #![feature(collections)] + /// #![feature(str_casing)] /// /// let s = "HELLO"; /// assert_eq!(s.to_lowercase(), "hello"); @@ -1909,7 +1905,7 @@ impl str { /// # Examples /// /// ``` - /// #![feature(collections)] + /// #![feature(str_casing)] /// /// let s = "hello"; /// assert_eq!(s.to_uppercase(), "HELLO"); @@ -1922,14 +1918,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<R>(&mut self, range: R) -> Drain where R: RangeArgument<usize> { // 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<char> { diff --git a/src/libcollections/vec.rs b/src/libcollections/vec.rs index ba41f438b37fb..54528c50f1d1e 100644 --- a/src/libcollections/vec.rs +++ b/src/libcollections/vec.rs @@ -276,8 +276,10 @@ impl<T> Vec<T> { /// 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")] + #[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<T> { let mut dst = Vec::with_capacity(elts); dst.set_len(elts); @@ -696,7 +698,7 @@ impl<T> Vec<T> { /// # Examples /// /// ``` - /// # #![feature(collections)] + /// # #![feature(append)] /// let mut vec = vec![1, 2, 3]; /// let mut vec2 = vec![4, 5, 6]; /// vec.append(&mut vec2); @@ -704,7 +706,7 @@ impl<T> Vec<T> { /// 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::<T>() == 0 { @@ -742,7 +744,7 @@ impl<T> Vec<T> { /// # Examples /// /// ``` - /// # #![feature(collections_drain)] + /// # #![feature(drain)] /// /// // Draining using `..` clears the whole vector. /// let mut v = vec![1, 2, 3]; @@ -750,7 +752,7 @@ impl<T> Vec<T> { /// assert_eq!(v, &[]); /// assert_eq!(u, &[1, 2, 3]); /// ``` - #[unstable(feature = "collections_drain", + #[unstable(feature = "drain", reason = "recently added, matches RFC")] pub fn drain<R>(&mut self, range: R) -> Drain<T> where R: RangeArgument<usize> { // Memory safety @@ -840,7 +842,7 @@ impl<T> Vec<T> { /// # 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]); @@ -851,7 +853,7 @@ impl<T> Vec<T> { /// 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<U, F>(self, mut f: F) -> Vec<U> where F: FnMut(T) -> U { // FIXME: Assert statically that the types `T` and `U` have the same @@ -1043,14 +1045,14 @@ impl<T> Vec<T> { /// # 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"); @@ -1082,7 +1084,7 @@ impl<T: Clone> Vec<T> { /// # Examples /// /// ``` - /// # #![feature(collections)] + /// # #![feature(vec_resize)] /// let mut vec = vec!["hello"]; /// vec.resize(3, "world"); /// assert_eq!(vec, ["hello", "world", "world"]); @@ -1091,7 +1093,7 @@ impl<T: Clone> Vec<T> { /// 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(); @@ -1111,13 +1113,13 @@ impl<T: Clone> Vec<T> { /// # 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]); /// ``` #[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()); @@ -1707,12 +1709,14 @@ impl<'a, T> FromIterator<T> for Cow<'a, [T]> where T: Clone { } } +#[allow(deprecated)] impl<'a, T: 'a> IntoCow<'a, [T]> for Vec<T> 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) @@ -1738,7 +1742,7 @@ unsafe impl<T: Sync> Sync for IntoIter<T> { } impl<T> IntoIter<T> { #[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<T> { unsafe { for _x in self.by_ref() { } @@ -1832,7 +1836,7 @@ impl<T> Drop for IntoIter<T> { } /// A draining iterator for `Vec<T>`. -#[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 +1911,17 @@ impl<'a, T> ExactSizeIterator for Drain<'a, T> {} /// Wrapper type providing a `&Vec<T>` 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<T>, 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<T>; @@ -1923,6 +1932,9 @@ impl<'a, T> Deref for DerefVec<'a, T> { // Prevent the inner `Vec<T>` 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 +1960,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..edcd1008747fd 100644 --- a/src/libcollections/vec_deque.rs +++ b/src/libcollections/vec_deque.rs @@ -480,7 +480,7 @@ impl<T> VecDeque<T> { /// # Examples /// /// ``` - /// # #![feature(collections)] + /// # #![feature(deque_extras)] /// use std::collections::VecDeque; /// /// let mut buf = VecDeque::new(); @@ -491,7 +491,7 @@ impl<T> VecDeque<T> { /// 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<T> VecDeque<T> { /// 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<T> VecDeque<T> { /// 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 { @@ -629,7 +629,7 @@ impl<T> VecDeque<T> { /// # Examples /// /// ``` - /// # #![feature(collections)] + /// # #![feature(drain)] /// use std::collections::VecDeque; /// /// let mut v = VecDeque::new(); @@ -638,7 +638,7 @@ impl<T> VecDeque<T> { /// 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<T> { Drain { @@ -868,7 +868,7 @@ impl<T> VecDeque<T> { /// # Examples /// /// ``` - /// # #![feature(collections)] + /// # #![feature(deque_extras)] /// use std::collections::VecDeque; /// /// let mut buf = VecDeque::new(); @@ -880,7 +880,7 @@ impl<T> VecDeque<T> { /// 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<T> { let length = self.len(); @@ -892,8 +892,8 @@ impl<T> VecDeque<T> { 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<T> VecDeque<T> { /// # Examples /// /// ``` - /// # #![feature(collections)] + /// # #![feature(deque_extras)] /// use std::collections::VecDeque; /// /// let mut buf = VecDeque::new(); @@ -914,7 +914,7 @@ impl<T> VecDeque<T> { /// 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<T> { let length = self.len(); @@ -1310,7 +1310,7 @@ impl<T> VecDeque<T> { /// # Examples /// /// ``` - /// # #![feature(collections)] + /// # #![feature(split_off)] /// use std::collections::VecDeque; /// /// let mut buf: VecDeque<_> = vec![1,2,3].into_iter().collect(); @@ -1320,7 +1320,7 @@ impl<T> VecDeque<T> { /// 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(); @@ -1373,7 +1373,7 @@ impl<T> VecDeque<T> { /// # Examples /// /// ``` - /// # #![feature(collections)] + /// # #![feature(append)] /// use std::collections::VecDeque; /// /// let mut buf: VecDeque<_> = vec![1, 2, 3].into_iter().collect(); @@ -1383,7 +1383,7 @@ impl<T> VecDeque<T> { /// 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 @@ -1434,7 +1434,7 @@ impl<T: Clone> VecDeque<T> { /// # Examples /// /// ``` - /// # #![feature(collections)] + /// # #![feature(deque_extras)] /// use std::collections::VecDeque; /// /// let mut buf = VecDeque::new(); @@ -1447,7 +1447,7 @@ impl<T: Clone> VecDeque<T> { /// 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(); @@ -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 { @@ -1635,7 +1636,7 @@ impl<T> DoubleEndedIterator for IntoIter<T> { impl<T> ExactSizeIterator for IntoIter<T> {} /// 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<T>, diff --git a/src/libcollections/vec_map.rs b/src/libcollections/vec_map.rs index 5c2f5759604b7..685bb5dc4b4f3 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::*; @@ -33,7 +35,7 @@ use vec::Vec; /// # Examples /// /// ``` -/// # #![feature(collections)] +/// # #![feature(vecmap)] /// use std::collections::VecMap; /// /// let mut months = VecMap::new(); @@ -133,7 +135,7 @@ impl<V> VecMap<V> { /// # Examples /// /// ``` - /// # #![feature(collections)] + /// # #![feature(vecmap)] /// use std::collections::VecMap; /// let mut map: VecMap<&str> = VecMap::new(); /// ``` @@ -146,7 +148,7 @@ impl<V> VecMap<V> { /// # Examples /// /// ``` - /// # #![feature(collections)] + /// # #![feature(vecmap)] /// use std::collections::VecMap; /// let mut map: VecMap<&str> = VecMap::with_capacity(10); /// ``` @@ -161,7 +163,7 @@ impl<V> VecMap<V> { /// # Examples /// /// ``` - /// # #![feature(collections)] + /// # #![feature(vecmap)] /// use std::collections::VecMap; /// let map: VecMap<String> = VecMap::with_capacity(10); /// assert!(map.capacity() >= 10); @@ -181,7 +183,7 @@ impl<V> VecMap<V> { /// # Examples /// /// ``` - /// # #![feature(collections)] + /// # #![feature(vecmap)] /// use std::collections::VecMap; /// let mut map: VecMap<&str> = VecMap::new(); /// map.reserve_len(10); @@ -206,7 +208,7 @@ impl<V> VecMap<V> { /// # Examples /// /// ``` - /// # #![feature(collections)] + /// # #![feature(vecmap)] /// use std::collections::VecMap; /// let mut map: VecMap<&str> = VecMap::new(); /// map.reserve_len_exact(10); @@ -246,7 +248,7 @@ impl<V> VecMap<V> { /// # Examples /// /// ``` - /// # #![feature(collections)] + /// # #![feature(vecmap)] /// use std::collections::VecMap; /// /// let mut map = VecMap::new(); @@ -275,7 +277,7 @@ impl<V> VecMap<V> { /// # Examples /// /// ``` - /// # #![feature(collections)] + /// # #![feature(vecmap)] /// use std::collections::VecMap; /// /// let mut map = VecMap::new(); @@ -305,7 +307,7 @@ impl<V> VecMap<V> { /// # Examples /// /// ``` - /// # #![feature(collections)] + /// # #![feature(vecmap, append)] /// use std::collections::VecMap; /// /// let mut a = VecMap::new(); @@ -325,7 +327,7 @@ impl<V> VecMap<V> { /// 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()); @@ -341,7 +343,7 @@ impl<V> VecMap<V> { /// # Examples /// /// ``` - /// # #![feature(collections)] + /// # #![feature(vecmap, split_off)] /// use std::collections::VecMap; /// /// let mut a = VecMap::new(); @@ -358,7 +360,7 @@ impl<V> VecMap<V> { /// 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(); @@ -398,7 +400,7 @@ impl<V> VecMap<V> { /// # Examples /// /// ``` - /// # #![feature(collections)] + /// # #![feature(vecmap, drain)] /// use std::collections::VecMap; /// /// let mut map = VecMap::new(); @@ -410,7 +412,7 @@ impl<V> VecMap<V> { /// /// 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<A>((i, v): (usize, Option<A>)) -> Option<(usize, A)> { @@ -426,7 +428,7 @@ impl<V> VecMap<V> { /// # Examples /// /// ``` - /// # #![feature(collections)] + /// # #![feature(vecmap)] /// use std::collections::VecMap; /// /// let mut a = VecMap::new(); @@ -444,7 +446,7 @@ impl<V> VecMap<V> { /// # Examples /// /// ``` - /// # #![feature(collections)] + /// # #![feature(vecmap)] /// use std::collections::VecMap; /// /// let mut a = VecMap::new(); @@ -462,7 +464,7 @@ impl<V> VecMap<V> { /// # Examples /// /// ``` - /// # #![feature(collections)] + /// # #![feature(vecmap)] /// use std::collections::VecMap; /// /// let mut a = VecMap::new(); @@ -478,7 +480,7 @@ impl<V> VecMap<V> { /// # Examples /// /// ``` - /// # #![feature(collections)] + /// # #![feature(vecmap)] /// use std::collections::VecMap; /// /// let mut map = VecMap::new(); @@ -503,7 +505,7 @@ impl<V> VecMap<V> { /// # Examples /// /// ``` - /// # #![feature(collections)] + /// # #![feature(vecmap)] /// use std::collections::VecMap; /// /// let mut map = VecMap::new(); @@ -522,7 +524,7 @@ impl<V> VecMap<V> { /// # Examples /// /// ``` - /// # #![feature(collections)] + /// # #![feature(vecmap)] /// use std::collections::VecMap; /// /// let mut map = VecMap::new(); @@ -550,7 +552,7 @@ impl<V> VecMap<V> { /// # Examples /// /// ``` - /// # #![feature(collections)] + /// # #![feature(vecmap)] /// use std::collections::VecMap; /// /// let mut map = VecMap::new(); @@ -576,7 +578,7 @@ impl<V> VecMap<V> { /// # Examples /// /// ``` - /// # #![feature(collections)] + /// # #![feature(vecmap)] /// use std::collections::VecMap; /// /// let mut map = VecMap::new(); @@ -598,7 +600,7 @@ impl<V> VecMap<V> { /// # Examples /// /// ``` - /// # #![feature(collections)] + /// # #![feature(vecmap, entry)] /// use std::collections::VecMap; /// /// let mut count: VecMap<u32> = VecMap::new(); @@ -632,7 +634,7 @@ impl<V> VecMap<V> { 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,10 +646,9 @@ impl<'a, V> Entry<'a, V> { } } - #[unstable(feature = "collections", - 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(), @@ -655,10 +656,10 @@ impl<'a, V> Entry<'a, V> { } } - #[unstable(feature = "collections", - 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<F: FnOnce() -> V>(self, default: F) -> &'a mut V { match self { Occupied(entry) => entry.into_mut(), @@ -777,7 +778,7 @@ impl<T> IntoIterator for VecMap<T> { /// # Examples /// /// ``` - /// # #![feature(collections)] + /// # #![feature(vecmap)] /// use std::collections::VecMap; /// /// let mut map = VecMap::new(); @@ -1003,14 +1004,14 @@ pub struct IntoIter<V> { fn((usize, Option<V>)) -> Option<(usize, V)>> } -#[unstable(feature = "collections")] +#[unstable(feature = "drain")] pub struct Drain<'a, V:'a> { iter: FilterMap< Enumerate<vec::Drain<'a, Option<V>>>, fn((usize, Option<V>)) -> Option<(usize, V)>> } -#[unstable(feature = "collections")] +#[unstable(feature = "drain")] impl<'a, V> Iterator for Drain<'a, V> { type Item = (usize, V); @@ -1018,7 +1019,7 @@ impl<'a, V> Iterator for Drain<'a, V> { fn size_hint(&self) -> (usize, Option<usize>) { 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/libcollectionstest/lib.rs b/src/libcollectionstest/lib.rs index 0e3f9d5aaddf6..20a3625fe5add 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_match_indices)] +#![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/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<T> { /// Converts the array to immutable slice fn as_slice(&self) -> &[T]; @@ -42,7 +42,6 @@ pub trait FixedSizeArray<T> { macro_rules! array_impls { ($($N:expr)+) => { $( - #[unstable(feature = "core")] impl<T> FixedSizeArray<T> 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<T> 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<T> 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..37f37654c1fee 100644 --- a/src/libcore/cell.rs +++ b/src/libcore/cell.rs @@ -221,7 +221,7 @@ impl<T:Copy> Cell<T> { /// # Examples /// /// ``` - /// # #![feature(core)] + /// # #![feature(as_unsafe_cell)] /// use std::cell::Cell; /// /// let c = Cell::new(5); @@ -229,7 +229,7 @@ impl<T:Copy> Cell<T> { /// let uc = unsafe { c.as_unsafe_cell() }; /// ``` #[inline] - #[unstable(feature = "core")] + #[unstable(feature = "as_unsafe_cell")] pub unsafe fn as_unsafe_cell<'a>(&'a self) -> &'a UnsafeCell<T> { &self.value } @@ -277,7 +277,7 @@ pub struct RefCell<T: ?Sized> { /// An enumeration of values returned from the `state` method on a `RefCell<T>`. #[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<T: ?Sized> RefCell<T> { /// /// 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<T: ?Sized> RefCell<T> { /// /// This function is `unsafe` because `UnsafeCell`'s field is public. #[inline] - #[unstable(feature = "core")] + #[unstable(feature = "as_unsafe_cell")] pub unsafe fn as_unsafe_cell<'a>(&'a self) -> &'a UnsafeCell<T> { &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<Result<u32, ()>> = c.borrow_mut(); - /// let mut b2: RefMut<u32> = RefMut::filter_map(b1, |o| o.as_mut().ok()).unwrap(); + /// let mut b2: RefMut<u32> = 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..12aa06667a1dd 100644 --- a/src/libcore/char.rs +++ b/src/libcore/char.rs @@ -14,6 +14,7 @@ #![allow(non_snake_case)] #![doc(primitive = "char")] +#![stable(feature = "core_char", since = "1.2.0")] use iter::Iterator; use mem::transmute; @@ -131,6 +132,8 @@ pub fn from_digit(num: u32, radix: u32) -> Option<char> { // 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<u32>; @@ -220,6 +223,9 @@ 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")] +#[doc(hidden)] pub fn encode_utf8_raw(code: u32, dst: &mut [u8]) -> Option<usize> { // Marked #[inline] to allow llvm optimizing it away if code < MAX_ONE_B && !dst.is_empty() { @@ -251,6 +257,9 @@ pub fn encode_utf8_raw(code: u32, dst: &mut [u8]) -> Option<usize> { /// 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")] +#[doc(hidden)] pub fn encode_utf16_raw(mut ch: u32, dst: &mut [u16]) -> Option<usize> { // 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..0269499ad5414 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<U>` and `U: PartialEq<V>` then `U: PartialEq<T>` and `T: -/// PartialEq<V>`. +/// Note that these requirements mean that the trait itself must be implemented +/// symmetrically and transitively: if `T: PartialEq<U>` and `U: PartialEq<V>` +/// then `U: PartialEq<T>` and `T: PartialEq<V>`. /// -/// 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<Rhs: ?Sized = Self> { - /// This method tests for `self` and `other` values to be equal, and is used by `==`. + /// This method tests for `self` and `other` values to be equal, and is used + /// by `==`. #[stable(feature = "rust1", since = "1.0.0")] fn eq(&self, other: &Rhs) -> bool; @@ -379,7 +381,7 @@ pub fn max<T: Ord>(v1: T, v2: T) -> T { /// # Examples /// /// ``` -/// # #![feature(core)] +/// # #![feature(cmp_partial)] /// use std::cmp; /// /// assert_eq!(Some(1), cmp::partial_min(1, 2)); @@ -389,14 +391,14 @@ pub fn max<T: Ord>(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); /// assert_eq!(result, None); /// ``` #[inline] -#[unstable(feature = "core")] +#[unstable(feature = "cmp_partial")] pub fn partial_min<T: PartialOrd>(v1: T, v2: T) -> Option<T> { match v1.partial_cmp(&v2) { Some(Less) | Some(Equal) => Some(v1), @@ -412,7 +414,7 @@ pub fn partial_min<T: PartialOrd>(v1: T, v2: T) -> Option<T> { /// # Examples /// /// ``` -/// # #![feature(core)] +/// # #![feature(cmp_partial)] /// use std::cmp; /// /// assert_eq!(Some(2), cmp::partial_max(1, 2)); @@ -422,14 +424,14 @@ pub fn partial_min<T: PartialOrd>(v1: T, v2: T) -> Option<T> { /// When comparison is impossible: /// /// ``` -/// # #![feature(core)] +/// # #![feature(cmp_partial)] /// use std::cmp; /// /// let result = cmp::partial_max(std::f64::NAN, 1.0); /// assert_eq!(result, None); /// ``` #[inline] -#[unstable(feature = "core")] +#[unstable(feature = "cmp_partial")] pub fn partial_max<T: PartialOrd>(v1: T, v2: T) -> Option<T> { 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<usize> { 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<usize> { 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..fc49f87d10769 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>(T, R); @@ -162,11 +162,11 @@ pub struct RadixFmt<T, R>(T, R); /// # Examples /// /// ``` -/// # #![feature(core)] +/// # #![feature(fmt_radix)] /// 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<T>(x: T, base: u8) -> RadixFmt<T, Radix> { 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..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 { @@ -89,7 +89,8 @@ pub trait Hash { fn hash<H: Hasher>(&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<H: Hasher>(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<T: Hash, H: Hasher + Default>(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..3026f91e853ee 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")] @@ -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] = []; @@ -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<Self::Item> where Self: Sized, Self::Item: Ord { let (mut min, mut max) = match self.next() { @@ -892,12 +894,12 @@ 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); /// ``` #[inline] - #[unstable(feature = "core", + #[unstable(feature = "iter_cmp", reason = "may want to produce an Ordering directly; see #15311")] fn max_by<B: Ord, F>(self, f: F) -> Option<Self::Item> where Self: Sized, @@ -920,12 +922,12 @@ 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); /// ``` #[inline] - #[unstable(feature = "core", + #[unstable(feature = "iter_cmp", reason = "may want to produce an Ordering directly; see #15311")] fn min_by<B: Ord, F>(self, f: F) -> Option<Self::Item> 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<Item=&'a mut T> + DoubleEndedIterator { @@ -1057,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::<i32>(), 15); /// ``` - #[unstable(feature="core")] + #[unstable(feature="iter_arith", reason = "bounds recently changed")] fn sum<S=<Self as Iterator>::Item>(self) -> S where S: Add<Self::Item, Output=S> + Zero, Self: Sized, @@ -1075,7 +1079,7 @@ pub trait Iterator { /// # Examples /// /// ``` - /// # #![feature(core)] + /// # #![feature(iter_arith)] /// fn factorial(n: u32) -> u32 { /// (1..).take_while(|&i| i <= n).product() /// } @@ -1083,7 +1087,7 @@ pub trait Iterator { /// assert_eq!(factorial(1), 1); /// assert_eq!(factorial(5), 120); /// ``` - #[unstable(feature="core")] + #[unstable(feature="iter_arith", reason = "bounds recently changed")] fn product<P=<Self as Iterator>::Item>(self) -> P where P: Mul<Self::Item, Output=P> + One, Self: Sized, @@ -1223,9 +1227,14 @@ 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")] +#[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")] +#[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. @@ -1304,7 +1313,8 @@ impl<I> DoubleEndedIterator for Rev<I> where I: DoubleEndedIterator { fn next_back(&mut self) -> Option<<I as Iterator>::Item> { self.iter.next() } } -#[unstable(feature = "core", reason = "trait is experimental")] +#[unstable(feature = "iter_idx", reason = "trait is experimental")] +#[allow(deprecated)] impl<I> RandomAccessIterator for Rev<I> where I: DoubleEndedIterator + RandomAccessIterator { @@ -1324,7 +1334,7 @@ impl<I> RandomAccessIterator for Rev<I> /// `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<T> { /// Empty iterator @@ -1338,6 +1348,7 @@ pub enum MinMaxResult<T> { MinMax(T, T) } +#[unstable(feature = "iter_min_max", reason = "type is unstable")] impl<T: Clone> MinMaxResult<T> { /// `into_option` creates an `Option` of type `(T,T)`. The returned `Option` /// has variant `None` if and only if the `MinMaxResult` has variant @@ -1348,7 +1359,7 @@ impl<T: Clone> MinMaxResult<T> { /// # Examples /// /// ``` - /// # #![feature(core)] + /// # #![feature(iter_min_max)] /// use std::iter::MinMaxResult::{self, NoElements, OneElement, MinMax}; /// /// let r: MinMaxResult<i32> = NoElements; @@ -1360,7 +1371,6 @@ impl<T: Clone> MinMaxResult<T> { /// 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 +1417,8 @@ impl<'a, I, T: 'a> ExactSizeIterator for Cloned<I> where I: ExactSizeIterator<Item=&'a T>, T: Clone {} -#[unstable(feature = "core", reason = "trait is experimental")] +#[unstable(feature = "iter_idx", reason = "trait is experimental")] +#[allow(deprecated)] impl<'a, I, T: 'a> RandomAccessIterator for Cloned<I> where I: RandomAccessIterator<Item=&'a T>, T: Clone { @@ -1454,7 +1465,8 @@ impl<I> Iterator for Cycle<I> where I: Clone + Iterator { } } -#[unstable(feature = "core", reason = "trait is experimental")] +#[unstable(feature = "iter_idx", reason = "trait is experimental")] +#[allow(deprecated)] impl<I> RandomAccessIterator for Cycle<I> where I: Clone + RandomAccessIterator, { @@ -1568,7 +1580,8 @@ impl<A, B> DoubleEndedIterator for Chain<A, B> where } } -#[unstable(feature = "core", reason = "trait is experimental")] +#[unstable(feature = "iter_idx", reason = "trait is experimental")] +#[allow(deprecated)] impl<A, B> RandomAccessIterator for Chain<A, B> where A: RandomAccessIterator, B: RandomAccessIterator<Item = A::Item>, @@ -1656,7 +1669,8 @@ impl<A, B> DoubleEndedIterator for Zip<A, B> where } } -#[unstable(feature = "core", reason = "trait is experimental")] +#[unstable(feature = "iter_idx", reason = "trait is experimental")] +#[allow(deprecated)] impl<A, B> RandomAccessIterator for Zip<A, B> where A: RandomAccessIterator, B: RandomAccessIterator @@ -1710,7 +1724,8 @@ impl<B, I: DoubleEndedIterator, F> DoubleEndedIterator for Map<I, F> where } } -#[unstable(feature = "core", reason = "trait is experimental")] +#[unstable(feature = "iter_idx", reason = "trait is experimental")] +#[allow(deprecated)] impl<B, I: RandomAccessIterator, F> RandomAccessIterator for Map<I, F> where F: FnMut(I::Item) -> B, { @@ -1884,7 +1899,8 @@ impl<I> DoubleEndedIterator for Enumerate<I> where } } -#[unstable(feature = "core", reason = "trait is experimental")] +#[unstable(feature = "iter_idx", reason = "trait is experimental")] +#[allow(deprecated)] impl<I> RandomAccessIterator for Enumerate<I> where I: RandomAccessIterator { #[inline] fn indexable(&self) -> usize { @@ -2134,7 +2150,8 @@ impl<I> Iterator for Skip<I> where I: Iterator { } } -#[unstable(feature = "core", reason = "trait is experimental")] +#[unstable(feature = "iter_idx", reason = "trait is experimental")] +#[allow(deprecated)] impl<I> RandomAccessIterator for Skip<I> where I: RandomAccessIterator{ #[inline] fn indexable(&self) -> usize { @@ -2206,7 +2223,8 @@ impl<I> Iterator for Take<I> where I: Iterator{ } } -#[unstable(feature = "core", reason = "trait is experimental")] +#[unstable(feature = "iter_idx", reason = "trait is experimental")] +#[allow(deprecated)] impl<I> RandomAccessIterator for Take<I> where I: RandomAccessIterator{ #[inline] fn indexable(&self) -> usize { @@ -2236,7 +2254,8 @@ pub struct Scan<I, St, F> { 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 +2425,8 @@ impl<I> DoubleEndedIterator for Fuse<I> 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")] +#[allow(deprecated)] impl<I> RandomAccessIterator for Fuse<I> where I: RandomAccessIterator { #[inline] fn indexable(&self) -> usize { @@ -2427,7 +2447,7 @@ impl<I> Fuse<I> { /// `.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 +2501,8 @@ impl<I: DoubleEndedIterator, F> DoubleEndedIterator for Inspect<I, F> } } -#[unstable(feature = "core", reason = "trait is experimental")] +#[unstable(feature = "iter_idx", reason = "trait is experimental")] +#[allow(deprecated)] impl<I: RandomAccessIterator, F> RandomAccessIterator for Inspect<I, F> where F: FnMut(&I::Item), { @@ -2504,7 +2525,7 @@ impl<I: RandomAccessIterator, F> RandomAccessIterator for Inspect<I, F> /// 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 @@ -2531,16 +2552,24 @@ impl<I: RandomAccessIterator, F> RandomAccessIterator for Inspect<I, F> /// println!("{}", i); /// } /// ``` -#[unstable(feature = "core")] +#[unstable(feature = "iter_unfold")] #[derive(Clone)] +#[deprecated(since = "1.2.0", + reason = "has gained enough traction to retain its position \ + in the standard library")] +#[allow(deprecated)] pub struct Unfold<St, F> { 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")] +#[deprecated(since = "1.2.0", + reason = "has gained enough traction to retain its position \ + in the standard library")] +#[allow(deprecated)] impl<A, St, F> Unfold<St, F> where F: FnMut(&mut St) -> Option<A> { /// Creates a new iterator with the specified closure as the "iterator /// function" and an initial state to eventually pass to the closure @@ -2554,6 +2583,7 @@ impl<A, St, F> Unfold<St, F> where F: FnMut(&mut St) -> Option<A> { } #[stable(feature = "rust1", since = "1.0.0")] +#[allow(deprecated)] impl<A, St, F> Iterator for Unfold<St, F> where F: FnMut(&mut St) -> Option<A> { type Item = A; @@ -2767,7 +2797,7 @@ impl<A> Iterator for StepBy<A, RangeFrom<A>> 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<A> { range: ops::Range<A>, @@ -2776,7 +2806,7 @@ pub struct RangeInclusive<A> { /// 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<A>(start: A, stop: A) -> RangeInclusive<A> where A: Step + One + Clone @@ -2787,7 +2817,7 @@ pub fn range_inclusive<A>(start: A, stop: A) -> RangeInclusive<A> } } -#[unstable(feature = "core", +#[unstable(feature = "range_inclusive", reason = "likely to be replaced by range notation and adapters")] impl<A> Iterator for RangeInclusive<A> where A: PartialEq + Step + One + Clone, @@ -2820,7 +2850,7 @@ impl<A> Iterator for RangeInclusive<A> where } } -#[unstable(feature = "core", +#[unstable(feature = "range_inclusive", reason = "likely to be replaced by range notation and adapters")] impl<A> DoubleEndedIterator for RangeInclusive<A> where A: PartialEq + Step + One + Clone, @@ -2962,7 +2992,7 @@ impl<A: Clone> Iterator for Repeat<A> { type Item = A; #[inline] - fn next(&mut self) -> Option<A> { self.idx(0) } + fn next(&mut self) -> Option<A> { Some(self.element.clone()) } #[inline] fn size_hint(&self) -> (usize, Option<usize>) { (usize::MAX, None) } } @@ -2970,10 +3000,11 @@ impl<A: Clone> Iterator for Repeat<A> { #[stable(feature = "rust1", since = "1.0.0")] impl<A: Clone> DoubleEndedIterator for Repeat<A> { #[inline] - fn next_back(&mut self) -> Option<A> { self.idx(0) } + fn next_back(&mut self) -> Option<A> { Some(self.element.clone()) } } -#[unstable(feature = "core", reason = "trait is experimental")] +#[unstable(feature = "iter_idx", reason = "trait is experimental")] +#[allow(deprecated)] impl<A: Clone> RandomAccessIterator for Repeat<A> { #[inline] fn indexable(&self) -> usize { usize::MAX } @@ -2985,12 +3016,20 @@ type IterateState<T, F> = (F, Option<T>, bool); /// An iterator that repeatedly applies a given function, starting /// from a given seed value. -#[unstable(feature = "core")] +#[unstable(feature = "iter_iterate")] +#[deprecated(since = "1.2.0", + reason = "has gained enough traction to retain its position \ + in the standard library")] +#[allow(deprecated)] pub type Iterate<T, F> = Unfold<IterateState<T, F>, fn(&mut IterateState<T, F>) -> Option<T>>; /// Creates a new iterator that produces an infinite sequence of /// repeated applications of the given function `f`. -#[unstable(feature = "core")] +#[unstable(feature = "iter_iterate")] +#[deprecated(since = "1.2.0", + reason = "has gained enough traction to retain its position \ + in the standard library")] +#[allow(deprecated)] pub fn iterate<T, F>(seed: T, f: F) -> Iterate<T, F> where T: Clone, F: FnMut(T) -> T, @@ -3022,10 +3061,10 @@ pub fn repeat<T: Clone>(elt: T) -> Repeat<T> { } /// An iterator that yields nothing. -#[unstable(feature="iter_empty", reason = "new addition")] +#[stable(feature = "iter_empty", since = "1.2.0")] pub struct Empty<T>(marker::PhantomData<T>); -#[unstable(feature="iter_empty", reason = "new addition")] +#[stable(feature = "iter_empty", since = "1.2.0")] impl<T> Iterator for Empty<T> { type Item = T; @@ -3038,14 +3077,14 @@ impl<T> Iterator for Empty<T> { } } -#[unstable(feature="iter_empty", reason = "new addition")] +#[stable(feature = "iter_empty", since = "1.2.0")] impl<T> DoubleEndedIterator for Empty<T> { fn next_back(&mut self) -> Option<T> { None } } -#[unstable(feature="iter_empty", reason = "new addition")] +#[stable(feature = "iter_empty", since = "1.2.0")] impl<T> ExactSizeIterator for Empty<T> { fn len(&self) -> usize { 0 @@ -3054,7 +3093,7 @@ impl<T> ExactSizeIterator for Empty<T> { // 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<T> Clone for Empty<T> { fn clone(&self) -> Empty<T> { Empty(marker::PhantomData) @@ -3063,7 +3102,7 @@ impl<T> Clone for Empty<T> { // 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<T> Default for Empty<T> { fn default() -> Empty<T> { Empty(marker::PhantomData) @@ -3071,19 +3110,19 @@ impl<T> Default for Empty<T> { } /// Creates an iterator that yields nothing. -#[unstable(feature="iter_empty", reason = "new addition")] +#[stable(feature = "iter_empty", since = "1.2.0")] pub fn empty<T>() -> Empty<T> { 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<T> { inner: ::option::IntoIter<T> } -#[unstable(feature="iter_once", reason = "new addition")] +#[stable(feature = "iter_once", since = "1.2.0")] impl<T> Iterator for Once<T> { type Item = T; @@ -3096,14 +3135,14 @@ impl<T> Iterator for Once<T> { } } -#[unstable(feature="iter_once", reason = "new addition")] +#[stable(feature = "iter_once", since = "1.2.0")] impl<T> DoubleEndedIterator for Once<T> { fn next_back(&mut self) -> Option<T> { self.inner.next_back() } } -#[unstable(feature="iter_once", reason = "new addition")] +#[stable(feature = "iter_once", since = "1.2.0")] impl<T> ExactSizeIterator for Once<T> { fn len(&self) -> usize { self.inner.len() @@ -3111,7 +3150,7 @@ impl<T> ExactSizeIterator for Once<T> { } /// 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<T>(value: T) -> Once<T> { Once { inner: Some(value).into_iter() } } @@ -3123,7 +3162,7 @@ pub fn once<T>(value: T) -> Once<T> { /// /// 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..dd60164a114db 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<T> { // Empty. @@ -223,7 +223,10 @@ impl<T> !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; @@ -385,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<T:Reflect+'static>(x: &T) { @@ -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..15e7cdbde408d 100644 --- a/src/libcore/mem.rs +++ b/src/libcore/mem.rs @@ -459,9 +459,13 @@ pub unsafe fn transmute_copy<T, U>(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")] +#[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) @@ -469,9 +473,13 @@ 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")] +#[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 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: Zeroable>(T); impl<T: Zeroable> NonZero<T> { diff --git a/src/libcore/num/f32.rs b/src/libcore/num/f32.rs index 50dd3f1661adf..aade9061657b7 100644 --- a/src/libcore/num/f32.rs +++ b/src/libcore/num/f32.rs @@ -71,7 +71,9 @@ 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")] + #[deprecated(since = "1.2.0", reason = "unclear on usefulness")] pub const PI_2: f32 = 6.28318530717958647692528676655900576_f32; /// pi/2.0 @@ -135,7 +137,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..7c9e846af9b10 100644 --- a/src/libcore/num/f64.rs +++ b/src/libcore/num/f64.rs @@ -71,7 +71,9 @@ 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")] + #[deprecated(since = "1.2.0", reason = "unclear on usefulness")] pub const PI_2: f64 = 6.28318530717958647692528676655900576_f64; /// pi/2.0 @@ -135,7 +137,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..c1297d3c19c1a 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<T>(#[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")] + #[stable(feature = "num_wrapping", since = "1.2.0")] #[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")] + #[stable(feature = "num_wrapping", since = "1.2.0")] #[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")] + #[stable(feature = "num_wrapping", since = "1.2.0")] #[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")] + #[stable(feature = "num_wrapping", since = "1.2.0")] #[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")] + #[stable(feature = "num_wrapping", since = "1.2.0")] #[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")] + #[stable(feature = "num_wrapping", since = "1.2.0")] #[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")] + #[stable(feature = "num_wrapping", since = "1.2.0")] #[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")] + #[stable(feature = "num_wrapping", since = "1.2.0")] #[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")] + #[stable(feature = "num_wrapping", since = "1.2.0")] #[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")] + #[stable(feature = "num_wrapping", since = "1.2.0")] #[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,8 +1511,11 @@ enum IntErrorKind { } impl ParseIntError { - #[unstable(feature = "core", reason = "available through Error trait")] - pub fn description(&self) -> &str { + #[unstable(feature = "int_error_internals", + reason = "available through Error trait and this method should \ + not be exposed publicly")] + #[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", @@ -1526,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) } } @@ -1535,10 +1537,15 @@ 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")] +#[doc(hidden)] 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<T> { // Empty. diff --git a/src/libcore/option.rs b/src/libcore/option.rs index 593c5e79d3425..c5203c5111b64 100644 --- a/src/libcore/option.rs +++ b/src/libcore/option.rs @@ -274,7 +274,7 @@ impl<T> Option<T> { /// # Examples /// /// ``` - /// # #![feature(core)] + /// # #![feature(as_slice)] /// let mut x = Some("Diamonds"); /// { /// let v = x.as_mut_slice(); @@ -285,7 +285,7 @@ impl<T> Option<T> { /// assert_eq!(x, Some("Dirt")); /// ``` #[inline] - #[unstable(feature = "core", + #[unstable(feature = "as_slice", reason = "waiting for mut conventions")] pub fn as_mut_slice<'r>(&'r mut self) -> &'r mut [T] { match *self { diff --git a/src/libcore/panicking.rs b/src/libcore/panicking.rs index 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..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 { @@ -204,7 +204,7 @@ pub unsafe fn read<T>(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<T>(dest: *mut T) -> T { // Copy the data out from `dest`: @@ -219,7 +219,7 @@ pub unsafe fn read_and_zero<T>(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<T>(dest: *mut T) -> T { // Copy the data out from `dest`: @@ -267,9 +267,10 @@ impl<T: ?Sized> *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<T: ?Sized> *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<T: ?Sized> *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<T: ?Sized> PartialOrd for *mut T { /// modified without a unique path to the `Unique` reference. Useful /// for building abstractions like `Vec<T>` or `Box<T>`, 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<T: ?Sized> { pointer: NonZero<*const T>, _marker: PhantomData<T>, @@ -527,21 +529,19 @@ unsafe impl<T: Send + ?Sized> Send for Unique<T> { } #[unstable(feature = "unique")] unsafe impl<T: Sync + ?Sized> Sync for Unique<T> { } +#[unstable(feature = "unique")] impl<T: ?Sized> Unique<T> { /// Creates a new `Unique`. - #[unstable(feature = "unique")] pub unsafe fn new(ptr: *mut T) -> Unique<T> { 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..43535ddd1d5c5 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. //! @@ -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<T> Clone for Slice<T> { /// # Examples /// /// ``` -/// # #![feature(core)] +/// # #![feature(raw)] /// use std::mem; /// use std::raw; /// diff --git a/src/libcore/result.rs b/src/libcore/result.rs index 772831b1a5862..d87c1020dcc2f 100644 --- a/src/libcore/result.rs +++ b/src/libcore/result.rs @@ -420,7 +420,7 @@ impl<T, E> Result<T, E> { /// Converts from `Result<T, E>` to `&mut [T]` (without copying) /// /// ``` - /// # #![feature(core)] + /// # #![feature(as_slice)] /// let mut x: Result<&str, u32> = Ok("Gold"); /// { /// let v = x.as_mut_slice(); @@ -434,7 +434,7 @@ impl<T, E> Result<T, E> { /// 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,11 @@ impl<A, E, V: FromIterator<A>> FromIterator<Result<A, E>> for Result<V, E> { /// If an `Err` is encountered, it is immediately returned. /// Otherwise, the folded value is returned. #[inline] -#[unstable(feature = "core")] +#[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<T, V, E, diff --git a/src/libcore/simd.rs b/src/libcore/simd.rs index 7b55ba49a07f7..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); @@ -33,10 +33,12 @@ //! These are all experimental. The interface may change entirely, without //! warning. +#![unstable(feature = "core_simd", + reason = "needs an RFC to flesh out the design")] + #![allow(non_camel_case_types)] #![allow(missing_docs)] -#[unstable(feature = "core")] #[simd] #[derive(Copy, Clone, Debug)] #[repr(C)] @@ -45,26 +47,22 @@ pub struct i8x16(pub i8, pub i8, pub i8, pub i8, pub i8, pub i8, pub i8, pub i8, pub i8, pub i8, pub i8, pub i8); -#[unstable(feature = "core")] #[simd] #[derive(Copy, Clone, Debug)] #[repr(C)] pub struct i16x8(pub i16, pub i16, pub i16, pub i16, pub i16, pub i16, pub i16, pub i16); -#[unstable(feature = "core")] #[simd] #[derive(Copy, Clone, Debug)] #[repr(C)] pub struct i32x4(pub i32, pub i32, pub i32, pub i32); -#[unstable(feature = "core")] #[simd] #[derive(Copy, Clone, Debug)] #[repr(C)] pub struct i64x2(pub i64, pub i64); -#[unstable(feature = "core")] #[simd] #[derive(Copy, Clone, Debug)] #[repr(C)] @@ -73,32 +71,27 @@ pub struct u8x16(pub u8, pub u8, pub u8, pub u8, pub u8, pub u8, pub u8, pub u8, pub u8, pub u8, pub u8, pub u8); -#[unstable(feature = "core")] #[simd] #[derive(Copy, Clone, Debug)] #[repr(C)] pub struct u16x8(pub u16, pub u16, pub u16, pub u16, pub u16, pub u16, pub u16, pub u16); -#[unstable(feature = "core")] #[simd] #[derive(Copy, Clone, Debug)] #[repr(C)] pub struct u32x4(pub u32, pub u32, pub u32, pub u32); -#[unstable(feature = "core")] #[simd] #[derive(Copy, Clone, Debug)] #[repr(C)] pub struct u64x2(pub u64, pub u64); -#[unstable(feature = "core")] #[simd] #[derive(Copy, Clone, Debug)] #[repr(C)] pub struct f32x4(pub f32, pub f32, pub f32, pub f32); -#[unstable(feature = "core")] #[simd] #[derive(Copy, Clone, Debug)] #[repr(C)] diff --git a/src/libcore/slice.rs b/src/libcore/slice.rs index 2dc28a4786f2d..a8c995f37cce4 100644 --- a/src/libcore/slice.rs +++ b/src/libcore/slice.rs @@ -64,6 +64,8 @@ use raw::Slice as RawSlice; /// Extension methods for slices. #[allow(missing_docs)] // docs in libcollections #[doc(hidden)] +#[unstable(feature = "core_slice_ext", + reason = "stable interface provided by `impl [T]` in later crates")] pub trait SliceExt { type Item; @@ -148,7 +150,6 @@ macro_rules! slice_ref { }}; } -#[unstable(feature = "core")] impl<T> SliceExt for [T] { type Item = T; @@ -256,7 +257,6 @@ impl<T> SliceExt for [T] { self.repr().data } - #[unstable(feature = "core")] fn binary_search_by<F>(&self, mut f: F) -> Result<usize, usize> where F: FnMut(&T) -> Ordering { @@ -437,12 +437,10 @@ impl<T> SliceExt for [T] { m >= n && needle == &self[m-n..] } - #[unstable(feature = "core")] fn binary_search(&self, x: &T) -> Result<usize, usize> 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<T> 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,8 @@ 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")] +#[allow(deprecated)] impl<'a, T> RandomAccessIterator for Iter<'a, T> { #[inline] fn indexable(&self) -> usize { @@ -842,7 +840,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 +1174,8 @@ 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")] +#[allow(deprecated)] impl<'a, T> RandomAccessIterator for Windows<'a, T> { #[inline] fn indexable(&self) -> usize { @@ -1263,7 +1262,8 @@ 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")] +#[allow(deprecated)] impl<'a, T> RandomAccessIterator for Chunks<'a, T> { #[inline] fn indexable(&self) -> usize { @@ -1349,7 +1349,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 +1357,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 +1415,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 +1503,11 @@ impl<T: PartialOrd> PartialOrd for [T] { } /// Extension methods for slices containing integers. -#[unstable(feature = "core")] +#[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<U, S> { /// Converts the slice to an immutable slice of unsigned integers with the same width. fn as_unsigned<'a>(&'a self) -> &'a [U]; @@ -1518,7 +1522,8 @@ pub trait IntSliceExt<U, S> { macro_rules! impl_int_slice { ($u:ty, $s:ty, $t:ty) => { - #[unstable(feature = "core")] + #[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/libcore/str/mod.rs b/src/libcore/str/mod.rs index ef8b371f06179..5a621176c4a81 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<u8>) -> Option<u32> { // Decode UTF-8 @@ -226,9 +227,8 @@ pub fn next_code_point(bytes: &mut slice::Iter<u8>) -> Option<u32> { /// Reads the last code point out of a byte iterator (assuming a /// UTF-8-like encoding). -#[unstable(feature = "core")] #[inline] -pub fn next_code_point_reverse(bytes: &mut slice::Iter<u8>) -> Option<u32> { +fn next_code_point_reverse(bytes: &mut slice::Iter<u8>) -> Option<u32> { // Decode UTF-8 let w = match bytes.next_back() { None => return None, @@ -738,7 +738,7 @@ generate_pattern_iterators! { #[doc="Created with the method `.rmatch_indices()`."] struct RMatchIndices; stability: - #[unstable(feature = "core", + #[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 = "core", reason = "type got recently added")] + #[stable(feature = "str_matches", since = "1.2.0")] internal: MatchesInternal yielding (&'a str); delegate double ended; @@ -1470,6 +1470,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,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 = "core")] -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/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 <LICENSE-APACHE or -// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license -// <LICENSE-MIT or http://opensource.org/licenses/MIT>, 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/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/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/liblog/lib.rs b/src/liblog/lib.rs index 15767024ba80f..7bafd9382f059 100644 --- a/src/liblog/lib.rs +++ b/src/liblog/lib.rs @@ -169,14 +169,14 @@ html_playground_url = "http://play.rust-lang.org/")] #![deny(missing_docs)] -#![feature(alloc)] -#![feature(staged_api)] +#![feature(box_raw)] #![feature(box_syntax)] -#![feature(core)] #![feature(const_fn)] -#![feature(std_misc)] +#![feature(iter_cmp)] +#![feature(rt)] +#![feature(staged_api)] +#![feature(static_mutex)] -use std::boxed; use std::cell::RefCell; use std::fmt; use std::io::{self, Stderr}; @@ -435,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/librand/lib.rs b/src/librand/lib.rs index 7ade4ef1c4628..ec510b4a5bdfb 100644 --- a/src/librand/lib.rs +++ b/src/librand/lib.rs @@ -29,11 +29,15 @@ #![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)] -#![cfg_attr(test, feature(test, rand, rustc_private))] +#![cfg_attr(test, feature(test, rand, rustc_private, iter_order))] #![allow(deprecated)] 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..240aaae0e55af 100644 --- a/src/librustc/lib.rs +++ b/src/librustc/lib.rs @@ -25,26 +25,41 @@ 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(core)] #![feature(duration)] #![feature(duration_span)] +#![feature(dynamic_lib)] +#![feature(enumset)] #![feature(fs_canonicalize)] -#![feature(hash)] +#![feature(hash_default)] +#![feature(hashmap_hasher)] #![feature(into_cow)] +#![feature(iter_cmp)] +#![feature(iter_arith)] #![feature(libc)] +#![feature(map_in_place)] +#![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_extras)] #![feature(slice_patterns)] +#![feature(slice_position_elem)] #![feature(staged_api)] -#![feature(std_misc)] #![feature(str_char)] +#![feature(str_match_indices)] +#![feature(vec_push_all)] +#![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..297041a990790 100644 --- a/src/librustc_back/lib.rs +++ b/src/librustc_back/lib.rs @@ -33,15 +33,15 @@ html_root_url = "http://doc.rust-lang.org/nightly/")] #![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)] +#![feature(vec_push_all)] #![cfg_attr(test, feature(test, rand))] extern crate syntax; 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 6ae0ea81c3dda..fe3ffe9798151 100644 --- a/src/librustc_driver/lib.rs +++ b/src/librustc_driver/lib.rs @@ -26,14 +26,13 @@ html_root_url = "http://doc.rust-lang.org/nightly/")] #![feature(box_syntax)] -#![feature(collections)] #![feature(libc)] #![feature(quote)] #![feature(rustc_diagnostic_macros)] #![feature(rustc_private)] -#![feature(staged_api)] -#![feature(exit_status)] #![feature(set_stdio)] +#![feature(staged_api)] +#![feature(vec_push_all)] extern crate arena; extern crate flate; @@ -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_lint/lib.rs b/src/librustc_lint/lib.rs index 1737de827e3ce..c680906dd135b 100644 --- a/src/librustc_lint/lib.rs +++ b/src/librustc_lint/lib.rs @@ -30,16 +30,16 @@ 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)] -#![cfg_attr(stage0, feature(collections))] -#![feature(core)] +#![feature(num_bits_bytes)] #![feature(quote)] +#![feature(ref_slice)] #![feature(rustc_diagnostic_macros)] #![feature(rustc_private)] #![feature(staged_api)] #![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 c47922dd95471..787f914718d4b 100644 --- a/src/librustc_resolve/lib.rs +++ b/src/librustc_resolve/lib.rs @@ -19,11 +19,11 @@ 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(slice_extras)] #![feature(staged_api)] #[macro_use] extern crate log; 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<WorkItem>) { 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 9f25c8d5fee14..bb7e95cd4ae44 100644 --- a/src/librustc_trans/lib.rs +++ b/src/librustc_trans/lib.rs @@ -25,21 +25,24 @@ 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)] -#![feature(core)] #![feature(const_fn)] +#![feature(iter_cmp)] +#![feature(iter_arith)] #![feature(libc)] +#![feature(path_ext)] +#![feature(path_ext)] +#![feature(path_relative_from)] +#![feature(path_relative_from)] #![feature(quote)] +#![feature(rc_weak)] #![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(vec_push_all)] #![allow(trivial_casts)] diff --git a/src/librustc_typeck/lib.rs b/src/librustc_typeck/lib.rs index 67101a69b5709..7519cd0519569 100644 --- a/src/librustc_typeck/lib.rs +++ b/src/librustc_typeck/lib.rs @@ -75,14 +75,19 @@ This API is completely unstable and subject to change. #![allow(non_camel_case_types)] +#![feature(append)] #![feature(box_patterns)] #![feature(box_syntax)] -#![feature(collections, collections_drain)] -#![feature(core)] +#![feature(drain)] +#![feature(iter_cmp)] +#![feature(iter_arith)] #![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<usize> { C::encode_utf8(self, dst) } + pub fn encode_utf8(self, dst: &mut [u8]) -> Option<usize> { + 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<usize> { C::encode_utf16(self, dst) } + pub fn encode_utf16(self, dst: &mut [u16]) -> Option<usize> { + 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<usize> { charwidth::width(self, is_cjk) } + pub fn width(self, is_cjk: bool) -> Option<usize> { + charwidth::width(self, is_cjk) + } } diff --git a/src/librustc_unicode/lib.rs b/src/librustc_unicode/lib.rs index a9456cb487c6a..b420444d1f5c8 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_arith)] +#![feature(lang_items)] +#![feature(no_std)] +#![feature(staged_api)] extern crate core; diff --git a/src/librustdoc/lib.rs b/src/librustdoc/lib.rs index 38cc120698431..17d912dd4cb33 100644 --- a/src/librustdoc/lib.rs +++ b/src/librustdoc/lib.rs @@ -22,18 +22,20 @@ #![feature(box_patterns)] #![feature(box_syntax)] -#![feature(collections)] -#![feature(exit_status)] -#![feature(set_stdio)] +#![feature(dynamic_lib)] #![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; @@ -58,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; @@ -131,7 +134,7 @@ pub fn main() { let s = env::args().collect::<Vec<_>>(); main_args(&s) }).unwrap().join().unwrap(); - env::set_exit_status(res as i32); + process::exit(res as i32); } pub fn opts() -> Vec<getopts::OptGroup> { diff --git a/src/libserialize/lib.rs b/src/libserialize/lib.rs index 31790ce6290fe..e7d9751cf4bc6 100644 --- a/src/libserialize/lib.rs +++ b/src/libserialize/lib.rs @@ -29,12 +29,14 @@ Core encoding and decoding interfaces. #![feature(box_syntax)] #![feature(collections)] -#![feature(core)] +#![feature(enumset)] +#![feature(hashmap_hasher)] +#![feature(num_bits_bytes)] #![feature(rustc_private)] #![feature(staged_api)] -#![feature(std_misc)] -#![feature(unicode)] #![feature(str_char)] +#![feature(unicode)] +#![feature(vecmap)] #![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<u8> { #[inline] fn into_ascii_uppercase(mut self) -> Vec<u8> { 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<K, V, S> HashMap<K, V, S> /// # Examples /// /// ``` - /// # #![feature(std_misc)] + /// # #![feature(hashmap_hasher)] /// use std::collections::HashMap; /// use std::collections::hash_map::RandomState; /// @@ -553,7 +552,7 @@ impl<K, V, S> HashMap<K, V, S> /// 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<K, V, S> { HashMap { hash_state: hash_state, @@ -573,7 +572,7 @@ impl<K, V, S> HashMap<K, V, S> /// # Examples /// /// ``` - /// # #![feature(std_misc)] + /// # #![feature(hashmap_hasher)] /// use std::collections::HashMap; /// use std::collections::hash_map::RandomState; /// @@ -582,7 +581,7 @@ impl<K, V, S> HashMap<K, V, S> /// 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<K, V, S> { let resize_policy = DefaultResizePolicy::new(); @@ -980,7 +979,7 @@ impl<K, V, S> HashMap<K, V, S> /// # Examples /// /// ``` - /// # #![feature(std_misc)] + /// # #![feature(drain)] /// use std::collections::HashMap; /// /// let mut a = HashMap::new(); @@ -995,7 +994,7 @@ impl<K, V, S> HashMap<K, V, S> /// 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<K, V> { fn last_two<A, B, C>((_, 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<table::Drain<'a, K, V>, 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<K, V, S> Extend<(K, V)> for HashMap<K, V, S> /// `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<T, S> HashSet<T, S> /// # Examples /// /// ``` - /// # #![feature(std_misc)] + /// # #![feature(hashmap_hasher)] /// use std::collections::HashSet; /// use std::collections::hash_map::RandomState; /// @@ -161,7 +163,7 @@ impl<T, S> HashSet<T, S> /// 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<T, S> { HashSet::with_capacity_and_hash_state(INITIAL_CAPACITY, hash_state) } @@ -177,7 +179,7 @@ impl<T, S> HashSet<T, S> /// # Examples /// /// ``` - /// # #![feature(std_misc)] + /// # #![feature(hashmap_hasher)] /// use std::collections::HashSet; /// use std::collections::hash_map::RandomState; /// @@ -186,7 +188,7 @@ impl<T, S> HashSet<T, S> /// 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<T, S> { HashSet { @@ -406,7 +408,7 @@ impl<T, S> HashSet<T, S> /// 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<T> { fn first<A, B>((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<H>(marker::PhantomData<H>); impl<H: Default + hash::Hasher> HashState for DefaultState<H> { 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/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 } diff --git a/src/libstd/error.rs b/src/libstd/error.rs index 328c75b6d9e20..b21b2edf2ecd8 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}; @@ -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::<Self>() @@ -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() } } @@ -249,7 +249,7 @@ impl Error { if self.is::<T>() { 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 433bb335a805b..ffc204ada60fb 100644 --- a/src/libstd/ffi/c_str.rs +++ b/src/libstd/ffi/c_str.rs @@ -8,10 +8,8 @@ // 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}; +use boxed::Box; use clone::Clone; use convert::{Into, From}; use cmp::{PartialEq, Eq, PartialOrd, Ord, Ordering}; @@ -208,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); @@ -223,11 +224,12 @@ 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 // 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 c355be9bc78d2..1d0152e275117 100644 --- a/src/libstd/io/buffered.rs +++ b/src/libstd/io/buffered.rs @@ -454,6 +454,8 @@ impl<W: Read + Write> Read for InternalBufWriter<W> { #[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<S: Write> { inner: BufReader<InternalBufWriter<S>> } @@ -461,6 +463,9 @@ pub struct BufStream<S: Write> { #[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")] +#[allow(deprecated)] impl<S: Read + Write> BufStream<S> { /// Creates a new buffered stream with explicitly listed capacities for the /// reader/writer buffer. @@ -512,6 +517,7 @@ impl<S: Read + Write> BufStream<S> { #[unstable(feature = "buf_stream", reason = "unsure about semantics of buffering two directions, \ leading to issues like #17136")] +#[allow(deprecated)] impl<S: Read + Write> BufRead for BufStream<S> { fn fill_buf(&mut self) -> io::Result<&[u8]> { self.inner.fill_buf() } fn consume(&mut self, amt: usize) { self.inner.consume(amt) } @@ -520,6 +526,7 @@ impl<S: Read + Write> BufRead for BufStream<S> { #[unstable(feature = "buf_stream", reason = "unsure about semantics of buffering two directions, \ leading to issues like #17136")] +#[allow(deprecated)] impl<S: Read + Write> Read for BufStream<S> { fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> { self.inner.read(buf) @@ -529,6 +536,7 @@ impl<S: Read + Write> Read for BufStream<S> { #[unstable(feature = "buf_stream", reason = "unsure about semantics of buffering two directions, \ leading to issues like #17136")] +#[allow(deprecated)] impl<S: Read + Write> Write for BufStream<S> { fn write(&mut self, buf: &[u8]) -> io::Result<usize> { self.inner.inner.get_mut().write(buf) @@ -541,6 +549,7 @@ impl<S: Read + Write> Write for BufStream<S> { #[unstable(feature = "buf_stream", reason = "unsure about semantics of buffering two directions, \ leading to issues like #17136")] +#[allow(deprecated)] impl<S: Write> fmt::Debug for BufStream<S> where S: fmt::Debug { fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { let reader = &self.inner; 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/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<T: Send + Sync + 'static> Lazy<T> { }); 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 8305088057c41..e5242c5bf861a 100644 --- a/src/libstd/lib.rs +++ b/src/libstd/lib.rs @@ -99,38 +99,62 @@ #![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_raw)] #![feature(box_syntax)] +#![feature(char_internals)] +#![feature(clone_from_slice)] #![feature(collections)] -#![feature(core)] +#![feature(collections_bound)] #![feature(const_fn)] +#![feature(core)] +#![feature(core_float)] +#![feature(core_intrinsics)] +#![feature(core_prelude)] +#![feature(core_simd)] +#![feature(fnbox)] +#![feature(heap_api)] +#![feature(int_error_internals)] #![feature(into_cow)] +#![feature(iter_order)] #![feature(lang_items)] #![feature(libc)] #![feature(linkage, thread_local, asm)] #![feature(macro_reexport)] +#![feature(slice_concat_ext)] +#![feature(slice_position_elem)] +#![feature(no_std)] +#![feature(oom)] #![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(vec_push_all)] +#![feature(wrapping)] #![feature(zero_one)] -#![cfg_attr(test, feature(float_from_str_radix))] -#![cfg_attr(test, feature(test, rustc_private, std_misc))] +#![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))] // Don't link to std. We are std. -#![feature(no_std)] #![no_std] #![allow(trivial_casts)] 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/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<Thunk<'static>>; +type Queue = Vec<Box<FnBox()>>; // 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<Queue> = 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<FnBox()>) -> bool { let mut ret = true; unsafe { LOCK.lock(); diff --git a/src/libstd/rt/mod.rs b/src/libstd/rt/mod.rs index 0d26206f26bcf..1729d20da205c 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::*; @@ -137,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<Any + Send + 'static>) -> ! { }, 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/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..28dc124f0334f 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 @@ -28,10 +28,15 @@ //! ``` #![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")] +#![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 2c0da938cbf8b..d6d173e5e7e7e 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 @@ -44,7 +42,6 @@ pub use self::PopResult::*; use core::prelude::*; -use alloc::boxed; use alloc::boxed::Box; use core::ptr; use core::cell::UnsafeCell; @@ -82,7 +79,7 @@ unsafe impl<T: Send> Sync for Queue<T> { } impl<T> Node<T> { unsafe fn new(v: Option<T>) -> *mut Node<T> { - 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/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..3cf75de5a46dd 100644 --- a/src/libstd/sync/mpsc/spsc_queue.rs +++ b/src/libstd/sync/mpsc/spsc_queue.rs @@ -33,11 +33,8 @@ //! 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; use alloc::boxed::Box; use core::ptr; use core::cell::UnsafeCell; @@ -80,7 +77,7 @@ unsafe impl<T: Send> Sync for Queue<T> { } impl<T> Node<T> { fn new() -> *mut Node<T> { - boxed::into_raw(box Node { + Box::into_raw(box Node { value: None, next: AtomicPtr::new(ptr::null_mut::<Node<T>>()), }) diff --git a/src/libstd/sync/mutex.rs b/src/libstd/sync/mutex.rs index fd22d723ebdb1..41cd11e4c6900 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<T: ?Sized + Send> Sync for Mutex<T> { } /// # Examples /// /// ``` -/// # #![feature(std_misc)] +/// # #![feature(static_mutex)] /// use std::sync::{StaticMutex, MUTEX_INIT}; /// /// static LOCK: StaticMutex = MUTEX_INIT; @@ -150,7 +149,7 @@ unsafe impl<T: ?Sized + Send> Sync for Mutex<T> { } /// } /// // 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<T: ?Sized> Mutex<T> { /// time. You should not trust a `false` value for program correctness /// without additional synchronization. #[inline] - #[unstable(feature = "std_misc")] + #[stable(feature = "sync_poison", since = "1.2.0")] 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<MutexGuard<()>> { 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<MutexGuard<()>> { 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..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 = "std_misc")] + #[stable(feature = "once_new", since = "1.2.0")] 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..4ca2e282f707d 100644 --- a/src/libstd/sync/rwlock.rs +++ b/src/libstd/sync/rwlock.rs @@ -81,7 +81,7 @@ unsafe impl<T: ?Sized + Send + Sync> Sync for RwLock<T> {} /// # 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<T: ?Sized + Send + Sync> Sync for RwLock<T> {} /// } /// 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<T: ?Sized> RwLock<T> { /// time. You should not trust a `false` value for program correctness /// without additional synchronization. #[inline] - #[unstable(feature = "std_misc")] + #[stable(feature = "sync_poison", since = "1.2.0")] 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<RwLockReadGuard<'static, ()>> { 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<RwLockReadGuard<'static, ()>> { 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<RwLockWriteGuard<'static, ()>> { 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<RwLockWriteGuard<'static, ()>> { 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..dc9e467a8b135 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")] @@ -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/libstd/sys/common/poison.rs b/src/libstd/sys/common/poison.rs index 48c8198272588..065b1d6c9acfc 100644 --- a/src/libstd/sys/common/poison.rs +++ b/src/libstd/sys/common/poison.rs @@ -120,24 +120,24 @@ impl<T: Send + Reflect> Error for PoisonError<T> { impl<T> PoisonError<T> { /// Creates a `PoisonError`. - #[unstable(feature = "std_misc")] + #[stable(feature = "sync_poison", since = "1.2.0")] pub fn new(guard: T) -> PoisonError<T> { PoisonError { guard: guard } } /// Consumes this error indicating that a lock is poisoned, returning the /// underlying guard to allow access regardless. - #[unstable(feature = "std_misc")] + #[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 = "std_misc")] + #[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 = "std_misc")] + #[stable(feature = "sync_poison", since = "1.2.0")] pub fn get_mut(&mut self) -> &mut T { &mut self.guard } } diff --git a/src/libstd/sys/common/wtf8.rs b/src/libstd/sys/common/wtf8.rs index b2dc01e3ccb19..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; @@ -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 { @@ -1173,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/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 69a26cdc490f6..60563340d1021 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<T: 'static> LocalKey<T> { /// 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 { @@ -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<List> = 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)); @@ -406,7 +405,6 @@ mod imp { mod imp { use prelude::v1::*; - use alloc::boxed; use cell::{Cell, UnsafeCell}; use marker; use ptr; @@ -448,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/libstd/thread/mod.rs b/src/libstd/thread/mod.rs index 153b04360877b..dbb7d3233bc39 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<JoinGuard<'a, T>> where T: Send + 'a, F: FnOnce() -> T, F: Send + 'a { @@ -398,6 +401,10 @@ pub fn spawn<F, T>(f: F) -> JoinHandle<T> 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")] +#[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/libstd/thunk.rs b/src/libstd/thunk.rs index 6091794ed4286..f1dc91f135fe5 100644 --- a/src/libstd/thunk.rs +++ b/src/libstd/thunk.rs @@ -10,7 +10,8 @@ // Because this module is temporary... #![allow(missing_docs)] -#![unstable(feature = "std_misc")] +#![unstable(feature = "thunk")] +#![deprecated(since = "1.2.0", reason = "use FnBox instead")] use alloc::boxed::{Box, FnBox}; use core::marker::Send; diff --git a/src/libsyntax/lib.rs b/src/libsyntax/lib.rs index 11c4b0f12610a..7333265bdd412 100644 --- a/src/libsyntax/lib.rs +++ b/src/libsyntax/lib.rs @@ -26,14 +26,17 @@ html_root_url = "http://doc.rust-lang.org/nightly/")] #![feature(associated_consts)] -#![feature(collections)] -#![feature(collections_drain)] -#![feature(core)] +#![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..5131e0b34e380 100644 --- a/src/libterm/lib.rs +++ b/src/libterm/lib.rs @@ -56,12 +56,12 @@ #![deny(missing_docs)] #![feature(box_syntax)] -#![feature(collections)] +#![feature(owned_ascii_ext)] +#![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 9850e0a6c2fc9..f800b4863c669 100644 --- a/src/libtest/lib.rs +++ b/src/libtest/lib.rs @@ -36,15 +36,16 @@ #![feature(asm)] #![feature(box_syntax)] -#![feature(collections)] -#![feature(core)] -#![feature(rustc_private)] -#![feature(staged_api)] -#![feature(std_misc)] -#![feature(libc)] -#![feature(set_stdio)] #![feature(duration)] #![feature(duration_span)] +#![feature(fnbox)] +#![feature(iter_cmp)] +#![feature(libc)] +#![feature(rt)] +#![feature(rustc_private)] +#![feature(set_stdio)] +#![feature(slice_extras)] +#![feature(staged_api)] extern crate getopts; extern crate serialize; @@ -80,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 @@ -153,7 +153,7 @@ pub enum TestFn { StaticTestFn(fn()), StaticBenchFn(fn(&mut Bencher)), StaticMetricFn(fn(&mut MetricMap)), - DynTestFn(Thunk<'static>), + DynTestFn(Box<FnBox() + Send>), DynMetricFn(Box<FnBox(&mut MetricMap)+Send>), DynBenchFn(Box<TDynBenchFn+'static>) } @@ -959,7 +959,7 @@ pub fn run_test(opts: &TestOpts, fn run_test_inner(desc: TestDesc, monitor_ch: Sender<MonitorMsg>, nocapture: bool, - testfn: Thunk<'static>) { + testfn: Box<FnBox() + Send>) { struct Sink(Arc<Mutex<Vec<u8>>>); impl Write for Sink { fn write(&mut self, data: &[u8]) -> io::Result<usize> { @@ -1227,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 09fcd518c1e7e..acb1c5cbd90ba 100644 --- a/src/rustbook/main.rs +++ b/src/rustbook/main.rs @@ -10,17 +10,18 @@ #![deny(warnings)] -#![feature(core)] -#![feature(exit_status)] -#![feature(rustdoc)] -#![feature(rustc_private)] +#![feature(iter_arith)] #![feature(path_relative_from)] +#![feature(rustc_private)] +#![feature(rustdoc)] extern crate rustdoc; 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<Write + 'static> @@ -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/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<I> 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..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(std_misc)] - -// 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; }); 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/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<T>() -> usize { @@ -32,7 +30,7 @@ pub trait TypeInfo { impl<T> TypeInfo for T { /// The size of the type in bytes. fn size_of(_lame_type_hint: Option<T>) -> usize { - unsafe { intrinsics::size_of::<T>() } + mem::size_of::<T>() } /// 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::<std::simd::i32x4>; 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..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,12 +10,13 @@ // 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}; 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}. 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;