From f501775ec8af20bad208ad9b5772342180696d85 Mon Sep 17 00:00:00 2001 From: Ben Kimock Date: Sat, 26 Apr 2025 13:20:17 -0400 Subject: [PATCH] Indicate that the warning on black_box is a general property of Rust And note that the same limitation applies to all LLVM-based compilers Co-authored-by: Ralf Jung --- library/core/src/hint.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/library/core/src/hint.rs b/library/core/src/hint.rs index 1ca23ab6eea66..207b6c9b71f0a 100644 --- a/library/core/src/hint.rs +++ b/library/core/src/hint.rs @@ -320,6 +320,10 @@ pub fn spin_loop() { /// This also means that this function does not offer any guarantees for cryptographic or security /// purposes. /// +/// This limitation is not specific to `black_box`; there is no mechanism in the entire Rust +/// language that can provide the guarantees required for constant-time cryptography. +/// (There is also no such mechanism in LLVM, so the same is true for every other LLVM-based compiler.) +/// /// /// /// [`std::convert::identity`]: crate::convert::identity