about summary refs log tree commit diff
path: root/library/core/src/bool.rs
diff options
context:
space:
mode:
Diffstat (limited to 'library/core/src/bool.rs')
-rw-r--r--library/core/src/bool.rs8
1 files changed, 5 insertions, 3 deletions
diff --git a/library/core/src/bool.rs b/library/core/src/bool.rs
index b9590dcc1e7..5c9b0e28106 100644
--- a/library/core/src/bool.rs
+++ b/library/core/src/bool.rs
@@ -62,12 +62,14 @@ impl bool {
     }
 
     /// Returns either `true_val` or `false_val` depending on the value of
-    /// `condition`, with a hint to the compiler that `condition` is unlikely
+    /// `self`, with a hint to the compiler that `self` is unlikely
     /// to be correctly predicted by a CPU’s branch predictor.
     ///
-    /// This method is functionally equivalent to writing
+    /// This method is functionally equivalent to
     /// ```ignore (this is just for illustrative purposes)
-    /// if b { true_val } else { false_val }
+    /// fn select_unpredictable<T>(b: bool, true_val: T, false_val: T) -> T {
+    ///     if b { true_val } else { false_val }
+    /// }
     /// ```
     /// but might generate different assembly. In particular, on platforms with
     /// a conditional move or select instruction (like `cmov` on x86 or `csel`