diff --git a/src/compiletest/compiletest.rs b/src/compiletest/compiletest.rs index 0e928345d931f..3b9eec12ba3e9 100644 --- a/src/compiletest/compiletest.rs +++ b/src/compiletest/compiletest.rs @@ -13,9 +13,7 @@ #![feature(box_syntax)] #![feature(dynamic_lib)] #![feature(libc)] -#![feature(path_ext)] #![feature(rustc_private)] -#![feature(slice_splits)] #![feature(str_char)] #![feature(test)] #![feature(vec_push_all)] diff --git a/src/compiletest/procsrv.rs b/src/compiletest/procsrv.rs index 66fa0dfecd422..7c5397a1af989 100644 --- a/src/compiletest/procsrv.rs +++ b/src/compiletest/procsrv.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +#![allow(deprecated)] + use std::dynamic_lib::DynamicLibrary; use std::io::prelude::*; use std::path::PathBuf; diff --git a/src/libcollections/binary_heap.rs b/src/libcollections/binary_heap.rs index b7afe9685778e..30fc22e400a81 100644 --- a/src/libcollections/binary_heap.rs +++ b/src/libcollections/binary_heap.rs @@ -240,14 +240,9 @@ impl BinaryHeap { #[unstable(feature = "binary_heap_extras", reason = "needs to be audited", issue = "28147")] + #[deprecated(since = "1.5.0", reason = "use BinaryHeap::from instead")] pub fn from_vec(vec: Vec) -> BinaryHeap { - let mut heap = BinaryHeap { data: vec }; - let mut n = heap.len() / 2; - while n > 0 { - n -= 1; - heap.sift_down(n); - } - heap + BinaryHeap::from(vec) } /// Returns an iterator visiting all values in the underlying vector, in @@ -256,10 +251,8 @@ impl BinaryHeap { /// # Examples /// /// ``` - /// #![feature(binary_heap_extras)] - /// /// use std::collections::BinaryHeap; - /// let heap = BinaryHeap::from_vec(vec![1, 2, 3, 4]); + /// let heap = BinaryHeap::from(vec![1, 2, 3, 4]); /// /// // Print 1, 2, 3, 4 in arbitrary order /// for x in heap.iter() { @@ -362,10 +355,8 @@ impl BinaryHeap { /// # Examples /// /// ``` - /// #![feature(binary_heap_extras)] - /// /// use std::collections::BinaryHeap; - /// let mut heap = BinaryHeap::from_vec(vec![1, 3]); + /// let mut heap = BinaryHeap::from(vec![1, 3]); /// /// assert_eq!(heap.pop(), Some(3)); /// assert_eq!(heap.pop(), Some(1)); @@ -475,10 +466,8 @@ impl BinaryHeap { /// # Examples /// /// ``` - /// #![feature(binary_heap_extras)] - /// /// use std::collections::BinaryHeap; - /// let heap = BinaryHeap::from_vec(vec![1, 2, 3, 4, 5, 6, 7]); + /// let heap = BinaryHeap::from(vec![1, 2, 3, 4, 5, 6, 7]); /// let vec = heap.into_vec(); /// /// // Will print in some order @@ -486,10 +475,10 @@ impl BinaryHeap { /// println!("{}", x); /// } /// ``` - #[unstable(feature = "binary_heap_extras", - reason = "needs to be audited", - issue = "28147")] - pub fn into_vec(self) -> Vec { self.data } + #[stable(feature = "binary_heap_extras_15", since = "1.5.0")] + pub fn into_vec(self) -> Vec { + self.into() + } /// Consumes the `BinaryHeap` and returns a vector in sorted /// (ascending) order. @@ -497,20 +486,16 @@ impl BinaryHeap { /// # Examples /// /// ``` - /// #![feature(binary_heap_extras)] - /// /// use std::collections::BinaryHeap; /// - /// let mut heap = BinaryHeap::from_vec(vec![1, 2, 4, 5, 7]); + /// let mut heap = BinaryHeap::from(vec![1, 2, 4, 5, 7]); /// heap.push(6); /// heap.push(3); /// /// let vec = heap.into_sorted_vec(); /// assert_eq!(vec, [1, 2, 3, 4, 5, 6, 7]); /// ``` - #[unstable(feature = "binary_heap_extras", - reason = "needs to be audited", - issue = "28147")] + #[stable(feature = "binary_heap_extras_15", since = "1.5.0")] pub fn into_sorted_vec(mut self) -> Vec { let mut end = self.len(); while end > 1 { @@ -744,10 +729,28 @@ impl<'a, T: 'a> DoubleEndedIterator for Drain<'a, T> { #[stable(feature = "rust1", since = "1.0.0")] impl<'a, T: 'a> ExactSizeIterator for Drain<'a, T> {} +impl From> for BinaryHeap { + fn from(vec: Vec) -> BinaryHeap { + let mut heap = BinaryHeap { data: vec }; + let mut n = heap.len() / 2; + while n > 0 { + n -= 1; + heap.sift_down(n); + } + heap + } +} + +impl From> for Vec { + fn from(heap: BinaryHeap) -> Vec { + heap.data + } +} + #[stable(feature = "rust1", since = "1.0.0")] impl FromIterator for BinaryHeap { fn from_iter>(iter: I) -> BinaryHeap { - BinaryHeap::from_vec(iter.into_iter().collect()) + BinaryHeap::from(iter.into_iter().collect::>()) } } @@ -763,10 +766,8 @@ impl IntoIterator for BinaryHeap { /// # Examples /// /// ``` - /// #![feature(binary_heap_extras)] - /// /// use std::collections::BinaryHeap; - /// let heap = BinaryHeap::from_vec(vec![1, 2, 3, 4]); + /// let heap = BinaryHeap::from(vec![1, 2, 3, 4]); /// /// // Print 1, 2, 3, 4 in arbitrary order /// for x in heap.into_iter() { diff --git a/src/libcollections/lib.rs b/src/libcollections/lib.rs index 4292c200fbe2f..3bb8a11c6a57d 100644 --- a/src/libcollections/lib.rs +++ b/src/libcollections/lib.rs @@ -46,7 +46,6 @@ #![feature(fmt_internals)] #![feature(fmt_radix)] #![feature(heap_api)] -#![feature(iter_order)] #![feature(iter_arith)] #![feature(iter_arith)] #![feature(lang_items)] @@ -60,14 +59,12 @@ #![feature(staged_api)] #![feature(step_by)] #![feature(str_char)] -#![feature(str_match_indices)] #![feature(unboxed_closures)] #![feature(unicode)] #![feature(unique)] #![feature(dropck_parametricity)] #![feature(unsafe_no_drop_flag, filling_drop)] #![feature(decode_utf16)] -#![feature(utf8_error)] #![cfg_attr(test, feature(clone_from_slice, rand, test))] #![feature(no_std)] diff --git a/src/libcollections/slice.rs b/src/libcollections/slice.rs index dabfd168c89ac..ea4830fc3e6ce 100644 --- a/src/libcollections/slice.rs +++ b/src/libcollections/slice.rs @@ -106,6 +106,7 @@ pub use core::slice::{Chunks, Windows}; pub use core::slice::{Iter, IterMut}; pub use core::slice::{SplitMut, ChunksMut, Split}; pub use core::slice::{SplitN, RSplitN, SplitNMut, RSplitNMut}; +#[allow(deprecated)] pub use core::slice::{bytes, mut_ref_slice, ref_slice}; pub use core::slice::{from_raw_parts, from_raw_parts_mut}; @@ -214,21 +215,21 @@ impl [T] { } /// Returns the first and all the rest of the elements of a slice. - #[unstable(feature = "slice_splits", reason = "new API", issue = "27742")] + #[stable(feature = "slice_splits", since = "1.5.0")] #[inline] pub fn split_first(&self) -> Option<(&T, &[T])> { core_slice::SliceExt::split_first(self) } /// Returns the first and all the rest of the elements of a slice. - #[unstable(feature = "slice_splits", reason = "new API", issue = "27742")] + #[stable(feature = "slice_splits", since = "1.5.0")] #[inline] pub fn split_first_mut(&mut self) -> Option<(&mut T, &mut [T])> { core_slice::SliceExt::split_first_mut(self) } /// Returns the last and all the rest of the elements of a slice. - #[unstable(feature = "slice_splits", reason = "new API", issue = "27742")] + #[stable(feature = "slice_splits", since = "1.5.0")] #[inline] pub fn split_last(&self) -> Option<(&T, &[T])> { core_slice::SliceExt::split_last(self) @@ -236,7 +237,7 @@ impl [T] { } /// Returns the last and all the rest of the elements of a slice. - #[unstable(feature = "slice_splits", reason = "new API", issue = "27742")] + #[stable(feature = "slice_splits", since = "1.5.0")] #[inline] pub fn split_last_mut(&mut self) -> Option<(&mut T, &mut [T])> { core_slice::SliceExt::split_last_mut(self) diff --git a/src/libcollections/str.rs b/src/libcollections/str.rs index 81bf3bab36fb8..21406354d81c3 100644 --- a/src/libcollections/str.rs +++ b/src/libcollections/str.rs @@ -277,8 +277,7 @@ impl str { /// Takes a bytewise mutable slice from a string. /// /// Same as `slice_unchecked`, but works with `&mut str` instead of `&str`. - #[unstable(feature = "str_slice_mut", reason = "recently added", - issue = "27793")] + #[stable(feature = "str_slice_mut", since = "1.5.0")] #[inline] pub unsafe fn slice_mut_unchecked(&mut self, begin: usize, end: usize) -> &mut str { core_str::StrExt::slice_mut_unchecked(self, begin, end) @@ -1192,9 +1191,7 @@ impl str { /// let v: Vec<_> = "ababa".match_indices("aba").collect(); /// assert_eq!(v, [(0, "aba")]); // only the first `aba` /// ``` - #[unstable(feature = "str_match_indices", - reason = "might have its iterator type changed", - issue = "27743")] + #[stable(feature = "str_match_indices", since = "1.5.0")] pub fn match_indices<'a, P: Pattern<'a>>(&'a self, pat: P) -> MatchIndices<'a, P> { core_str::StrExt::match_indices(self, pat) } @@ -1231,9 +1228,7 @@ impl str { /// let v: Vec<_> = "ababa".rmatch_indices("aba").collect(); /// assert_eq!(v, [(2, "aba")]); // only the last `aba` /// ``` - #[unstable(feature = "str_match_indices", - reason = "might have its iterator type changed", - issue = "27743")] + #[stable(feature = "str_match_indices", since = "1.5.0")] pub fn rmatch_indices<'a, P: Pattern<'a>>(&'a self, pat: P) -> RMatchIndices<'a, P> where P::Searcher: ReverseSearcher<'a> { diff --git a/src/libcollections/string.rs b/src/libcollections/string.rs index 8217e694e2d53..96a28d3ee3ba3 100644 --- a/src/libcollections/string.rs +++ b/src/libcollections/string.rs @@ -1131,9 +1131,7 @@ impl ops::DerefMut for String { } /// Error returned from `String::from` -#[unstable(feature = "str_parse_error", reason = "may want to be replaced with \ - Void if it ever exists", - issue = "27734")] +#[stable(feature = "str_parse_error", since = "1.5.0")] #[derive(Copy)] pub enum ParseError {} diff --git a/src/libcollections/vec.rs b/src/libcollections/vec.rs index 69530493aa110..897fea5309cb3 100644 --- a/src/libcollections/vec.rs +++ b/src/libcollections/vec.rs @@ -865,8 +865,6 @@ impl Vec { /// # Examples /// /// ``` - /// #![feature(vec_resize)] - /// /// let mut vec = vec!["hello"]; /// vec.resize(3, "world"); /// assert_eq!(vec, ["hello", "world", "world"]); @@ -875,9 +873,7 @@ impl Vec { /// vec.resize(2, 0); /// assert_eq!(vec, [1, 2]); /// ``` - #[unstable(feature = "vec_resize", - reason = "matches collection reform specification; waiting for dust to settle", - issue = "27790")] + #[stable(feature = "vec_resize", since = "1.5.0")] pub fn resize(&mut self, new_len: usize, value: T) { let len = self.len(); diff --git a/src/libcollections/vec_deque.rs b/src/libcollections/vec_deque.rs index 4cba1083fd99d..937ace00fdcca 100644 --- a/src/libcollections/vec_deque.rs +++ b/src/libcollections/vec_deque.rs @@ -38,12 +38,13 @@ const INITIAL_CAPACITY: usize = 7; // 2^3 - 1 const MINIMUM_CAPACITY: usize = 1; // 2 - 1 const MAXIMUM_ZST_CAPACITY: usize = 1 << (usize::BITS - 1); // Largest possible power of two -/// `VecDeque` is a growable ring buffer, which can be used as a -/// double-ended queue efficiently. +/// `VecDeque` is a growable ring buffer, which can be used as a double-ended +/// queue efficiently. /// -/// The "default" usage of this type as a queue is to use `push_back` to add to the queue, and -/// `pop_front` to remove from the queue. `extend` and `append` push onto the back in this manner, -/// and iterating over `VecDeque` goes front to back. +/// The "default" usage of this type as a queue is to use `push_back` to add to +/// the queue, and `pop_front` to remove from the queue. `extend` and `append` +/// push onto the back in this manner, and iterating over `VecDeque` goes front +/// to back. #[stable(feature = "rust1", since = "1.0.0")] pub struct VecDeque { // tail and head are pointers into the buffer. Tail always points @@ -499,8 +500,6 @@ impl VecDeque { /// # Examples /// /// ``` - /// #![feature(deque_extras)] - /// /// use std::collections::VecDeque; /// /// let mut buf = VecDeque::with_capacity(15); @@ -509,9 +508,7 @@ impl VecDeque { /// buf.shrink_to_fit(); /// assert!(buf.capacity() >= 4); /// ``` - #[unstable(feature = "deque_extras", - reason = "needs to be audited", - issue = "27788")] + #[stable(feature = "deque_extras_15", since = "1.5.0")] pub fn shrink_to_fit(&mut self) { // +1 since the ringbuffer always leaves one space empty // len + 1 can't overflow for an existing, well-formed ringbuffer. @@ -653,9 +650,7 @@ impl VecDeque { /// Returns a pair of slices which contain, in order, the contents of the /// `VecDeque`. #[inline] - #[unstable(feature = "deque_extras", - reason = "matches collection reform specification, waiting for dust to settle", - issue = "27788")] + #[stable(feature = "deque_extras_15", since = "1.5.0")] pub fn as_slices(&self) -> (&[T], &[T]) { unsafe { let contiguous = self.is_contiguous(); @@ -674,9 +669,7 @@ impl VecDeque { /// Returns a pair of slices which contain, in order, the contents of the /// `VecDeque`. #[inline] - #[unstable(feature = "deque_extras", - reason = "matches collection reform specification, waiting for dust to settle", - issue = "27788")] + #[stable(feature = "deque_extras_15", since = "1.5.0")] pub fn as_mut_slices(&mut self) -> (&mut [T], &mut [T]) { unsafe { let contiguous = self.is_contiguous(); @@ -1035,25 +1028,21 @@ impl VecDeque { /// # Examples /// /// ``` - /// #![feature(deque_extras)] - /// /// use std::collections::VecDeque; /// /// let mut buf = VecDeque::new(); - /// assert_eq!(buf.swap_back_remove(0), None); + /// assert_eq!(buf.swap_remove_back(0), None); /// buf.push_back(1); /// buf.push_back(2); /// buf.push_back(3); /// - /// assert_eq!(buf.swap_back_remove(0), Some(1)); + /// assert_eq!(buf.swap_remove_back(0), Some(1)); /// assert_eq!(buf.len(), 2); /// assert_eq!(buf[0], 3); /// assert_eq!(buf[1], 2); /// ``` - #[unstable(feature = "deque_extras", - reason = "the naming of this function may be altered", - issue = "27788")] - pub fn swap_back_remove(&mut self, index: usize) -> Option { + #[stable(feature = "deque_extras_15", since = "1.5.0")] + pub fn swap_remove_back(&mut self, index: usize) -> Option { let length = self.len(); if length > 0 && index < length - 1 { self.swap(index, length - 1); @@ -1063,6 +1052,15 @@ impl VecDeque { self.pop_back() } + /// deprecated + #[unstable(feature = "deque_extras", + reason = "the naming of this function may be altered", + issue = "27788")] + #[deprecated(since = "1.5.0", reason = "renamed to swap_remove_back")] + pub fn swap_back_remove(&mut self, index: usize) -> Option { + self.swap_remove_back(index) + } + /// Removes an element from anywhere in the `VecDeque` and returns it, /// replacing it with the first element. /// @@ -1073,25 +1071,21 @@ impl VecDeque { /// # Examples /// /// ``` - /// #![feature(deque_extras)] - /// /// use std::collections::VecDeque; /// /// let mut buf = VecDeque::new(); - /// assert_eq!(buf.swap_front_remove(0), None); + /// assert_eq!(buf.swap_remove_front(0), None); /// buf.push_back(1); /// buf.push_back(2); /// buf.push_back(3); /// - /// assert_eq!(buf.swap_front_remove(2), Some(3)); + /// assert_eq!(buf.swap_remove_front(2), Some(3)); /// assert_eq!(buf.len(), 2); /// assert_eq!(buf[0], 2); /// assert_eq!(buf[1], 1); /// ``` - #[unstable(feature = "deque_extras", - reason = "the naming of this function may be altered", - issue = "27788")] - pub fn swap_front_remove(&mut self, index: usize) -> Option { + #[stable(feature = "deque_extras_15", since = "1.5.0")] + pub fn swap_remove_front(&mut self, index: usize) -> Option { let length = self.len(); if length > 0 && index < length && index != 0 { self.swap(index, 0); @@ -1101,6 +1095,15 @@ impl VecDeque { self.pop_front() } + /// deprecated + #[unstable(feature = "deque_extras", + reason = "the naming of this function may be altered", + issue = "27788")] + #[deprecated(since = "1.5.0", reason = "renamed to swap_remove_front")] + pub fn swap_front_remove(&mut self, index: usize) -> Option { + self.swap_remove_front(index) + } + /// Inserts an element at `index` within the `VecDeque`. Whichever /// end is closer to the insertion point will be moved to make room, /// and all the affected elements will be moved to new positions. @@ -1111,8 +1114,6 @@ impl VecDeque { /// /// # Examples /// ``` - /// #![feature(deque_extras)] - /// /// use std::collections::VecDeque; /// /// let mut buf = VecDeque::new(); @@ -1121,9 +1122,7 @@ impl VecDeque { /// buf.insert(1, 11); /// assert_eq!(Some(&11), buf.get(1)); /// ``` - #[unstable(feature = "deque_extras", - reason = "needs to be audited", - issue = "27788")] + #[stable(feature = "deque_extras_15", since = "1.5.0")] pub fn insert(&mut self, index: usize, value: T) { assert!(index <= self.len(), "index out of bounds"); if self.is_full() { diff --git a/src/libcore/char.rs b/src/libcore/char.rs index ccce2ad22ddc2..21146f98360f7 100644 --- a/src/libcore/char.rs +++ b/src/libcore/char.rs @@ -91,8 +91,7 @@ pub fn from_u32(i: u32) -> Option { /// Converts a `u32` to an `char`, not checking whether it is a valid unicode /// codepoint. #[inline] -#[unstable(feature = "char_from_unchecked", reason = "recently added API", - issue = "27781")] +#[stable(feature = "char_from_unchecked", since = "1.5.0")] pub unsafe fn from_u32_unchecked(i: u32) -> char { transmute(i) } diff --git a/src/libcore/fmt/mod.rs b/src/libcore/fmt/mod.rs index eea21988aa360..f850cdbbd6090 100644 --- a/src/libcore/fmt/mod.rs +++ b/src/libcore/fmt/mod.rs @@ -1098,43 +1098,36 @@ impl<'a> Formatter<'a> { pub fn flags(&self) -> u32 { self.flags } /// Character used as 'fill' whenever there is alignment - #[unstable(feature = "fmt_flags", reason = "method was just created", - issue = "27726")] + #[stable(feature = "fmt_flags", since = "1.5.0")] pub fn fill(&self) -> char { self.fill } /// Flag indicating what form of alignment was requested - #[unstable(feature = "fmt_flags", reason = "method was just created", + #[unstable(feature = "fmt_flags_align", reason = "method was just created", issue = "27726")] pub fn align(&self) -> Alignment { self.align } /// Optionally specified integer width that the output should be - #[unstable(feature = "fmt_flags", reason = "method was just created", - issue = "27726")] + #[stable(feature = "fmt_flags", since = "1.5.0")] pub fn width(&self) -> Option { self.width } /// Optionally specified precision for numeric types - #[unstable(feature = "fmt_flags", reason = "method was just created", - issue = "27726")] + #[stable(feature = "fmt_flags", since = "1.5.0")] pub fn precision(&self) -> Option { self.precision } /// Determines if the `+` flag was specified. - #[unstable(feature = "fmt_flags", reason = "method was just created", - issue = "27726")] + #[stable(feature = "fmt_flags", since = "1.5.0")] pub fn sign_plus(&self) -> bool { self.flags & (1 << FlagV1::SignPlus as u32) != 0 } /// Determines if the `-` flag was specified. - #[unstable(feature = "fmt_flags", reason = "method was just created", - issue = "27726")] + #[stable(feature = "fmt_flags", since = "1.5.0")] pub fn sign_minus(&self) -> bool { self.flags & (1 << FlagV1::SignMinus as u32) != 0 } /// Determines if the `#` flag was specified. - #[unstable(feature = "fmt_flags", reason = "method was just created", - issue = "27726")] + #[stable(feature = "fmt_flags", since = "1.5.0")] pub fn alternate(&self) -> bool { self.flags & (1 << FlagV1::Alternate as u32) != 0 } /// Determines if the `0` flag was specified. - #[unstable(feature = "fmt_flags", reason = "method was just created", - issue = "27726")] + #[stable(feature = "fmt_flags", since = "1.5.0")] pub fn sign_aware_zero_pad(&self) -> bool { self.flags & (1 << FlagV1::SignAwareZeroPad as u32) != 0 } diff --git a/src/libcore/iter.rs b/src/libcore/iter.rs index 7c113fde658b8..8750970553423 100644 --- a/src/libcore/iter.rs +++ b/src/libcore/iter.rs @@ -1257,7 +1257,7 @@ pub trait Iterator { /// Lexicographically compares the elements of this `Iterator` with those /// of another. - #[unstable(feature = "iter_order", reason = "needs review and revision", issue = "27737")] + #[stable(feature = "iter_order", since = "1.5.0")] fn cmp(mut self, other: I) -> Ordering where I: IntoIterator, Self::Item: Ord, @@ -1280,7 +1280,7 @@ pub trait Iterator { /// Lexicographically compares the elements of this `Iterator` with those /// of another. - #[unstable(feature = "iter_order", reason = "needs review and revision", issue = "27737")] + #[stable(feature = "iter_order", since = "1.5.0")] fn partial_cmp(mut self, other: I) -> Option where I: IntoIterator, Self::Item: PartialOrd, @@ -1303,7 +1303,7 @@ pub trait Iterator { /// Determines if the elements of this `Iterator` are equal to those of /// another. - #[unstable(feature = "iter_order", reason = "needs review and revision", issue = "27737")] + #[stable(feature = "iter_order", since = "1.5.0")] fn eq(mut self, other: I) -> bool where I: IntoIterator, Self::Item: PartialEq, @@ -1322,7 +1322,7 @@ pub trait Iterator { /// Determines if the elements of this `Iterator` are unequal to those of /// another. - #[unstable(feature = "iter_order", reason = "needs review and revision", issue = "27737")] + #[stable(feature = "iter_order", since = "1.5.0")] fn ne(mut self, other: I) -> bool where I: IntoIterator, Self::Item: PartialEq, @@ -1341,7 +1341,7 @@ pub trait Iterator { /// Determines if the elements of this `Iterator` are lexicographically /// less than those of another. - #[unstable(feature = "iter_order", reason = "needs review and revision", issue = "27737")] + #[stable(feature = "iter_order", since = "1.5.0")] fn lt(mut self, other: I) -> bool where I: IntoIterator, Self::Item: PartialOrd, @@ -1368,7 +1368,7 @@ pub trait Iterator { /// Determines if the elements of this `Iterator` are lexicographically /// less or equal to those of another. - #[unstable(feature = "iter_order", reason = "needs review and revision", issue = "27737")] + #[stable(feature = "iter_order", since = "1.5.0")] fn le(mut self, other: I) -> bool where I: IntoIterator, Self::Item: PartialOrd, @@ -1395,7 +1395,7 @@ pub trait Iterator { /// Determines if the elements of this `Iterator` are lexicographically /// greater than those of another. - #[unstable(feature = "iter_order", reason = "needs review and revision", issue = "27737")] + #[stable(feature = "iter_order", since = "1.5.0")] fn gt(mut self, other: I) -> bool where I: IntoIterator, Self::Item: PartialOrd, @@ -1422,7 +1422,7 @@ pub trait Iterator { /// Determines if the elements of this `Iterator` are lexicographically /// greater than or equal to those of another. - #[unstable(feature = "iter_order", reason = "needs review and revision", issue = "27737")] + #[stable(feature = "iter_order", since = "1.5.0")] fn ge(mut self, other: I) -> bool where I: IntoIterator, Self::Item: PartialOrd, @@ -3224,6 +3224,8 @@ impl Iterator for StepBy> where #[unstable(feature = "range_inclusive", reason = "likely to be replaced by range notation and adapters", issue = "27777")] +#[deprecated(since = "1.5.0", reason = "replaced with ... syntax")] +#[allow(deprecated)] pub struct RangeInclusive { range: ops::Range, done: bool, @@ -3234,6 +3236,8 @@ pub struct RangeInclusive { #[unstable(feature = "range_inclusive", reason = "likely to be replaced by range notation and adapters", issue = "27777")] +#[deprecated(since = "1.5.0", reason = "replaced with ... syntax")] +#[allow(deprecated)] pub fn range_inclusive(start: A, stop: A) -> RangeInclusive where A: Step + One + Clone { @@ -3246,6 +3250,8 @@ pub fn range_inclusive(start: A, stop: A) -> RangeInclusive #[unstable(feature = "range_inclusive", reason = "likely to be replaced by range notation and adapters", issue = "27777")] +#[deprecated(since = "1.5.0", reason = "replaced with ... syntax")] +#[allow(deprecated)] impl Iterator for RangeInclusive where A: PartialEq + Step + One + Clone, for<'a> &'a A: Add<&'a A, Output = A> @@ -3280,6 +3286,8 @@ impl Iterator for RangeInclusive where #[unstable(feature = "range_inclusive", reason = "likely to be replaced by range notation and adapters", issue = "27777")] +#[deprecated(since = "1.5.0", reason = "replaced with ... syntax")] +#[allow(deprecated)] impl DoubleEndedIterator for RangeInclusive where A: PartialEq + Step + One + Clone, for<'a> &'a A: Add<&'a A, Output = A>, @@ -3657,7 +3665,7 @@ pub fn once(value: T) -> Once { /// If two sequences are equal up until the point where one ends, /// the shorter sequence compares less. #[deprecated(since = "1.4.0", reason = "use the equivalent methods on `Iterator` instead")] -#[unstable(feature = "iter_order", reason = "needs review and revision", +#[unstable(feature = "iter_order_deprecated", reason = "needs review and revision", issue = "27737")] pub mod order { use cmp; diff --git a/src/libcore/option.rs b/src/libcore/option.rs index 0e4c6d1676e63..8fce64bd561dc 100644 --- a/src/libcore/option.rs +++ b/src/libcore/option.rs @@ -290,6 +290,7 @@ impl Option { reason = "waiting for mut conventions", issue = "27776")] #[deprecated(since = "1.4.0", reason = "niche API, unclear of usefulness")] + #[allow(deprecated)] pub fn as_mut_slice(&mut self) -> &mut [T] { match *self { Some(ref mut x) => { @@ -694,6 +695,7 @@ impl Option { #[unstable(feature = "as_slice", reason = "unsure of the utility here", issue = "27776")] #[deprecated(since = "1.4.0", reason = "niche API, unclear of usefulness")] + #[allow(deprecated)] pub fn as_slice(&self) -> &[T] { match *self { Some(ref x) => slice::ref_slice(x), diff --git a/src/libcore/result.rs b/src/libcore/result.rs index fe0fdb5baa5f3..e48252fa6f62a 100644 --- a/src/libcore/result.rs +++ b/src/libcore/result.rs @@ -408,6 +408,7 @@ impl Result { #[unstable(feature = "as_slice", reason = "unsure of the utility here", issue = "27776")] #[deprecated(since = "1.4.0", reason = "niche API, unclear of usefulness")] + #[allow(deprecated)] pub fn as_slice(&self) -> &[T] { match *self { Ok(ref x) => slice::ref_slice(x), @@ -441,6 +442,7 @@ impl Result { reason = "waiting for mut conventions", issue = "27776")] #[deprecated(since = "1.4.0", reason = "niche API, unclear of usefulness")] + #[allow(deprecated)] pub fn as_mut_slice(&mut self) -> &mut [T] { match *self { Ok(ref mut x) => slice::mut_ref_slice(x), diff --git a/src/libcore/slice.rs b/src/libcore/slice.rs index f6b262c9494ae..a49d91ca03e5b 100644 --- a/src/libcore/slice.rs +++ b/src/libcore/slice.rs @@ -1417,6 +1417,7 @@ impl<'a, T> ExactSizeIterator for ChunksMut<'a, T> {} /// Converts a reference to A into a slice of length 1 (without copying). #[unstable(feature = "ref_slice", issue = "27774")] +#[deprecated(since = "1.5.0", reason = "unclear whether belongs in libstd")] pub fn ref_slice(s: &A) -> &[A] { unsafe { from_raw_parts(s, 1) @@ -1425,6 +1426,7 @@ pub fn ref_slice(s: &A) -> &[A] { /// Converts a reference to A into a slice of length 1 (without copying). #[unstable(feature = "ref_slice", issue = "27774")] +#[deprecated(since = "1.5.0", reason = "unclear whether belongs in libstd")] pub fn mut_ref_slice(s: &mut A) -> &mut [A] { unsafe { from_raw_parts_mut(s, 1) diff --git a/src/libcore/str/mod.rs b/src/libcore/str/mod.rs index b7adfa8b7f891..7a78460a841bd 100644 --- a/src/libcore/str/mod.rs +++ b/src/libcore/str/mod.rs @@ -155,8 +155,7 @@ impl Utf8Error { /// // the first byte is invalid here /// assert_eq!(1, error.valid_up_to()); /// ``` - #[unstable(feature = "utf8_error", reason = "method just added", - issue = "27734")] + #[stable(feature = "utf8_error", since = "1.5.0")] pub fn valid_up_to(&self) -> usize { self.valid_up_to } } @@ -882,9 +881,7 @@ generate_pattern_iterators! { /// Created with the method `.rmatch_indices()`. struct RMatchIndices; stability: - #[unstable(feature = "str_match_indices", - reason = "type may be removed or have its iterator impl changed", - issue = "27743")] + #[stable(feature = "str_match_indices", since = "1.5.0")] internal: MatchIndicesInternal yielding ((usize, &'a str)); delegate double ended; diff --git a/src/librand/distributions/exponential.rs b/src/librand/distributions/exponential.rs index 39e01431983e3..f02b945178fb9 100644 --- a/src/librand/distributions/exponential.rs +++ b/src/librand/distributions/exponential.rs @@ -87,8 +87,6 @@ impl IndependentSample for Exp { #[cfg(test)] mod tests { - use std::prelude::v1::*; - use distributions::{Sample, IndependentSample}; use super::Exp; @@ -117,8 +115,6 @@ mod tests { mod bench { extern crate test; - use std::prelude::v1::*; - use self::test::Bencher; use std::mem::size_of; use super::Exp; diff --git a/src/librand/distributions/gamma.rs b/src/librand/distributions/gamma.rs index 47fa142059aae..fceda64cbb3f1 100644 --- a/src/librand/distributions/gamma.rs +++ b/src/librand/distributions/gamma.rs @@ -289,8 +289,6 @@ impl IndependentSample for StudentT { #[cfg(test)] mod tests { - use std::prelude::v1::*; - use distributions::{Sample, IndependentSample}; use super::{ChiSquared, StudentT, FisherF}; @@ -351,7 +349,6 @@ mod tests { #[cfg(test)] mod bench { extern crate test; - use std::prelude::v1::*; use self::test::Bencher; use std::mem::size_of; use distributions::IndependentSample; diff --git a/src/librand/distributions/mod.rs b/src/librand/distributions/mod.rs index 695933370ec3e..4c62e1a350406 100644 --- a/src/librand/distributions/mod.rs +++ b/src/librand/distributions/mod.rs @@ -263,8 +263,6 @@ fn ziggurat(rng: &mut R, #[cfg(test)] mod tests { - use std::prelude::v1::*; - use {Rng, Rand}; use super::{RandSample, WeightedChoice, Weighted, Sample, IndependentSample}; diff --git a/src/librand/distributions/normal.rs b/src/librand/distributions/normal.rs index 7fe8b6e8806e9..b2ccc5eb6095b 100644 --- a/src/librand/distributions/normal.rs +++ b/src/librand/distributions/normal.rs @@ -144,8 +144,6 @@ impl IndependentSample for LogNormal { #[cfg(test)] mod tests { - use std::prelude::v1::*; - use distributions::{Sample, IndependentSample}; use super::{Normal, LogNormal}; @@ -184,7 +182,6 @@ mod tests { #[cfg(test)] mod bench { extern crate test; - use std::prelude::v1::*; use self::test::Bencher; use std::mem::size_of; use distributions::Sample; diff --git a/src/librand/distributions/range.rs b/src/librand/distributions/range.rs index c2ce2d7e102e5..f94ef059dae8f 100644 --- a/src/librand/distributions/range.rs +++ b/src/librand/distributions/range.rs @@ -148,7 +148,6 @@ float_impl! { f64 } #[cfg(test)] mod tests { - use std::prelude::v1::*; use distributions::{Sample, IndependentSample}; use super::Range; diff --git a/src/librand/lib.rs b/src/librand/lib.rs index e99d82f585812..b5a1eb9520cec 100644 --- a/src/librand/lib.rs +++ b/src/librand/lib.rs @@ -39,7 +39,7 @@ #![feature(custom_attribute)] #![allow(unused_attributes)] -#![cfg_attr(test, feature(test, rand, rustc_private, iter_order))] +#![cfg_attr(test, feature(test, rand, rustc_private, iter_order_deprecated))] #![allow(deprecated)] diff --git a/src/librand/reseeding.rs b/src/librand/reseeding.rs index db3d690461c17..584cf78a1cdbf 100644 --- a/src/librand/reseeding.rs +++ b/src/librand/reseeding.rs @@ -123,7 +123,7 @@ impl Default for ReseedWithDefault { mod tests { use std::prelude::v1::*; - use core::iter::{order, repeat}; + use core::iter::order; use super::{ReseedingRng, ReseedWithDefault}; use {SeedableRng, Rng}; diff --git a/src/librustc/lib.rs b/src/librustc/lib.rs index e08dc2acbc088..393329b42147c 100644 --- a/src/librustc/lib.rs +++ b/src/librustc/lib.rs @@ -35,7 +35,6 @@ #![feature(duration_span)] #![feature(dynamic_lib)] #![feature(enumset)] -#![feature(fs_canonicalize)] #![feature(hashmap_hasher)] #![feature(into_cow)] #![feature(iter_cmp)] @@ -43,18 +42,13 @@ #![feature(libc)] #![feature(nonzero)] #![feature(num_bits_bytes)] -#![feature(path_ext)] #![feature(quote)] -#![feature(range_inclusive)] -#![feature(ref_slice)] #![feature(rustc_diagnostic_macros)] #![feature(rustc_private)] #![feature(scoped_tls)] -#![feature(slice_splits)] #![feature(slice_patterns)] #![feature(staged_api)] #![feature(str_char)] -#![feature(str_match_indices)] #![feature(vec_push_all)] #![feature(wrapping)] #![feature(cell_extras)] diff --git a/src/librustc/middle/check_match.rs b/src/librustc/middle/check_match.rs index 4d7dd60a27156..1548a3aed4bd8 100644 --- a/src/librustc/middle/check_match.rs +++ b/src/librustc/middle/check_match.rs @@ -29,13 +29,13 @@ use middle::ty::*; use middle::ty; use std::cmp::Ordering; use std::fmt; -use std::iter::{range_inclusive, FromIterator, IntoIterator, repeat}; -use std::slice; +use std::iter::{FromIterator, IntoIterator, repeat}; use rustc_front::hir; use rustc_front::hir::Pat; use rustc_front::visit::{self, Visitor, FnKind}; use rustc_front::util as front_util; +use rustc_back::slice; use syntax::ast::{self, DUMMY_NODE_ID, NodeId}; use syntax::ast_util; @@ -615,7 +615,7 @@ fn all_constructors(_cx: &MatchCheckCtxt, left_ty: Ty, ty::TyRef(_, ty::TypeAndMut { ty, .. }) => match ty.sty { ty::TySlice(_) => - range_inclusive(0, max_slice_length).map(|length| Slice(length)).collect(), + (0..max_slice_length+1).map(|length| Slice(length)).collect(), _ => vec![Single] }, @@ -790,7 +790,7 @@ fn pat_constructors(cx: &MatchCheckCtxt, p: &Pat, match left_ty.sty { ty::TyArray(_, _) => vec!(Single), _ => if slice.is_some() { - range_inclusive(before.len() + after.len(), max_slice_length) + (before.len() + after.len()..max_slice_length+1) .map(|length| Slice(length)) .collect() } else { diff --git a/src/librustc/plugin/load.rs b/src/librustc/plugin/load.rs index 288426830efaf..751e748094d02 100644 --- a/src/librustc/plugin/load.rs +++ b/src/librustc/plugin/load.rs @@ -15,7 +15,6 @@ use metadata::creader::CrateReader; use plugin::registry::Registry; use std::borrow::ToOwned; -use std::dynamic_lib::DynamicLibrary; use std::env; use std::mem; use std::path::PathBuf; @@ -103,10 +102,13 @@ impl<'a> PluginLoader<'a> { } // Dynamically link a registrar function into the compiler process. + #[allow(deprecated)] fn dylink_registrar(&mut self, span: Span, path: PathBuf, symbol: String) -> PluginRegistrarFun { + use std::dynamic_lib::DynamicLibrary; + // Make sure the path contains a / or the linker will search for it. let path = env::current_dir().unwrap().join(&path); diff --git a/src/librustc_back/lib.rs b/src/librustc_back/lib.rs index 4a6646bca1b64..14fb064b7aabe 100644 --- a/src/librustc_back/lib.rs +++ b/src/librustc_back/lib.rs @@ -33,9 +33,7 @@ html_root_url = "https://doc.rust-lang.org/nightly/")] #![feature(box_syntax)] -#![feature(fs_canonicalize)] #![feature(libc)] -#![feature(path_ext)] #![feature(rand)] #![feature(rustc_private)] #![feature(slice_bytes)] @@ -57,3 +55,4 @@ pub mod rpath; pub mod sha2; pub mod svh; pub mod target; +pub mod slice; diff --git a/src/librustc_back/slice.rs b/src/librustc_back/slice.rs new file mode 100644 index 0000000000000..5d8fc3acefd6f --- /dev/null +++ b/src/librustc_back/slice.rs @@ -0,0 +1,19 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +use std::mem; + +pub fn ref_slice(ptr: &T) -> &[T; 1] { + unsafe { mem::transmute(ptr) } +} + +pub fn mut_ref_slice(ptr: &mut T) -> &mut [T; 1] { + unsafe { mem::transmute(ptr) } +} diff --git a/src/librustc_lint/lib.rs b/src/librustc_lint/lib.rs index 4202b3dbc7b45..920e0341372ba 100644 --- a/src/librustc_lint/lib.rs +++ b/src/librustc_lint/lib.rs @@ -35,7 +35,6 @@ #![feature(box_syntax)] #![feature(num_bits_bytes)] #![feature(quote)] -#![feature(ref_slice)] #![feature(rustc_diagnostic_macros)] #![feature(rustc_private)] #![feature(slice_patterns)] @@ -48,6 +47,7 @@ extern crate rustc; #[macro_use] extern crate log; extern crate rustc_front; +extern crate rustc_back; pub use rustc::lint as lint; pub use rustc::metadata as metadata; diff --git a/src/librustc_lint/unused.rs b/src/librustc_lint/unused.rs index 6eee6872be21f..8ed4706b1ce9f 100644 --- a/src/librustc_lint/unused.rs +++ b/src/librustc_lint/unused.rs @@ -18,7 +18,6 @@ use lint::{LateContext, EarlyContext, LintContext, LintArray}; use lint::{LintPass, EarlyLintPass, LateLintPass}; use std::collections::hash_map::Entry::{Occupied, Vacant}; -use std::slice; use syntax::ast; use syntax::attr::{self, AttrMetaMethods}; @@ -26,8 +25,8 @@ use syntax::codemap::Span; use syntax::feature_gate::{KNOWN_ATTRIBUTES, AttributeType}; use syntax::ptr::P; +use rustc_back::slice; use rustc_front::hir; - use rustc_front::visit::FnKind; declare_lint! { diff --git a/src/librustc_mir/lib.rs b/src/librustc_mir/lib.rs index eda9146cefaf2..934dd660177b8 100644 --- a/src/librustc_mir/lib.rs +++ b/src/librustc_mir/lib.rs @@ -18,7 +18,6 @@ Rust MIR: a lowered representation of Rust. Also: an experiment! #![crate_type = "rlib"] #![crate_type = "dylib"] -#![feature(ref_slice)] #![feature(rustc_private)] #![feature(into_cow)] @@ -27,6 +26,7 @@ extern crate graphviz as dot; extern crate rustc; extern crate rustc_data_structures; extern crate rustc_front; +extern crate rustc_back; extern crate syntax; pub mod build; diff --git a/src/librustc_mir/repr.rs b/src/librustc_mir/repr.rs index 48db0de3cecb4..5059955c5dc33 100644 --- a/src/librustc_mir/repr.rs +++ b/src/librustc_mir/repr.rs @@ -13,12 +13,12 @@ use rustc::middle::def_id::DefId; use rustc::middle::region::CodeExtent; use rustc::middle::subst::Substs; use rustc::middle::ty::{AdtDef, ClosureSubsts, Region, Ty}; +use rustc_back::slice; use rustc_data_structures::fnv::FnvHashMap; use rustc_front::hir::InlineAsm; use syntax::ast::Name; use syntax::codemap::Span; use std::fmt::{Debug, Formatter, Error}; -use std::slice; use std::u32; /// Lowered representation of a single function. diff --git a/src/librustc_resolve/lib.rs b/src/librustc_resolve/lib.rs index ac09534f1e0e5..106591724a798 100644 --- a/src/librustc_resolve/lib.rs +++ b/src/librustc_resolve/lib.rs @@ -23,7 +23,6 @@ #![feature(borrow_state)] #![feature(rustc_diagnostic_macros)] #![feature(rustc_private)] -#![feature(slice_splits)] #![feature(staged_api)] #[macro_use] extern crate log; diff --git a/src/librustc_trans/back/link.rs b/src/librustc_trans/back/link.rs index f2f8c13880a7e..6171ff1382fbd 100644 --- a/src/librustc_trans/back/link.rs +++ b/src/librustc_trans/back/link.rs @@ -36,7 +36,7 @@ use std::ascii; use std::char; use std::env; use std::ffi::OsString; -use std::fs::{self, PathExt}; +use std::fs; use std::io::{self, Read, Write}; use std::iter::once; use std::mem; diff --git a/src/librustc_trans/lib.rs b/src/librustc_trans/lib.rs index 7f7b9e0ed7616..e02ce49132a7c 100644 --- a/src/librustc_trans/lib.rs +++ b/src/librustc_trans/lib.rs @@ -33,16 +33,12 @@ #![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(rustc_diagnostic_macros)] #![feature(rustc_private)] #![feature(staged_api)] #![feature(unicode)] -#![feature(unicode)] #![feature(vec_push_all)] #![allow(trivial_casts)] diff --git a/src/librustc_typeck/astconv.rs b/src/librustc_typeck/astconv.rs index 30a99ca9dad67..d3ff92dc2f605 100644 --- a/src/librustc_typeck/astconv.rs +++ b/src/librustc_typeck/astconv.rs @@ -66,7 +66,6 @@ use rscope::{self, UnelidableRscope, RegionScope, ElidableRscope, use util::common::{ErrorReported, FN_OUTPUT_NAME}; use util::nodemap::FnvHashSet; -use std::slice; use syntax::{abi, ast}; use syntax::codemap::{Span, Pos}; use syntax::feature_gate::{GateIssue, emit_feature_err}; @@ -74,7 +73,7 @@ use syntax::parse::token; use rustc_front::print::pprust; use rustc_front::hir; - +use rustc_back::slice; pub trait AstConv<'tcx> { fn tcx<'a>(&'a self) -> &'a ty::ctxt<'tcx>; diff --git a/src/librustc_typeck/check/mod.rs b/src/librustc_typeck/check/mod.rs index ba1af220d8e0f..f085ce23e3f0c 100644 --- a/src/librustc_typeck/check/mod.rs +++ b/src/librustc_typeck/check/mod.rs @@ -115,7 +115,6 @@ use util::lev_distance::lev_distance; use std::cell::{Cell, Ref, RefCell}; use std::collections::{HashSet}; use std::mem::replace; -use std::slice; use syntax::abi; use syntax::ast; use syntax::attr; @@ -130,6 +129,7 @@ use rustc_front::hir; use rustc_front::hir::Visibility; use rustc_front::hir::{Item, ItemImpl}; use rustc_front::print::pprust; +use rustc_back::slice; mod assoc; pub mod dropck; diff --git a/src/librustc_typeck/lib.rs b/src/librustc_typeck/lib.rs index 7156c9c6091a7..1a52df31f39ce 100644 --- a/src/librustc_typeck/lib.rs +++ b/src/librustc_typeck/lib.rs @@ -81,10 +81,8 @@ This API is completely unstable and subject to change. #![feature(iter_cmp)] #![feature(iter_arith)] #![feature(quote)] -#![feature(ref_slice)] #![feature(rustc_diagnostic_macros)] #![feature(rustc_private)] -#![feature(slice_splits)] #![feature(staged_api)] #![feature(vec_push_all)] #![feature(cell_extras)] @@ -97,6 +95,7 @@ extern crate fmt_macros; extern crate rustc; extern crate rustc_platform_intrinsics as intrinsics; extern crate rustc_front; +extern crate rustc_back; pub use rustc::front; pub use rustc::lint; diff --git a/src/librustc_unicode/lib.rs b/src/librustc_unicode/lib.rs index 4f0aa69d77199..467c974690062 100644 --- a/src/librustc_unicode/lib.rs +++ b/src/librustc_unicode/lib.rs @@ -34,7 +34,6 @@ test(no_crate_inject))] #![no_std] -#![feature(char_from_unchecked)] #![feature(core_char_ext)] #![feature(core_slice_ext)] #![feature(core_str_ext)] diff --git a/src/librustdoc/lib.rs b/src/librustdoc/lib.rs index b311ddc4f4515..db0da3764ba22 100644 --- a/src/librustdoc/lib.rs +++ b/src/librustdoc/lib.rs @@ -24,7 +24,6 @@ #![feature(box_syntax)] #![feature(dynamic_lib)] #![feature(libc)] -#![feature(path_ext)] #![feature(path_relative_from)] #![feature(rustc_private)] #![feature(set_stdio)] diff --git a/src/librustdoc/plugins.rs b/src/librustdoc/plugins.rs index a81787dad7774..7292ea5377e25 100644 --- a/src/librustdoc/plugins.rs +++ b/src/librustdoc/plugins.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +#![allow(deprecated)] + use clean; use std::dynamic_lib as dl; diff --git a/src/librustdoc/test.rs b/src/librustdoc/test.rs index d6114737ab5a2..cbaff95dfddd7 100644 --- a/src/librustdoc/test.rs +++ b/src/librustdoc/test.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +#![allow(deprecated)] + use std::cell::{RefCell, Cell}; use std::collections::{HashSet, HashMap}; use std::dynamic_lib::DynamicLibrary; diff --git a/src/libstd/dynamic_lib.rs b/src/libstd/dynamic_lib.rs index 5629cba1e0b3c..684a300560644 100644 --- a/src/libstd/dynamic_lib.rs +++ b/src/libstd/dynamic_lib.rs @@ -16,7 +16,9 @@ reason = "API has not been scrutinized and is highly likely to \ either disappear or change", issue = "27810")] +#![deprecated(since = "1.5.0", reason = "replaced with crates.io crates")] #![allow(missing_docs)] +#![allow(deprecated)] use prelude::v1::*; diff --git a/src/libstd/fs.rs b/src/libstd/fs.rs index 1da7a1502d92d..6178f1bbb8e12 100644 --- a/src/libstd/fs.rs +++ b/src/libstd/fs.rs @@ -955,8 +955,21 @@ pub fn read_link>(path: P) -> io::Result { /// Returns the canonical form of a path with all intermediate components /// normalized and symbolic links resolved. -#[unstable(feature = "fs_canonicalize", reason = "recently added API", - issue = "27706")] +/// +/// This function may return an error in situations like where the path does not +/// exist, a component in the path is not a directory, or an I/O error happens. +/// +/// # Examples +/// +/// ``` +/// use std::fs; +/// +/// # fn foo() -> std::io::Result<()> { +/// let path = try!(fs::canonicalize("../a/../foo.txt")); +/// # Ok(()) +/// # } +/// ``` +#[stable(feature = "fs_canonicalize", since = "1.5.0")] pub fn canonicalize>(path: P) -> io::Result { fs_imp::canonicalize(path.as_ref()) } @@ -1158,11 +1171,12 @@ impl Iterator for WalkDir { } /// Utility methods for paths. -#[unstable(feature = "path_ext", +#[unstable(feature = "path_ext_deprecated", reason = "The precise set of methods exposed on this trait may \ change and some methods may be removed. For stable code, \ see the std::fs::metadata function.", issue = "27725")] +#[deprecated(since = "1.5.0", reason = "replaced with inherent methods")] pub trait PathExt { /// Gets information on the file, directory, etc at this path. /// @@ -1215,6 +1229,7 @@ pub trait PathExt { fn is_dir(&self) -> bool; } +#[allow(deprecated)] impl PathExt for Path { fn metadata(&self) -> io::Result { metadata(self) } fn symlink_metadata(&self) -> io::Result { symlink_metadata(self) } diff --git a/src/libstd/io/prelude.rs b/src/libstd/io/prelude.rs index db5c1da8a4227..f8fbe485c9b27 100644 --- a/src/libstd/io/prelude.rs +++ b/src/libstd/io/prelude.rs @@ -21,4 +21,5 @@ #![stable(feature = "rust1", since = "1.0.0")] pub use super::{Read, Write, BufRead, Seek}; +#[allow(deprecated)] pub use fs::PathExt; diff --git a/src/libstd/lib.rs b/src/libstd/lib.rs index a624b3521267a..93d1ce168b7e2 100644 --- a/src/libstd/lib.rs +++ b/src/libstd/lib.rs @@ -210,7 +210,6 @@ #![feature(borrow_state)] #![feature(box_syntax)] #![feature(cfg_target_vendor)] -#![feature(char_from_unchecked)] #![feature(char_internals)] #![feature(clone_from_slice)] #![feature(collections)] @@ -225,7 +224,6 @@ #![feature(heap_api)] #![feature(int_error_internals)] #![feature(into_cow)] -#![feature(iter_order)] #![feature(lang_items)] #![feature(libc)] #![feature(linkage, thread_local, asm)] @@ -251,7 +249,6 @@ #![feature(decode_utf16)] #![feature(unwind_attributes)] #![feature(vec_push_all)] -#![feature(vec_resize)] #![feature(wrapping)] #![feature(zero_one)] #![cfg_attr(windows, feature(str_utf16))] diff --git a/src/libstd/path.rs b/src/libstd/path.rs index 43c2766782e58..fe12b671235a2 100644 --- a/src/libstd/path.rs +++ b/src/libstd/path.rs @@ -101,12 +101,14 @@ use ascii::*; use borrow::{Borrow, IntoCow, ToOwned, Cow}; use cmp; +use fmt; +use fs; +use io; use iter; use mem; use ops::{self, Deref}; use string::String; use vec::Vec; -use fmt; use ffi::{OsStr, OsString}; @@ -1689,6 +1691,81 @@ impl Path { pub fn display(&self) -> Display { Display { path: self } } + + + /// Gets information on the file, directory, etc at this path. + /// + /// Consult the `fs::metadata` documentation for more info. + /// + /// This call preserves identical runtime/error semantics with + /// `fs::metadata`. + #[stable(feature = "path_ext", since = "1.5.0")] + pub fn metadata(&self) -> io::Result { + fs::metadata(self) + } + + /// Gets information on the file, directory, etc at this path. + /// + /// Consult the `fs::symlink_metadata` documentation for more info. + /// + /// This call preserves identical runtime/error semantics with + /// `fs::symlink_metadata`. + #[stable(feature = "path_ext", since = "1.5.0")] + pub fn symlink_metadata(&self) -> io::Result { + fs::symlink_metadata(self) + } + + /// Returns the canonical form of a path, normalizing all components and + /// eliminate all symlinks. + /// + /// This call preserves identical runtime/error semantics with + /// `fs::canonicalize`. + #[stable(feature = "path_ext", since = "1.5.0")] + pub fn canonicalize(&self) -> io::Result { + fs::canonicalize(self) + } + + /// Reads the symlink at this path. + /// + /// For more information see `fs::read_link`. + #[stable(feature = "path_ext", since = "1.5.0")] + pub fn read_link(&self) -> io::Result { + fs::read_link(self) + } + + /// Reads the directory at this path. + /// + /// For more information see `fs::read_dir`. + #[stable(feature = "path_ext", since = "1.5.0")] + pub fn read_dir(&self) -> io::Result { + fs::read_dir(self) + } + + /// Boolean value indicator whether the underlying file exists on the local + /// filesystem. Returns false in exactly the cases where `fs::stat` fails. + #[stable(feature = "path_ext", since = "1.5.0")] + pub fn exists(&self) -> bool { + fs::metadata(self).is_ok() + } + + /// Whether the underlying implementation (be it a file path, or something + /// else) points at a "regular file" on the FS. Will return false for paths + /// to non-existent locations or directories or other non-regular files + /// (named pipes, etc). Follows links when making this determination. + #[stable(feature = "path_ext", since = "1.5.0")] + pub fn is_file(&self) -> bool { + fs::metadata(self).map(|m| m.is_file()).unwrap_or(false) + } + + /// Whether the underlying implementation (be it a file path, or something + /// else) is pointing at a directory in the underlying FS. Will return + /// false for paths to non-existent locations or if the item is not a + /// directory (eg files, named pipes, etc). Follows links when making this + /// determination. + #[stable(feature = "path_ext", since = "1.5.0")] + pub fn is_dir(&self) -> bool { + fs::metadata(self).map(|m| m.is_dir()).unwrap_or(false) + } } #[stable(feature = "rust1", since = "1.0.0")] diff --git a/src/libstd/sync/condvar.rs b/src/libstd/sync/condvar.rs index 851726d91c6e8..1b32515e9f72e 100644 --- a/src/libstd/sync/condvar.rs +++ b/src/libstd/sync/condvar.rs @@ -21,12 +21,12 @@ use time::Duration; /// A type indicating whether a timed wait on a condition variable returned /// due to a time out or not. #[derive(Debug, PartialEq, Eq, Copy, Clone)] -#[unstable(feature = "wait_timeout", reason = "newly added", issue = "27772")] +#[stable(feature = "wait_timeout", since = "1.5.0")] pub struct WaitTimeoutResult(bool); impl WaitTimeoutResult { /// Returns whether the wait was known to have timed out. - #[unstable(feature = "wait_timeout", reason = "newly added", issue = "27772")] + #[stable(feature = "wait_timeout", since = "1.5.0")] pub fn timed_out(&self) -> bool { self.0 } @@ -189,8 +189,7 @@ impl Condvar { /// /// Like `wait`, the lock specified will be re-acquired when this function /// returns, regardless of whether the timeout elapsed or not. - #[unstable(feature = "wait_timeout", reason = "waiting for Duration", - issue = "27772")] + #[stable(feature = "wait_timeout", since = "1.5.0")] pub fn wait_timeout<'a, T>(&self, guard: MutexGuard<'a, T>, dur: Duration) -> LockResult<(MutexGuard<'a, T>, WaitTimeoutResult)> { diff --git a/src/libstd/sys/common/unwind/mod.rs b/src/libstd/sys/common/unwind/mod.rs index 3978aeb39bc46..d87ab56d4e177 100644 --- a/src/libstd/sys/common/unwind/mod.rs +++ b/src/libstd/sys/common/unwind/mod.rs @@ -81,12 +81,12 @@ use sys_common::mutex::Mutex; #[path = "seh.rs"] #[doc(hidden)] pub mod imp; -// SNAP: i686-pc-windows-gnu +// stage0: i686-pc-windows-gnu #[cfg(all(stage0, windows, target_arch = "x86_64", target_env = "gnu"))] #[path = "seh64_gnu.rs"] #[doc(hidden)] pub mod imp; -// SNAP: x86_64-pc-windows-msvc +// stage0: x86_64-pc-windows-msvc #[cfg(all(stage0, windows, target_arch = "x86_64", target_env = "msvc"))] #[path = "seh.rs"] #[doc(hidden)] pub mod imp; diff --git a/src/libstd/sys/unix/ext/fs.rs b/src/libstd/sys/unix/ext/fs.rs index 46ab83199f0f7..5ef37ae51c994 100644 --- a/src/libstd/sys/unix/ext/fs.rs +++ b/src/libstd/sys/unix/ext/fs.rs @@ -178,21 +178,23 @@ impl MetadataExt for fs::Metadata { } /// Add special unix types (block/char device, fifo and socket) -#[unstable(feature = "file_type_ext", reason = "recently added API", - issue = "27796")] +#[stable(feature = "file_type_ext", since = "1.5.0")] pub trait FileTypeExt { /// Returns whether this file type is a block device. + #[stable(feature = "file_type_ext", since = "1.5.0")] fn is_block_device(&self) -> bool; /// Returns whether this file type is a char device. + #[stable(feature = "file_type_ext", since = "1.5.0")] fn is_char_device(&self) -> bool; /// Returns whether this file type is a fifo. + #[stable(feature = "file_type_ext", since = "1.5.0")] fn is_fifo(&self) -> bool; /// Returns whether this file type is a socket. + #[stable(feature = "file_type_ext", since = "1.5.0")] fn is_socket(&self) -> bool; } -#[unstable(feature = "file_type_ext", reason = "recently added API", - issue = "27796")] +#[stable(feature = "file_type_ext", since = "1.5.0")] impl FileTypeExt for fs::FileType { fn is_block_device(&self) -> bool { self.as_inner().is(libc::S_IFBLK) } fn is_char_device(&self) -> bool { self.as_inner().is(libc::S_IFCHR) } diff --git a/src/libstd/sys/unix/fs.rs b/src/libstd/sys/unix/fs.rs index d0c027ddad65f..c2145ac875ac3 100644 --- a/src/libstd/sys/unix/fs.rs +++ b/src/libstd/sys/unix/fs.rs @@ -543,7 +543,7 @@ pub fn canonicalize(p: &Path) -> io::Result { } pub fn copy(from: &Path, to: &Path) -> io::Result { - use fs::{File, PathExt, set_permissions}; + use fs::{File, set_permissions}; if !from.is_file() { return Err(Error::new(ErrorKind::InvalidInput, "the source path is not an existing regular file")) diff --git a/src/libstd/sys/unix/thread.rs b/src/libstd/sys/unix/thread.rs index 50e01ecf9fa98..b7968e9344f3c 100644 --- a/src/libstd/sys/unix/thread.rs +++ b/src/libstd/sys/unix/thread.rs @@ -356,6 +356,7 @@ pub mod guard { // but that caused Debian to detect an unnecessarily strict versioned // dependency on libc6 (#23628). #[cfg(target_os = "linux")] +#[allow(deprecated)] fn min_stack_size(attr: *const libc::pthread_attr_t) -> usize { use dynamic_lib::DynamicLibrary; use sync::Once; diff --git a/src/libstd/sys/windows/backtrace.rs b/src/libstd/sys/windows/backtrace.rs index 9534a107d1616..b562e772b9c2c 100644 --- a/src/libstd/sys/windows/backtrace.rs +++ b/src/libstd/sys/windows/backtrace.rs @@ -22,7 +22,7 @@ //! copy of that function in my mingw install (maybe it was broken?). Instead, //! this takes the route of using StackWalk64 in order to walk the stack. -#![allow(dead_code)] +#![allow(dead_code, deprecated)] use io::prelude::*; diff --git a/src/libstd/sys/windows/printing/gnu.rs b/src/libstd/sys/windows/printing/gnu.rs index 8d3c93bb7b176..e27bef0b1e989 100644 --- a/src/libstd/sys/windows/printing/gnu.rs +++ b/src/libstd/sys/windows/printing/gnu.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +#![allow(deprecated)] + use dynamic_lib::DynamicLibrary; use io; use io::prelude::*; diff --git a/src/libstd/sys/windows/printing/msvc.rs b/src/libstd/sys/windows/printing/msvc.rs index 81d19374fea2d..6f1db5df7db2a 100644 --- a/src/libstd/sys/windows/printing/msvc.rs +++ b/src/libstd/sys/windows/printing/msvc.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +#![allow(deprecated)] + use sys_common::backtrace::{output, output_fileline}; use ffi::CStr; use dynamic_lib::DynamicLibrary; diff --git a/src/libsyntax/lib.rs b/src/libsyntax/lib.rs index f3b2c79a7dd04..9adef08771d06 100644 --- a/src/libsyntax/lib.rs +++ b/src/libsyntax/lib.rs @@ -29,7 +29,6 @@ #![feature(drain)] #![feature(filling_drop)] #![feature(libc)] -#![feature(ref_slice)] #![feature(rustc_private)] #![feature(set_stdio)] #![feature(staged_api)] @@ -37,7 +36,6 @@ #![feature(str_escape)] #![feature(unicode)] #![feature(vec_push_all)] -#![feature(vec_resize)] extern crate fmt_macros; extern crate serialize; diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index fcebe03596103..ef3aad1cd457c 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -422,7 +422,7 @@ impl<'a> Parser<'a> { this_token_str))) } } else { - self.expect_one_of(slice::ref_slice(t), &[]) + self.expect_one_of(unsafe { slice::from_raw_parts(t, 1) }, &[]) } } diff --git a/src/libsyntax/util/small_vector.rs b/src/libsyntax/util/small_vector.rs index 9743da15a47bb..d65e37fd2abc1 100644 --- a/src/libsyntax/util/small_vector.rs +++ b/src/libsyntax/util/small_vector.rs @@ -65,7 +65,6 @@ impl SmallVector { result } One(ref v) => { - // FIXME: Could be replaced with `slice::ref_slice(v)` when it is stable. unsafe { slice::from_raw_parts(v, 1) } } Many(ref vs) => vs diff --git a/src/libterm/lib.rs b/src/libterm/lib.rs index 8bf8044f81431..ced3a7d47d7b6 100644 --- a/src/libterm/lib.rs +++ b/src/libterm/lib.rs @@ -57,7 +57,6 @@ #![deny(missing_docs)] #![feature(box_syntax)] -#![feature(path_ext)] #![feature(rustc_private)] #![feature(staged_api)] #![feature(str_char)] diff --git a/src/test/run-pass-fulldeps/rename-directory.rs b/src/test/run-pass-fulldeps/rename-directory.rs index 2bec41f3ee040..f107e1042816f 100644 --- a/src/test/run-pass-fulldeps/rename-directory.rs +++ b/src/test/run-pass-fulldeps/rename-directory.rs @@ -13,12 +13,12 @@ // ignore-cross-compile -#![feature(rustc_private, path_ext)] +#![feature(rustc_private)] extern crate rustc_back; use std::ffi::CString; -use std::fs::{self, File, PathExt}; +use std::fs::{self, File}; use rustc_back::tempdir::TempDir; fn rename_directory() {