Skip to content

Commit

Permalink
Rollup merge of #111974 - Sp00ph:update_guarantees, r=Amanieu
Browse files Browse the repository at this point in the history
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`
  • Loading branch information
matthiaskrgr authored Jun 14, 2023
2 parents b8f71ea + 62ee9e1 commit c451f7b
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions library/core/src/slice/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2995,7 +2995,7 @@ impl<T> [T] {
/// This reordering has the additional property that any value at position `i < index` will be
/// less than or equal to any value at a position `j > index`. Additionally, this reordering is
/// unstable (i.e. any number of equal elements may end up at position `index`), in-place
/// (i.e. does not allocate), and *O*(*n*) on average. The worst-case performance is *O*(*n* log *n*).
/// (i.e. does not allocate), and runs in *O*(*n*) time.
/// This function is also known as "kth element" in other libraries.
///
/// It returns a triplet of the following from the reordered slice:
Expand Down Expand Up @@ -3045,9 +3045,8 @@ impl<T> [T] {
/// This reordering has the additional property that any value at position `i < index` will be
/// less than or equal to any value at a position `j > index` using the comparator function.
/// Additionally, this reordering is unstable (i.e. any number of equal elements may end up at
/// position `index`), in-place (i.e. does not allocate), and *O*(*n*) on average.
/// The worst-case performance is *O*(*n* log *n*). This function is also known as
/// "kth element" in other libraries.
/// position `index`), in-place (i.e. does not allocate), and runs in *O*(*n*) time.
/// This function is also known as "kth element" in other libraries.
///
/// It returns a triplet of the following from
/// the slice reordered according to the provided comparator function: the subslice prior to
Expand Down Expand Up @@ -3101,8 +3100,7 @@ impl<T> [T] {
/// This reordering has the additional property that any value at position `i < index` will be
/// less than or equal to any value at a position `j > index` using the key extraction function.
/// Additionally, this reordering is unstable (i.e. any number of equal elements may end up at
/// position `index`), in-place (i.e. does not allocate), and *O*(*n*) on average.
/// The worst-case performance is *O*(*n* log *n*).
/// position `index`), in-place (i.e. does not allocate), and runs in *O*(*n*) time.
/// This function is also known as "kth element" in other libraries.
///
/// It returns a triplet of the following from
Expand Down

0 comments on commit c451f7b

Please sign in to comment.