From 5350e22366e059f2099af91d23350be1073ee165 Mon Sep 17 00:00:00 2001 From: Stjepan Glavina Date: Sun, 2 Jul 2017 02:09:21 +0200 Subject: Stabilize feature sort_unstable --- src/liballoc/slice.rs | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) (limited to 'src/liballoc') diff --git a/src/liballoc/slice.rs b/src/liballoc/slice.rs index 88876999d76..b0e872aeb69 100644 --- a/src/liballoc/slice.rs +++ b/src/liballoc/slice.rs @@ -1144,6 +1144,10 @@ impl [T] { /// /// This sort is stable (i.e. does not reorder equal elements) and `O(n log n)` worst-case. /// + /// When applicable, unstable sorting is preferred because it is generally faster than stable + /// sorting and it doesn't allocate auxiliary memory. + /// See [`sort_unstable`](#method.sort_unstable). + /// /// # Current implementation /// /// The current algorithm is an adaptive, iterative merge sort inspired by @@ -1174,6 +1178,10 @@ impl [T] { /// /// This sort is stable (i.e. does not reorder equal elements) and `O(n log n)` worst-case. /// + /// When applicable, unstable sorting is preferred because it is generally faster than stable + /// sorting and it doesn't allocate auxiliary memory. + /// See [`sort_unstable_by`](#method.sort_unstable_by). + /// /// # Current implementation /// /// The current algorithm is an adaptive, iterative merge sort inspired by @@ -1207,6 +1215,10 @@ impl [T] { /// /// This sort is stable (i.e. does not reorder equal elements) and `O(n log n)` worst-case. /// + /// When applicable, unstable sorting is preferred because it is generally faster than stable + /// sorting and it doesn't allocate auxiliary memory. + /// See [`sort_unstable_by_key`](#method.sort_unstable_by_key). + /// /// # Current implementation /// /// The current algorithm is an adaptive, iterative merge sort inspired by @@ -1251,8 +1263,6 @@ impl [T] { /// # Examples /// /// ``` - /// #![feature(sort_unstable)] - /// /// let mut v = [-5, 4, 1, -3, 2]; /// /// v.sort_unstable(); @@ -1260,8 +1270,7 @@ impl [T] { /// ``` /// /// [pdqsort]: https://github.com/orlp/pdqsort - // FIXME #40585: Mention `sort_unstable` in the documentation for `sort`. - #[unstable(feature = "sort_unstable", issue = "40585")] + #[stable(feature = "sort_unstable", since = "1.20.0")] #[inline] pub fn sort_unstable(&mut self) where T: Ord @@ -1288,8 +1297,6 @@ impl [T] { /// # Examples /// /// ``` - /// #![feature(sort_unstable)] - /// /// let mut v = [5, 4, 1, 3, 2]; /// v.sort_unstable_by(|a, b| a.cmp(b)); /// assert!(v == [1, 2, 3, 4, 5]); @@ -1300,8 +1307,7 @@ impl [T] { /// ``` /// /// [pdqsort]: https://github.com/orlp/pdqsort - // FIXME #40585: Mention `sort_unstable_by` in the documentation for `sort_by`. - #[unstable(feature = "sort_unstable", issue = "40585")] + #[stable(feature = "sort_unstable", since = "1.20.0")] #[inline] pub fn sort_unstable_by(&mut self, compare: F) where F: FnMut(&T, &T) -> Ordering @@ -1328,8 +1334,6 @@ impl [T] { /// # Examples /// /// ``` - /// #![feature(sort_unstable)] - /// /// let mut v = [-5i32, 4, 1, -3, 2]; /// /// v.sort_unstable_by_key(|k| k.abs()); @@ -1337,8 +1341,7 @@ impl [T] { /// ``` /// /// [pdqsort]: https://github.com/orlp/pdqsort - // FIXME #40585: Mention `sort_unstable_by_key` in the documentation for `sort_by_key`. - #[unstable(feature = "sort_unstable", issue = "40585")] + #[stable(feature = "sort_unstable", since = "1.20.0")] #[inline] pub fn sort_unstable_by_key(&mut self, f: F) where F: FnMut(&T) -> B, -- cgit 1.4.1-3-g733a5 From 21149bcd530e3dcd817a9cc2053f3a6b82b7a379 Mon Sep 17 00:00:00 2001 From: Stjepan Glavina Date: Sun, 2 Jul 2017 19:14:16 +0200 Subject: Fix lint errors --- src/liballoc/lib.rs | 1 - 1 file changed, 1 deletion(-) (limited to 'src/liballoc') diff --git a/src/liballoc/lib.rs b/src/liballoc/lib.rs index 6f4e300fd3c..8bdf93fd2ed 100644 --- a/src/liballoc/lib.rs +++ b/src/liballoc/lib.rs @@ -83,7 +83,6 @@ #![cfg_attr(not(test), feature(core_float))] #![cfg_attr(not(test), feature(exact_size_is_empty))] #![cfg_attr(not(test), feature(slice_rotate))] -#![cfg_attr(not(test), feature(sort_unstable))] #![cfg_attr(not(test), feature(str_checked_slicing))] #![cfg_attr(test, feature(rand, test))] #![feature(allocator)] -- cgit 1.4.1-3-g733a5 From 66f8cddae55ae3699932b424823dc21cfa566e6b Mon Sep 17 00:00:00 2001 From: Stjepan Glavina Date: Sun, 2 Jul 2017 21:29:39 +0200 Subject: Remove the remaining feature gates --- src/liballoc/benches/lib.rs | 1 - src/libcore/tests/lib.rs | 1 - src/librustc/lib.rs | 1 - src/librustc_incremental/lib.rs | 1 - src/librustc_metadata/lib.rs | 1 - 5 files changed, 5 deletions(-) (limited to 'src/liballoc') diff --git a/src/liballoc/benches/lib.rs b/src/liballoc/benches/lib.rs index 958020d0b0e..5a5eb846b73 100644 --- a/src/liballoc/benches/lib.rs +++ b/src/liballoc/benches/lib.rs @@ -14,7 +14,6 @@ #![feature(rand)] #![feature(repr_simd)] #![feature(slice_rotate)] -#![feature(sort_unstable)] #![feature(test)] extern crate test; diff --git a/src/libcore/tests/lib.rs b/src/libcore/tests/lib.rs index 337f8aa31dc..b0a57d97d5e 100644 --- a/src/libcore/tests/lib.rs +++ b/src/libcore/tests/lib.rs @@ -34,7 +34,6 @@ #![feature(slice_patterns)] #![feature(slice_rotate)] #![feature(sort_internals)] -#![feature(sort_unstable)] #![feature(specialization)] #![feature(step_by)] #![feature(step_trait)] diff --git a/src/librustc/lib.rs b/src/librustc/lib.rs index b81c56e5ee8..e4cf893375c 100644 --- a/src/librustc/lib.rs +++ b/src/librustc/lib.rs @@ -39,7 +39,6 @@ #![feature(specialization)] #![feature(unboxed_closures)] #![feature(discriminant_value)] -#![feature(sort_unstable)] #![feature(trace_macros)] #![feature(test)] diff --git a/src/librustc_incremental/lib.rs b/src/librustc_incremental/lib.rs index 5bd7a24bdaf..ac3149b90b8 100644 --- a/src/librustc_incremental/lib.rs +++ b/src/librustc_incremental/lib.rs @@ -20,7 +20,6 @@ #![feature(rand)] #![feature(conservative_impl_trait)] -#![feature(sort_unstable)] extern crate graphviz; #[macro_use] extern crate rustc; diff --git a/src/librustc_metadata/lib.rs b/src/librustc_metadata/lib.rs index 12997f24c74..99b718ea07b 100644 --- a/src/librustc_metadata/lib.rs +++ b/src/librustc_metadata/lib.rs @@ -26,7 +26,6 @@ #![feature(specialization)] #![feature(discriminant_value)] #![feature(rustc_private)] -#![feature(sort_unstable)] #[macro_use] extern crate log; -- cgit 1.4.1-3-g733a5