mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 14:55:26 +00:00
Improve panic sections for sort*, sort_unstable* and select_nth_unstable*
- Move panic information into # Panics section - Fix mentions of T: Ord that should be compare - Add missing information
This commit is contained in:
parent
644550f3de
commit
00ce238885
@ -199,7 +199,9 @@ impl<T> [T] {
|
||||
/// handled without allocation, medium sized slices allocate `self.len()` and beyond that it
|
||||
/// clamps at `self.len() / 2`.
|
||||
///
|
||||
/// If `T: Ord` does not implement a total order, the implementation may panic.
|
||||
/// # Panics
|
||||
///
|
||||
/// May panic if `T: Ord` does not implement a total order.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
@ -258,7 +260,9 @@ impl<T> [T] {
|
||||
/// handled without allocation, medium sized slices allocate `self.len()` and beyond that it
|
||||
/// clamps at `self.len() / 2`.
|
||||
///
|
||||
/// If `T: Ord` does not implement a total order, the implementation may panic.
|
||||
/// # Panics
|
||||
///
|
||||
/// May panic if `compare` does not implement a total order.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
@ -304,7 +308,9 @@ impl<T> [T] {
|
||||
/// handled without allocation, medium sized slices allocate `self.len()` and beyond that it
|
||||
/// clamps at `self.len() / 2`.
|
||||
///
|
||||
/// If `K: Ord` does not implement a total order, the implementation may panic.
|
||||
/// # Panics
|
||||
///
|
||||
/// May panic if `K: Ord` does not implement a total order.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
@ -356,6 +362,10 @@ impl<T> [T] {
|
||||
/// In the worst case, the algorithm allocates temporary storage in a `Vec<(K, usize)>` the
|
||||
/// length of the slice.
|
||||
///
|
||||
/// # Panics
|
||||
///
|
||||
/// May panic if `K: Ord` does not implement a total order.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
|
@ -2898,7 +2898,9 @@ impl<T> [T] {
|
||||
/// It is typically faster than stable sorting, except in a few special cases, e.g., when the
|
||||
/// slice is partially sorted.
|
||||
///
|
||||
/// If `T: Ord` does not implement a total order, the implementation may panic.
|
||||
/// # Panics
|
||||
///
|
||||
/// May panic if `T: Ord` does not implement a total order.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
@ -2955,7 +2957,9 @@ impl<T> [T] {
|
||||
/// It is typically faster than stable sorting, except in a few special cases, e.g., when the
|
||||
/// slice is partially sorted.
|
||||
///
|
||||
/// If `T: Ord` does not implement a total order, the implementation may panic.
|
||||
/// # Panics
|
||||
///
|
||||
/// May panic if `compare` does not implement a total order.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
@ -2999,7 +3003,9 @@ impl<T> [T] {
|
||||
/// It is typically faster than stable sorting, except in a few special cases, e.g., when the
|
||||
/// slice is partially sorted.
|
||||
///
|
||||
/// If `K: Ord` does not implement a total order, the implementation may panic.
|
||||
/// # Panics
|
||||
///
|
||||
/// May panic if `K: Ord` does not implement a total order.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
@ -3042,15 +3048,14 @@ impl<T> [T] {
|
||||
/// Median of Medians using Tukey's Ninther for pivot selection, which guarantees linear runtime
|
||||
/// for all inputs.
|
||||
///
|
||||
/// It is typically faster than stable sorting, except in a few special cases, e.g., when the
|
||||
/// slice is nearly fully sorted, where `slice::sort` may be faster.
|
||||
///
|
||||
/// [`sort_unstable`]: slice::sort_unstable
|
||||
///
|
||||
/// # Panics
|
||||
///
|
||||
/// Panics when `index >= len()`, meaning it always panics on empty slices.
|
||||
///
|
||||
/// May panic if `T: Ord` does not implement a total order.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
@ -3103,15 +3108,14 @@ impl<T> [T] {
|
||||
/// Median of Medians using Tukey's Ninther for pivot selection, which guarantees linear runtime
|
||||
/// for all inputs.
|
||||
///
|
||||
/// It is typically faster than stable sorting, except in a few special cases, e.g., when the
|
||||
/// slice is nearly fully sorted, where `slice::sort` may be faster.
|
||||
///
|
||||
/// [`sort_unstable`]: slice::sort_unstable
|
||||
///
|
||||
/// # Panics
|
||||
///
|
||||
/// Panics when `index >= len()`, meaning it always panics on empty slices.
|
||||
///
|
||||
/// May panic if `compare` does not implement a total order.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
@ -3168,15 +3172,14 @@ impl<T> [T] {
|
||||
/// Median of Medians using Tukey's Ninther for pivot selection, which guarantees linear runtime
|
||||
/// for all inputs.
|
||||
///
|
||||
/// It is typically faster than stable sorting, except in a few special cases, e.g., when the
|
||||
/// slice is nearly fully sorted, where `slice::sort` may be faster.
|
||||
///
|
||||
/// [`sort_unstable`]: slice::sort_unstable
|
||||
///
|
||||
/// # Panics
|
||||
///
|
||||
/// Panics when `index >= len()`, meaning it always panics on empty slices.
|
||||
///
|
||||
/// May panic if `K: Ord` does not implement a total order.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
|
Loading…
Reference in New Issue
Block a user