Rollup merge of #137484 - chenyukang:yukang-fix-sort-doc, r=Noratrieb
Fix documentation for unstable sort on slice Fixes #136665
This commit is contained in:
commit
8a8c0e25c9
@ -2928,10 +2928,17 @@ impl<T> [T] {
|
||||
/// This sort is unstable (i.e., may reorder equal elements), in-place (i.e., does not
|
||||
/// allocate), and *O*(*n* \* log(*n*)) worst-case.
|
||||
///
|
||||
/// If the implementation of [`Ord`] for `T` does not implement a [total order] the resulting
|
||||
/// order of elements in the slice is unspecified. All original elements will remain in the
|
||||
/// slice and any possible modifications via interior mutability are observed in the input. Same
|
||||
/// is true if the implementation of [`Ord`] for `T` panics.
|
||||
/// If the implementation of [`Ord`] for `T` does not implement a [total order], the function
|
||||
/// may panic; even if the function exits normally, the resulting order of elements in the slice
|
||||
/// is unspecified. See also the note on panicking below.
|
||||
///
|
||||
/// For example `|a, b| (a - b).cmp(a)` is a comparison function that is neither transitive nor
|
||||
/// reflexive nor total, `a < b < c < a` with `a = 1, b = 2, c = 3`. For more information and
|
||||
/// examples see the [`Ord`] documentation.
|
||||
///
|
||||
///
|
||||
/// All original elements will remain in the slice and any possible modifications via interior
|
||||
/// mutability are observed in the input. Same is true if the implementation of [`Ord`] for `T` panics.
|
||||
///
|
||||
/// Sorting types that only implement [`PartialOrd`] such as [`f32`] and [`f64`] require
|
||||
/// additional precautions. For example, `f32::NAN != f32::NAN`, which doesn't fulfill the
|
||||
@ -2954,7 +2961,8 @@ impl<T> [T] {
|
||||
///
|
||||
/// # Panics
|
||||
///
|
||||
/// May panic if the implementation of [`Ord`] for `T` does not implement a [total order].
|
||||
/// May panic if the implementation of [`Ord`] for `T` does not implement a [total order], or if
|
||||
/// the [`Ord`] implementation panics.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
@ -2982,15 +2990,17 @@ impl<T> [T] {
|
||||
/// This sort is unstable (i.e., may reorder equal elements), in-place (i.e., does not
|
||||
/// allocate), and *O*(*n* \* log(*n*)) worst-case.
|
||||
///
|
||||
/// If the comparison function `compare` does not implement a [total order] the resulting order
|
||||
/// of elements in the slice is unspecified. All original elements will remain in the slice and
|
||||
/// any possible modifications via interior mutability are observed in the input. Same is true
|
||||
/// if `compare` panics.
|
||||
/// If the comparison function `compare` does not implement a [total order], the function
|
||||
/// may panic; even if the function exits normally, the resulting order of elements in the slice
|
||||
/// is unspecified. See also the note on panicking below.
|
||||
///
|
||||
/// For example `|a, b| (a - b).cmp(a)` is a comparison function that is neither transitive nor
|
||||
/// reflexive nor total, `a < b < c < a` with `a = 1, b = 2, c = 3`. For more information and
|
||||
/// examples see the [`Ord`] documentation.
|
||||
///
|
||||
/// All original elements will remain in the slice and any possible modifications via interior
|
||||
/// mutability are observed in the input. Same is true if `compare` panics.
|
||||
///
|
||||
/// # Current implementation
|
||||
///
|
||||
/// The current implementation is based on [ipnsort] by Lukas Bergdoll and Orson Peters, which
|
||||
@ -3003,7 +3013,8 @@ impl<T> [T] {
|
||||
///
|
||||
/// # Panics
|
||||
///
|
||||
/// May panic if `compare` does not implement a [total order].
|
||||
/// May panic if the `compare` does not implement a [total order], or if
|
||||
/// the `compare` itself panics.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
@ -3034,10 +3045,16 @@ impl<T> [T] {
|
||||
/// This sort is unstable (i.e., may reorder equal elements), in-place (i.e., does not
|
||||
/// allocate), and *O*(*n* \* log(*n*)) worst-case.
|
||||
///
|
||||
/// If the implementation of [`Ord`] for `K` does not implement a [total order] the resulting
|
||||
/// order of elements in the slice is unspecified. All original elements will remain in the
|
||||
/// slice and any possible modifications via interior mutability are observed in the input. Same
|
||||
/// is true if the implementation of [`Ord`] for `K` panics.
|
||||
/// If the implementation of [`Ord`] for `K` does not implement a [total order], the function
|
||||
/// may panic; even if the function exits normally, the resulting order of elements in the slice
|
||||
/// is unspecified. See also the note on panicking below.
|
||||
///
|
||||
/// For example `|a, b| (a - b).cmp(a)` is a comparison function that is neither transitive nor
|
||||
/// reflexive nor total, `a < b < c < a` with `a = 1, b = 2, c = 3`. For more information and
|
||||
/// examples see the [`Ord`] documentation.
|
||||
///
|
||||
/// All original elements will remain in the slice and any possible modifications via interior
|
||||
/// mutability are observed in the input. Same is true if the implementation of [`Ord`] for `K` panics.
|
||||
///
|
||||
/// # Current implementation
|
||||
///
|
||||
@ -3051,7 +3068,8 @@ impl<T> [T] {
|
||||
///
|
||||
/// # Panics
|
||||
///
|
||||
/// May panic if the implementation of [`Ord`] for `K` does not implement a [total order].
|
||||
/// May panic if the implementation of [`Ord`] for `K` does not implement a [total order], or if
|
||||
/// the [`Ord`] implementation panics.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
|
Loading…
x
Reference in New Issue
Block a user