about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMatthias Krüger <476013+matthiaskrgr@users.noreply.github.com>2025-05-08 20:22:13 +0200
committerGitHub <noreply@github.com>2025-05-08 20:22:13 +0200
commit32e3207969a3bf08748a5e76cf35af2d52b6040b (patch)
tree1e5d04321f04333804d38be70ca6afb3b70f08bf
parent6914d83de9c2866b18222f09a4e174b72f1c0cfc (diff)
parentf501775ec8af20bad208ad9b5772342180696d85 (diff)
downloadrust-32e3207969a3bf08748a5e76cf35af2d52b6040b.tar.gz
rust-32e3207969a3bf08748a5e76cf35af2d52b6040b.zip
Rollup merge of #140341 - saethlin:black-box-qoi, r=Mark-Simulacrum
Clarify black_box warning a bit

Trying to bring the docs on black_box more in line with the advice that we have discussed in Zulip.

https://github.com/rust-lang/rust/pull/140341#issuecomment-2832592382
-rw-r--r--library/core/src/hint.rs4
1 files changed, 4 insertions, 0 deletions
diff --git a/library/core/src/hint.rs b/library/core/src/hint.rs
index 394a3ea6778..cb83540c4ea 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.)
+///
 /// </div>
 ///
 /// [`std::convert::identity`]: crate::convert::identity