Skip to content

Commit e02ada6

Browse files
committed
Auto merge of #29254 - alexcrichton:stabilize-1.5, r=brson
This commit stabilizes and deprecates library APIs whose FCP has closed in the last cycle, specifically: Stabilized APIs: * `fs::canonicalize` * `Path::{metadata, symlink_metadata, canonicalize, read_link, read_dir, exists, is_file, is_dir}` - all moved to inherent methods from the `PathExt` trait. * `Formatter::fill` * `Formatter::width` * `Formatter::precision` * `Formatter::sign_plus` * `Formatter::sign_minus` * `Formatter::alternate` * `Formatter::sign_aware_zero_pad` * `string::ParseError` * `Utf8Error::valid_up_to` * `Iterator::{cmp, partial_cmp, eq, ne, lt, le, gt, ge}` * `<[T]>::split_{first,last}{,_mut}` * `Condvar::wait_timeout` - note that `wait_timeout_ms` is not yet deprecated but will be once 1.5 is released. * `str::{R,}MatchIndices` * `str::{r,}match_indices` * `char::from_u32_unchecked` * `VecDeque::insert` * `VecDeque::shrink_to_fit` * `VecDeque::as_slices` * `VecDeque::as_mut_slices` * `VecDeque::swap_remove_front` - (renamed from `swap_front_remove`) * `VecDeque::swap_remove_back` - (renamed from `swap_back_remove`) * `Vec::resize` * `str::slice_mut_unchecked` * `FileTypeExt` * `FileTypeExt::{is_block_device, is_char_device, is_fifo, is_socket}` * `BinaryHeap::from` - `from_vec` deprecated in favor of this * `BinaryHeap::into_vec` - plus a `Into` impl * `BinaryHeap::into_sorted_vec` Deprecated APIs * `slice::ref_slice` * `slice::mut_ref_slice` * `iter::{range_inclusive, RangeInclusive}` * `std::dynamic_lib` Closes #27706 Closes #27725 cc #27726 (align not stabilized yet) Closes #27734 Closes #27737 Closes #27742 Closes #27743 Closes #27772 Closes #27774 Closes #27777 Closes #27781 cc #27788 (a few remaining methods though) Closes #27790 Closes #27793 Closes #27796 Closes #27810 cc #28147 (not all parts stabilized)
2 parents 079f384 + ff49733 commit e02ada6

File tree

60 files changed

+274
-195
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+274
-195
lines changed

src/compiletest/compiletest.rs

-2
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,7 @@
1313
#![feature(box_syntax)]
1414
#![feature(dynamic_lib)]
1515
#![feature(libc)]
16-
#![feature(path_ext)]
1716
#![feature(rustc_private)]
18-
#![feature(slice_splits)]
1917
#![feature(str_char)]
2018
#![feature(test)]
2119
#![feature(vec_push_all)]

src/compiletest/procsrv.rs

+2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
#![allow(deprecated)]
12+
1113
use std::dynamic_lib::DynamicLibrary;
1214
use std::io::prelude::*;
1315
use std::path::PathBuf;

src/libcollections/binary_heap.rs

+31-30
Original file line numberDiff line numberDiff line change
@@ -240,14 +240,9 @@ impl<T: Ord> BinaryHeap<T> {
240240
#[unstable(feature = "binary_heap_extras",
241241
reason = "needs to be audited",
242242
issue = "28147")]
243+
#[deprecated(since = "1.5.0", reason = "use BinaryHeap::from instead")]
243244
pub fn from_vec(vec: Vec<T>) -> BinaryHeap<T> {
244-
let mut heap = BinaryHeap { data: vec };
245-
let mut n = heap.len() / 2;
246-
while n > 0 {
247-
n -= 1;
248-
heap.sift_down(n);
249-
}
250-
heap
245+
BinaryHeap::from(vec)
251246
}
252247

253248
/// Returns an iterator visiting all values in the underlying vector, in
@@ -256,10 +251,8 @@ impl<T: Ord> BinaryHeap<T> {
256251
/// # Examples
257252
///
258253
/// ```
259-
/// #![feature(binary_heap_extras)]
260-
///
261254
/// use std::collections::BinaryHeap;
262-
/// let heap = BinaryHeap::from_vec(vec![1, 2, 3, 4]);
255+
/// let heap = BinaryHeap::from(vec![1, 2, 3, 4]);
263256
///
264257
/// // Print 1, 2, 3, 4 in arbitrary order
265258
/// for x in heap.iter() {
@@ -362,10 +355,8 @@ impl<T: Ord> BinaryHeap<T> {
362355
/// # Examples
363356
///
364357
/// ```
365-
/// #![feature(binary_heap_extras)]
366-
///
367358
/// use std::collections::BinaryHeap;
368-
/// let mut heap = BinaryHeap::from_vec(vec![1, 3]);
359+
/// let mut heap = BinaryHeap::from(vec![1, 3]);
369360
///
370361
/// assert_eq!(heap.pop(), Some(3));
371362
/// assert_eq!(heap.pop(), Some(1));
@@ -475,42 +466,36 @@ impl<T: Ord> BinaryHeap<T> {
475466
/// # Examples
476467
///
477468
/// ```
478-
/// #![feature(binary_heap_extras)]
479-
///
480469
/// use std::collections::BinaryHeap;
481-
/// let heap = BinaryHeap::from_vec(vec![1, 2, 3, 4, 5, 6, 7]);
470+
/// let heap = BinaryHeap::from(vec![1, 2, 3, 4, 5, 6, 7]);
482471
/// let vec = heap.into_vec();
483472
///
484473
/// // Will print in some order
485474
/// for x in vec {
486475
/// println!("{}", x);
487476
/// }
488477
/// ```
489-
#[unstable(feature = "binary_heap_extras",
490-
reason = "needs to be audited",
491-
issue = "28147")]
492-
pub fn into_vec(self) -> Vec<T> { self.data }
478+
#[stable(feature = "binary_heap_extras_15", since = "1.5.0")]
479+
pub fn into_vec(self) -> Vec<T> {
480+
self.into()
481+
}
493482

494483
/// Consumes the `BinaryHeap` and returns a vector in sorted
495484
/// (ascending) order.
496485
///
497486
/// # Examples
498487
///
499488
/// ```
500-
/// #![feature(binary_heap_extras)]
501-
///
502489
/// use std::collections::BinaryHeap;
503490
///
504-
/// let mut heap = BinaryHeap::from_vec(vec![1, 2, 4, 5, 7]);
491+
/// let mut heap = BinaryHeap::from(vec![1, 2, 4, 5, 7]);
505492
/// heap.push(6);
506493
/// heap.push(3);
507494
///
508495
/// let vec = heap.into_sorted_vec();
509496
/// assert_eq!(vec, [1, 2, 3, 4, 5, 6, 7]);
510497
/// ```
511-
#[unstable(feature = "binary_heap_extras",
512-
reason = "needs to be audited",
513-
issue = "28147")]
498+
#[stable(feature = "binary_heap_extras_15", since = "1.5.0")]
514499
pub fn into_sorted_vec(mut self) -> Vec<T> {
515500
let mut end = self.len();
516501
while end > 1 {
@@ -744,10 +729,28 @@ impl<'a, T: 'a> DoubleEndedIterator for Drain<'a, T> {
744729
#[stable(feature = "rust1", since = "1.0.0")]
745730
impl<'a, T: 'a> ExactSizeIterator for Drain<'a, T> {}
746731

732+
impl<T: Ord> From<Vec<T>> for BinaryHeap<T> {
733+
fn from(vec: Vec<T>) -> BinaryHeap<T> {
734+
let mut heap = BinaryHeap { data: vec };
735+
let mut n = heap.len() / 2;
736+
while n > 0 {
737+
n -= 1;
738+
heap.sift_down(n);
739+
}
740+
heap
741+
}
742+
}
743+
744+
impl<T> From<BinaryHeap<T>> for Vec<T> {
745+
fn from(heap: BinaryHeap<T>) -> Vec<T> {
746+
heap.data
747+
}
748+
}
749+
747750
#[stable(feature = "rust1", since = "1.0.0")]
748751
impl<T: Ord> FromIterator<T> for BinaryHeap<T> {
749752
fn from_iter<I: IntoIterator<Item=T>>(iter: I) -> BinaryHeap<T> {
750-
BinaryHeap::from_vec(iter.into_iter().collect())
753+
BinaryHeap::from(iter.into_iter().collect::<Vec<_>>())
751754
}
752755
}
753756

@@ -763,10 +766,8 @@ impl<T: Ord> IntoIterator for BinaryHeap<T> {
763766
/// # Examples
764767
///
765768
/// ```
766-
/// #![feature(binary_heap_extras)]
767-
///
768769
/// use std::collections::BinaryHeap;
769-
/// let heap = BinaryHeap::from_vec(vec![1, 2, 3, 4]);
770+
/// let heap = BinaryHeap::from(vec![1, 2, 3, 4]);
770771
///
771772
/// // Print 1, 2, 3, 4 in arbitrary order
772773
/// for x in heap.into_iter() {

src/libcollections/lib.rs

-3
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@
4646
#![feature(fmt_internals)]
4747
#![feature(fmt_radix)]
4848
#![feature(heap_api)]
49-
#![feature(iter_order)]
5049
#![feature(iter_arith)]
5150
#![feature(iter_arith)]
5251
#![feature(lang_items)]
@@ -60,14 +59,12 @@
6059
#![feature(staged_api)]
6160
#![feature(step_by)]
6261
#![feature(str_char)]
63-
#![feature(str_match_indices)]
6462
#![feature(unboxed_closures)]
6563
#![feature(unicode)]
6664
#![feature(unique)]
6765
#![feature(dropck_parametricity)]
6866
#![feature(unsafe_no_drop_flag, filling_drop)]
6967
#![feature(decode_utf16)]
70-
#![feature(utf8_error)]
7168
#![cfg_attr(test, feature(clone_from_slice, rand, test))]
7269

7370
#![feature(no_std)]

src/libcollections/slice.rs

+5-4
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ pub use core::slice::{Chunks, Windows};
106106
pub use core::slice::{Iter, IterMut};
107107
pub use core::slice::{SplitMut, ChunksMut, Split};
108108
pub use core::slice::{SplitN, RSplitN, SplitNMut, RSplitNMut};
109+
#[allow(deprecated)]
109110
pub use core::slice::{bytes, mut_ref_slice, ref_slice};
110111
pub use core::slice::{from_raw_parts, from_raw_parts_mut};
111112

@@ -214,29 +215,29 @@ impl<T> [T] {
214215
}
215216

216217
/// Returns the first and all the rest of the elements of a slice.
217-
#[unstable(feature = "slice_splits", reason = "new API", issue = "27742")]
218+
#[stable(feature = "slice_splits", since = "1.5.0")]
218219
#[inline]
219220
pub fn split_first(&self) -> Option<(&T, &[T])> {
220221
core_slice::SliceExt::split_first(self)
221222
}
222223

223224
/// Returns the first and all the rest of the elements of a slice.
224-
#[unstable(feature = "slice_splits", reason = "new API", issue = "27742")]
225+
#[stable(feature = "slice_splits", since = "1.5.0")]
225226
#[inline]
226227
pub fn split_first_mut(&mut self) -> Option<(&mut T, &mut [T])> {
227228
core_slice::SliceExt::split_first_mut(self)
228229
}
229230

230231
/// Returns the last and all the rest of the elements of a slice.
231-
#[unstable(feature = "slice_splits", reason = "new API", issue = "27742")]
232+
#[stable(feature = "slice_splits", since = "1.5.0")]
232233
#[inline]
233234
pub fn split_last(&self) -> Option<(&T, &[T])> {
234235
core_slice::SliceExt::split_last(self)
235236

236237
}
237238

238239
/// Returns the last and all the rest of the elements of a slice.
239-
#[unstable(feature = "slice_splits", reason = "new API", issue = "27742")]
240+
#[stable(feature = "slice_splits", since = "1.5.0")]
240241
#[inline]
241242
pub fn split_last_mut(&mut self) -> Option<(&mut T, &mut [T])> {
242243
core_slice::SliceExt::split_last_mut(self)

src/libcollections/str.rs

+3-8
Original file line numberDiff line numberDiff line change
@@ -277,8 +277,7 @@ impl str {
277277
/// Takes a bytewise mutable slice from a string.
278278
///
279279
/// Same as `slice_unchecked`, but works with `&mut str` instead of `&str`.
280-
#[unstable(feature = "str_slice_mut", reason = "recently added",
281-
issue = "27793")]
280+
#[stable(feature = "str_slice_mut", since = "1.5.0")]
282281
#[inline]
283282
pub unsafe fn slice_mut_unchecked(&mut self, begin: usize, end: usize) -> &mut str {
284283
core_str::StrExt::slice_mut_unchecked(self, begin, end)
@@ -1192,9 +1191,7 @@ impl str {
11921191
/// let v: Vec<_> = "ababa".match_indices("aba").collect();
11931192
/// assert_eq!(v, [(0, "aba")]); // only the first `aba`
11941193
/// ```
1195-
#[unstable(feature = "str_match_indices",
1196-
reason = "might have its iterator type changed",
1197-
issue = "27743")]
1194+
#[stable(feature = "str_match_indices", since = "1.5.0")]
11981195
pub fn match_indices<'a, P: Pattern<'a>>(&'a self, pat: P) -> MatchIndices<'a, P> {
11991196
core_str::StrExt::match_indices(self, pat)
12001197
}
@@ -1231,9 +1228,7 @@ impl str {
12311228
/// let v: Vec<_> = "ababa".rmatch_indices("aba").collect();
12321229
/// assert_eq!(v, [(2, "aba")]); // only the last `aba`
12331230
/// ```
1234-
#[unstable(feature = "str_match_indices",
1235-
reason = "might have its iterator type changed",
1236-
issue = "27743")]
1231+
#[stable(feature = "str_match_indices", since = "1.5.0")]
12371232
pub fn rmatch_indices<'a, P: Pattern<'a>>(&'a self, pat: P) -> RMatchIndices<'a, P>
12381233
where P::Searcher: ReverseSearcher<'a>
12391234
{

src/libcollections/string.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -1131,9 +1131,7 @@ impl ops::DerefMut for String {
11311131
}
11321132

11331133
/// Error returned from `String::from`
1134-
#[unstable(feature = "str_parse_error", reason = "may want to be replaced with \
1135-
Void if it ever exists",
1136-
issue = "27734")]
1134+
#[stable(feature = "str_parse_error", since = "1.5.0")]
11371135
#[derive(Copy)]
11381136
pub enum ParseError {}
11391137

src/libcollections/vec.rs

+1-5
Original file line numberDiff line numberDiff line change
@@ -865,8 +865,6 @@ impl<T: Clone> Vec<T> {
865865
/// # Examples
866866
///
867867
/// ```
868-
/// #![feature(vec_resize)]
869-
///
870868
/// let mut vec = vec!["hello"];
871869
/// vec.resize(3, "world");
872870
/// assert_eq!(vec, ["hello", "world", "world"]);
@@ -875,9 +873,7 @@ impl<T: Clone> Vec<T> {
875873
/// vec.resize(2, 0);
876874
/// assert_eq!(vec, [1, 2]);
877875
/// ```
878-
#[unstable(feature = "vec_resize",
879-
reason = "matches collection reform specification; waiting for dust to settle",
880-
issue = "27790")]
876+
#[stable(feature = "vec_resize", since = "1.5.0")]
881877
pub fn resize(&mut self, new_len: usize, value: T) {
882878
let len = self.len();
883879

0 commit comments

Comments
 (0)