Skip to content

Commit 1d2db7b

Browse files
committedJul 2, 2017
Auto merge of #43010 - stjepang:stabilize-sort-unstable, r=alexcrichton
Stabilize feature sort_unstable Closes #40585
2 parents 0679711 + 66f8cdd commit 1d2db7b

File tree

10 files changed

+20
-63
lines changed

10 files changed

+20
-63
lines changed
 

‎src/doc/unstable-book/src/library-features/sort-unstable.md

-40
This file was deleted.

‎src/liballoc/benches/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
#![feature(rand)]
1515
#![feature(repr_simd)]
1616
#![feature(slice_rotate)]
17-
#![feature(sort_unstable)]
1817
#![feature(test)]
1918

2019
extern crate rand;

‎src/liballoc/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,6 @@
8383
#![cfg_attr(not(test), feature(core_float))]
8484
#![cfg_attr(not(test), feature(exact_size_is_empty))]
8585
#![cfg_attr(not(test), feature(slice_rotate))]
86-
#![cfg_attr(not(test), feature(sort_unstable))]
8786
#![cfg_attr(not(test), feature(str_checked_slicing))]
8887
#![cfg_attr(test, feature(rand, test))]
8988
#![feature(allocator)]

‎src/liballoc/slice.rs

+15-12
Original file line numberDiff line numberDiff line change
@@ -1144,6 +1144,10 @@ impl<T> [T] {
11441144
///
11451145
/// This sort is stable (i.e. does not reorder equal elements) and `O(n log n)` worst-case.
11461146
///
1147+
/// When applicable, unstable sorting is preferred because it is generally faster than stable
1148+
/// sorting and it doesn't allocate auxiliary memory.
1149+
/// See [`sort_unstable`](#method.sort_unstable).
1150+
///
11471151
/// # Current implementation
11481152
///
11491153
/// The current algorithm is an adaptive, iterative merge sort inspired by
@@ -1174,6 +1178,10 @@ impl<T> [T] {
11741178
///
11751179
/// This sort is stable (i.e. does not reorder equal elements) and `O(n log n)` worst-case.
11761180
///
1181+
/// When applicable, unstable sorting is preferred because it is generally faster than stable
1182+
/// sorting and it doesn't allocate auxiliary memory.
1183+
/// See [`sort_unstable_by`](#method.sort_unstable_by).
1184+
///
11771185
/// # Current implementation
11781186
///
11791187
/// The current algorithm is an adaptive, iterative merge sort inspired by
@@ -1207,6 +1215,10 @@ impl<T> [T] {
12071215
///
12081216
/// This sort is stable (i.e. does not reorder equal elements) and `O(n log n)` worst-case.
12091217
///
1218+
/// When applicable, unstable sorting is preferred because it is generally faster than stable
1219+
/// sorting and it doesn't allocate auxiliary memory.
1220+
/// See [`sort_unstable_by_key`](#method.sort_unstable_by_key).
1221+
///
12101222
/// # Current implementation
12111223
///
12121224
/// The current algorithm is an adaptive, iterative merge sort inspired by
@@ -1251,17 +1263,14 @@ impl<T> [T] {
12511263
/// # Examples
12521264
///
12531265
/// ```
1254-
/// #![feature(sort_unstable)]
1255-
///
12561266
/// let mut v = [-5, 4, 1, -3, 2];
12571267
///
12581268
/// v.sort_unstable();
12591269
/// assert!(v == [-5, -3, 1, 2, 4]);
12601270
/// ```
12611271
///
12621272
/// [pdqsort]: https://github.com/orlp/pdqsort
1263-
// FIXME #40585: Mention `sort_unstable` in the documentation for `sort`.
1264-
#[unstable(feature = "sort_unstable", issue = "40585")]
1273+
#[stable(feature = "sort_unstable", since = "1.20.0")]
12651274
#[inline]
12661275
pub fn sort_unstable(&mut self)
12671276
where T: Ord
@@ -1288,8 +1297,6 @@ impl<T> [T] {
12881297
/// # Examples
12891298
///
12901299
/// ```
1291-
/// #![feature(sort_unstable)]
1292-
///
12931300
/// let mut v = [5, 4, 1, 3, 2];
12941301
/// v.sort_unstable_by(|a, b| a.cmp(b));
12951302
/// assert!(v == [1, 2, 3, 4, 5]);
@@ -1300,8 +1307,7 @@ impl<T> [T] {
13001307
/// ```
13011308
///
13021309
/// [pdqsort]: https://github.com/orlp/pdqsort
1303-
// FIXME #40585: Mention `sort_unstable_by` in the documentation for `sort_by`.
1304-
#[unstable(feature = "sort_unstable", issue = "40585")]
1310+
#[stable(feature = "sort_unstable", since = "1.20.0")]
13051311
#[inline]
13061312
pub fn sort_unstable_by<F>(&mut self, compare: F)
13071313
where F: FnMut(&T, &T) -> Ordering
@@ -1328,17 +1334,14 @@ impl<T> [T] {
13281334
/// # Examples
13291335
///
13301336
/// ```
1331-
/// #![feature(sort_unstable)]
1332-
///
13331337
/// let mut v = [-5i32, 4, 1, -3, 2];
13341338
///
13351339
/// v.sort_unstable_by_key(|k| k.abs());
13361340
/// assert!(v == [1, 2, -3, 4, -5]);
13371341
/// ```
13381342
///
13391343
/// [pdqsort]: https://github.com/orlp/pdqsort
1340-
// FIXME #40585: Mention `sort_unstable_by_key` in the documentation for `sort_by_key`.
1341-
#[unstable(feature = "sort_unstable", issue = "40585")]
1344+
#[stable(feature = "sort_unstable", since = "1.20.0")]
13421345
#[inline]
13431346
pub fn sort_unstable_by_key<B, F>(&mut self, f: F)
13441347
where F: FnMut(&T) -> B,

‎src/libcore/slice/mod.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -212,15 +212,15 @@ pub trait SliceExt {
212212
#[stable(feature = "copy_from_slice", since = "1.9.0")]
213213
fn copy_from_slice(&mut self, src: &[Self::Item]) where Self::Item: Copy;
214214

215-
#[unstable(feature = "sort_unstable", issue = "40585")]
215+
#[stable(feature = "sort_unstable", since = "1.20.0")]
216216
fn sort_unstable(&mut self)
217217
where Self::Item: Ord;
218218

219-
#[unstable(feature = "sort_unstable", issue = "40585")]
219+
#[stable(feature = "sort_unstable", since = "1.20.0")]
220220
fn sort_unstable_by<F>(&mut self, compare: F)
221221
where F: FnMut(&Self::Item, &Self::Item) -> Ordering;
222222

223-
#[unstable(feature = "sort_unstable", issue = "40585")]
223+
#[stable(feature = "sort_unstable", since = "1.20.0")]
224224
fn sort_unstable_by_key<B, F>(&mut self, f: F)
225225
where F: FnMut(&Self::Item) -> B,
226226
B: Ord;

‎src/libcore/slice/sort.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,7 @@ fn partition_in_blocks<T, F>(v: &mut [T], pivot: &T, is_less: &mut F) -> usize
351351

352352
if start_l < end_l {
353353
// The left block remains.
354-
// Move it's remaining out-of-order elements to the far right.
354+
// Move its remaining out-of-order elements to the far right.
355355
debug_assert_eq!(width(l, r), block_l);
356356
while start_l < end_l {
357357
unsafe {
@@ -363,7 +363,7 @@ fn partition_in_blocks<T, F>(v: &mut [T], pivot: &T, is_less: &mut F) -> usize
363363
width(v.as_mut_ptr(), r)
364364
} else if start_r < end_r {
365365
// The right block remains.
366-
// Move it's remaining out-of-order elements to the far left.
366+
// Move its remaining out-of-order elements to the far left.
367367
debug_assert_eq!(width(l, r), block_r);
368368
while start_r < end_r {
369369
unsafe {

‎src/libcore/tests/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@
3434
#![feature(slice_patterns)]
3535
#![feature(slice_rotate)]
3636
#![feature(sort_internals)]
37-
#![feature(sort_unstable)]
3837
#![feature(specialization)]
3938
#![feature(step_by)]
4039
#![feature(step_trait)]

‎src/librustc/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@
3939
#![feature(specialization)]
4040
#![feature(unboxed_closures)]
4141
#![feature(discriminant_value)]
42-
#![feature(sort_unstable)]
4342
#![feature(trace_macros)]
4443
#![feature(test)]
4544

‎src/librustc_incremental/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020

2121
#![feature(rand)]
2222
#![feature(conservative_impl_trait)]
23-
#![feature(sort_unstable)]
2423

2524
extern crate graphviz;
2625
#[macro_use] extern crate rustc;

‎src/librustc_metadata/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
#![feature(specialization)]
2727
#![feature(discriminant_value)]
2828
#![feature(rustc_private)]
29-
#![feature(sort_unstable)]
3029

3130
#[macro_use]
3231
extern crate log;

0 commit comments

Comments
 (0)
Please sign in to comment.