about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorVillSnow <vill.snow@gmail.com>2020-06-28 16:45:56 +0900
committerVillSnow <vill.snow@gmail.com>2020-06-28 16:45:56 +0900
commitd720a19e2a0526794999997db399dd5d7521bd78 (patch)
tree9d6a9e7855be76cc47578c3d6ce8c8f37a6201c0 /src
parent83d599826f890fd991687e17a1b389bcdf3d2f65 (diff)
downloadrust-d720a19e2a0526794999997db399dd5d7521bd78.tar.gz
rust-d720a19e2a0526794999997db399dd5d7521bd78.zip
Update doc comment
Diffstat (limited to 'src')
-rw-r--r--src/libcore/slice/mod.rs16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/libcore/slice/mod.rs b/src/libcore/slice/mod.rs
index cd4967e10e4..11561c39286 100644
--- a/src/libcore/slice/mod.rs
+++ b/src/libcore/slice/mod.rs
@@ -2664,13 +2664,17 @@ impl<T> [T] {
         self.iter().is_sorted_by_key(f)
     }
 
-    /// Returns index of partition point according to the given predicate,
-    /// such that all those that return true precede the index and
-    /// such that all those that return false succeed the index.
+    /// Returns the index of the partition point according to the given predicate
+    // (the index of the first element of the second partition).
     ///
-    /// The slice must be partitioned
-    /// so that all elements where the predicate returns true
-    /// precede the elements where the predicate returns false.
+    /// The slice is assumed to be partitioned according to the given predicate.
+    /// This means that all elements for which the predicate returns true are at the start of the slice
+    /// and all elements for which the predicate returns false are at the end.
+    /// For example, [7, 15, 3, 5, 4, 12, 6] is a partitioned under the predicate x % 2 != 0
+    /// (all odd numbers are at the start, all even at the end).
+    ///
+    /// If this slice is not partitioned, the returned result is unspecified and meaningless,
+    /// as this method performs a kind of binary search.
     ///
     /// # Examples
     ///