diff --git a/library/core/src/hint.rs b/library/core/src/hint.rs index f6708cc4bc912..32d696ae37a4f 100644 --- a/library/core/src/hint.rs +++ b/library/core/src/hint.rs @@ -735,9 +735,9 @@ pub const fn cold_path() { crate::intrinsics::cold_path() } -/// Returns either `true_val` or `false_val` depending on the value of `b`, -/// with a hint to the compiler that `b` is unlikely to be correctly -/// predicted by a CPU’s branch predictor. +/// Returns either `true_val` or `false_val` depending on the value of +/// `condition`, with a hint to the compiler that `condition` is unlikely to be +/// correctly predicted by a CPU’s branch predictor. /// /// This method is functionally equivalent to /// ```ignore (this is just for illustrative purposes) @@ -753,9 +753,9 @@ pub const fn cold_path() { /// search. /// /// Note however that this lowering is not guaranteed (on any platform) and -/// should not be relied upon when trying to write constant-time code. Also -/// be aware that this lowering might *decrease* performance if `condition` -/// is well-predictable. It is advisable to perform benchmarks to tell if +/// should not be relied upon when trying to write cryptographic constant-time +/// code. Also be aware that this lowering might *decrease* performance if +/// `condition` is well-predictable. It is advisable to perform benchmarks to tell if /// this function is useful. /// /// # Examples @@ -780,6 +780,6 @@ pub const fn cold_path() { /// ``` #[inline(always)] #[unstable(feature = "select_unpredictable", issue = "133962")] -pub fn select_unpredictable(b: bool, true_val: T, false_val: T) -> T { - crate::intrinsics::select_unpredictable(b, true_val, false_val) +pub fn select_unpredictable(condition: bool, true_val: T, false_val: T) -> T { + crate::intrinsics::select_unpredictable(condition, true_val, false_val) } diff --git a/tests/codegen/intrinsics/select_unpredictable.rs b/tests/codegen/intrinsics/select_unpredictable.rs index 2db4ae174b333..813882635523e 100644 --- a/tests/codegen/intrinsics/select_unpredictable.rs +++ b/tests/codegen/intrinsics/select_unpredictable.rs @@ -20,6 +20,7 @@ pub fn test_pair(p: bool, a: (u64, u64), b: (u64, u64)) -> (u64, u64) { core::intrinsics::select_unpredictable(p, a, b) } +#[derive(Copy)] struct Large { e: [u64; 100], }