Skip to content

Commit c451f7b

Browse files
authored
Rollup merge of #111974 - Sp00ph:update_guarantees, r=Amanieu
Update runtime guarantee for `select_nth_unstable` #106933 changed the runtime guarantee for `select_nth_unstable` from O(n) to O(n log n), since the old guarantee wasn't actually met by the implementation at the time. Now with #107522, `select_nth_unstable` should be truly linear in runtime, so we can revert its runtime guarantee to O(n). Since #106933 was considered a bug fix, this will probably need an FCP because it counts as a new API guarantee. r? `@Amanieu`
2 parents b8f71ea + 62ee9e1 commit c451f7b

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

library/core/src/slice/mod.rs

+4-6
Original file line numberDiff line numberDiff line change
@@ -2995,7 +2995,7 @@ impl<T> [T] {
29952995
/// This reordering has the additional property that any value at position `i < index` will be
29962996
/// less than or equal to any value at a position `j > index`. Additionally, this reordering is
29972997
/// unstable (i.e. any number of equal elements may end up at position `index`), in-place
2998-
/// (i.e. does not allocate), and *O*(*n*) on average. The worst-case performance is *O*(*n* log *n*).
2998+
/// (i.e. does not allocate), and runs in *O*(*n*) time.
29992999
/// This function is also known as "kth element" in other libraries.
30003000
///
30013001
/// It returns a triplet of the following from the reordered slice:
@@ -3045,9 +3045,8 @@ impl<T> [T] {
30453045
/// This reordering has the additional property that any value at position `i < index` will be
30463046
/// less than or equal to any value at a position `j > index` using the comparator function.
30473047
/// Additionally, this reordering is unstable (i.e. any number of equal elements may end up at
3048-
/// position `index`), in-place (i.e. does not allocate), and *O*(*n*) on average.
3049-
/// The worst-case performance is *O*(*n* log *n*). This function is also known as
3050-
/// "kth element" in other libraries.
3048+
/// position `index`), in-place (i.e. does not allocate), and runs in *O*(*n*) time.
3049+
/// This function is also known as "kth element" in other libraries.
30513050
///
30523051
/// It returns a triplet of the following from
30533052
/// the slice reordered according to the provided comparator function: the subslice prior to
@@ -3101,8 +3100,7 @@ impl<T> [T] {
31013100
/// This reordering has the additional property that any value at position `i < index` will be
31023101
/// less than or equal to any value at a position `j > index` using the key extraction function.
31033102
/// Additionally, this reordering is unstable (i.e. any number of equal elements may end up at
3104-
/// position `index`), in-place (i.e. does not allocate), and *O*(*n*) on average.
3105-
/// The worst-case performance is *O*(*n* log *n*).
3103+
/// position `index`), in-place (i.e. does not allocate), and runs in *O*(*n*) time.
31063104
/// This function is also known as "kth element" in other libraries.
31073105
///
31083106
/// It returns a triplet of the following from

0 commit comments

Comments
 (0)