@@ -1144,6 +1144,10 @@ impl<T> [T] {
1144
1144
///
1145
1145
/// This sort is stable (i.e. does not reorder equal elements) and `O(n log n)` worst-case.
1146
1146
///
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
+ ///
1147
1151
/// # Current implementation
1148
1152
///
1149
1153
/// The current algorithm is an adaptive, iterative merge sort inspired by
@@ -1174,6 +1178,10 @@ impl<T> [T] {
1174
1178
///
1175
1179
/// This sort is stable (i.e. does not reorder equal elements) and `O(n log n)` worst-case.
1176
1180
///
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
+ ///
1177
1185
/// # Current implementation
1178
1186
///
1179
1187
/// The current algorithm is an adaptive, iterative merge sort inspired by
@@ -1207,6 +1215,10 @@ impl<T> [T] {
1207
1215
///
1208
1216
/// This sort is stable (i.e. does not reorder equal elements) and `O(n log n)` worst-case.
1209
1217
///
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
+ ///
1210
1222
/// # Current implementation
1211
1223
///
1212
1224
/// The current algorithm is an adaptive, iterative merge sort inspired by
@@ -1251,17 +1263,14 @@ impl<T> [T] {
1251
1263
/// # Examples
1252
1264
///
1253
1265
/// ```
1254
- /// #![feature(sort_unstable)]
1255
- ///
1256
1266
/// let mut v = [-5, 4, 1, -3, 2];
1257
1267
///
1258
1268
/// v.sort_unstable();
1259
1269
/// assert!(v == [-5, -3, 1, 2, 4]);
1260
1270
/// ```
1261
1271
///
1262
1272
/// [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" ) ]
1265
1274
#[ inline]
1266
1275
pub fn sort_unstable ( & mut self )
1267
1276
where T : Ord
@@ -1288,8 +1297,6 @@ impl<T> [T] {
1288
1297
/// # Examples
1289
1298
///
1290
1299
/// ```
1291
- /// #![feature(sort_unstable)]
1292
- ///
1293
1300
/// let mut v = [5, 4, 1, 3, 2];
1294
1301
/// v.sort_unstable_by(|a, b| a.cmp(b));
1295
1302
/// assert!(v == [1, 2, 3, 4, 5]);
@@ -1300,8 +1307,7 @@ impl<T> [T] {
1300
1307
/// ```
1301
1308
///
1302
1309
/// [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" ) ]
1305
1311
#[ inline]
1306
1312
pub fn sort_unstable_by < F > ( & mut self , compare : F )
1307
1313
where F : FnMut ( & T , & T ) -> Ordering
@@ -1328,17 +1334,14 @@ impl<T> [T] {
1328
1334
/// # Examples
1329
1335
///
1330
1336
/// ```
1331
- /// #![feature(sort_unstable)]
1332
- ///
1333
1337
/// let mut v = [-5i32, 4, 1, -3, 2];
1334
1338
///
1335
1339
/// v.sort_unstable_by_key(|k| k.abs());
1336
1340
/// assert!(v == [1, 2, -3, 4, -5]);
1337
1341
/// ```
1338
1342
///
1339
1343
/// [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" ) ]
1342
1345
#[ inline]
1343
1346
pub fn sort_unstable_by_key < B , F > ( & mut self , f : F )
1344
1347
where F : FnMut ( & T ) -> B ,
0 commit comments