about summary refs log tree commit diff
path: root/src/liballoc
diff options
context:
space:
mode:
authorScott McMurray <scottmcm@users.noreply.github.com>2019-02-02 01:32:56 -0800
committerScott McMurray <scottmcm@users.noreply.github.com>2019-02-12 22:26:44 -0800
commit317f15304e6091a1f3cc58c52d36df037ef50db0 (patch)
treea5b15c8e0da3f104cb96ff09237740eb4afbc11a /src/liballoc
parent3777b86f9b79306d16982ed693a5e4634be13a0e (diff)
downloadrust-317f15304e6091a1f3cc58c52d36df037ef50db0.tar.gz
rust-317f15304e6091a1f3cc58c52d36df037ef50db0.zip
Revert "Remove mentions of unstable sort_by_cached key from stable documentation"
This reverts commit 9c7b69e17909ceb090a1c4b8882a4e0924a2a755.
Diffstat (limited to 'src/liballoc')
-rw-r--r--src/liballoc/slice.rs4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/liballoc/slice.rs b/src/liballoc/slice.rs
index 1f68efd019b..f4b2d463778 100644
--- a/src/liballoc/slice.rs
+++ b/src/liballoc/slice.rs
@@ -257,6 +257,10 @@ impl<T> [T] {
     /// This sort is stable (i.e., does not reorder equal elements) and `O(m n log(m n))`
     /// worst-case, where the key function is `O(m)`.
     ///
+    /// For expensive key functions (e.g. functions that are not simple property accesses or
+    /// basic operations), [`sort_by_cached_key`](#method.sort_by_cached_key) is likely to be
+    /// significantly faster, as it does not recompute element keys.
+    ///
     /// When applicable, unstable sorting is preferred because it is generally faster than stable
     /// sorting and it doesn't allocate auxiliary memory.
     /// See [`sort_unstable_by_key`](#method.sort_unstable_by_key).