@@ -2928,10 +2928,17 @@ impl<T> [T] {
2928
2928
/// This sort is unstable (i.e., may reorder equal elements), in-place (i.e., does not
2929
2929
/// allocate), and *O*(*n* \* log(*n*)) worst-case.
2930
2930
///
2931
- /// If the implementation of [`Ord`] for `T` does not implement a [total order] the resulting
2932
- /// order of elements in the slice is unspecified. All original elements will remain in the
2933
- /// slice and any possible modifications via interior mutability are observed in the input. Same
2934
- /// is true if the implementation of [`Ord`] for `T` panics.
2931
+ /// If the implementation of [`Ord`] for `T` does not implement a [total order], the function
2932
+ /// may panic; even if the function exits normally, the resulting order of elements in the slice
2933
+ /// is unspecified. See also the note on panicking below.
2934
+ ///
2935
+ /// For example `|a, b| (a - b).cmp(a)` is a comparison function that is neither transitive nor
2936
+ /// reflexive nor total, `a < b < c < a` with `a = 1, b = 2, c = 3`. For more information and
2937
+ /// examples see the [`Ord`] documentation.
2938
+ ///
2939
+ ///
2940
+ /// All original elements will remain in the slice and any possible modifications via interior
2941
+ /// mutability are observed in the input. Same is true if the implementation of [`Ord`] for `T` panics.
2935
2942
///
2936
2943
/// Sorting types that only implement [`PartialOrd`] such as [`f32`] and [`f64`] require
2937
2944
/// additional precautions. For example, `f32::NAN != f32::NAN`, which doesn't fulfill the
@@ -2954,7 +2961,8 @@ impl<T> [T] {
2954
2961
///
2955
2962
/// # Panics
2956
2963
///
2957
- /// May panic if the implementation of [`Ord`] for `T` does not implement a [total order].
2964
+ /// May panic if the implementation of [`Ord`] for `T` does not implement a [total order], or if
2965
+ /// the [`Ord`] implementation panics.
2958
2966
///
2959
2967
/// # Examples
2960
2968
///
@@ -2982,15 +2990,17 @@ impl<T> [T] {
2982
2990
/// This sort is unstable (i.e., may reorder equal elements), in-place (i.e., does not
2983
2991
/// allocate), and *O*(*n* \* log(*n*)) worst-case.
2984
2992
///
2985
- /// If the comparison function `compare` does not implement a [total order] the resulting order
2986
- /// of elements in the slice is unspecified. All original elements will remain in the slice and
2987
- /// any possible modifications via interior mutability are observed in the input. Same is true
2988
- /// if `compare` panics.
2993
+ /// If the comparison function `compare` does not implement a [total order], the function
2994
+ /// may panic; even if the function exits normally, the resulting order of elements in the slice
2995
+ /// is unspecified. See also the note on panicking below.
2989
2996
///
2990
2997
/// For example `|a, b| (a - b).cmp(a)` is a comparison function that is neither transitive nor
2991
2998
/// reflexive nor total, `a < b < c < a` with `a = 1, b = 2, c = 3`. For more information and
2992
2999
/// examples see the [`Ord`] documentation.
2993
3000
///
3001
+ /// All original elements will remain in the slice and any possible modifications via interior
3002
+ /// mutability are observed in the input. Same is true if `compare` panics.
3003
+ ///
2994
3004
/// # Current implementation
2995
3005
///
2996
3006
/// The current implementation is based on [ipnsort] by Lukas Bergdoll and Orson Peters, which
@@ -3003,7 +3013,8 @@ impl<T> [T] {
3003
3013
///
3004
3014
/// # Panics
3005
3015
///
3006
- /// May panic if `compare` does not implement a [total order].
3016
+ /// May panic if the `compare` does not implement a [total order], or if
3017
+ /// the `compare` itself panics.
3007
3018
///
3008
3019
/// # Examples
3009
3020
///
@@ -3034,10 +3045,16 @@ impl<T> [T] {
3034
3045
/// This sort is unstable (i.e., may reorder equal elements), in-place (i.e., does not
3035
3046
/// allocate), and *O*(*n* \* log(*n*)) worst-case.
3036
3047
///
3037
- /// If the implementation of [`Ord`] for `K` does not implement a [total order] the resulting
3038
- /// order of elements in the slice is unspecified. All original elements will remain in the
3039
- /// slice and any possible modifications via interior mutability are observed in the input. Same
3040
- /// is true if the implementation of [`Ord`] for `K` panics.
3048
+ /// If the implementation of [`Ord`] for `K` does not implement a [total order], the function
3049
+ /// may panic; even if the function exits normally, the resulting order of elements in the slice
3050
+ /// is unspecified. See also the note on panicking below.
3051
+ ///
3052
+ /// For example `|a, b| (a - b).cmp(a)` is a comparison function that is neither transitive nor
3053
+ /// reflexive nor total, `a < b < c < a` with `a = 1, b = 2, c = 3`. For more information and
3054
+ /// examples see the [`Ord`] documentation.
3055
+ ///
3056
+ /// All original elements will remain in the slice and any possible modifications via interior
3057
+ /// mutability are observed in the input. Same is true if the implementation of [`Ord`] for `K` panics.
3041
3058
///
3042
3059
/// # Current implementation
3043
3060
///
@@ -3051,7 +3068,8 @@ impl<T> [T] {
3051
3068
///
3052
3069
/// # Panics
3053
3070
///
3054
- /// May panic if the implementation of [`Ord`] for `K` does not implement a [total order].
3071
+ /// May panic if the implementation of [`Ord`] for `K` does not implement a [total order], or if
3072
+ /// the [`Ord`] implementation panics.
3055
3073
///
3056
3074
/// # Examples
3057
3075
///
0 commit comments