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
This commit is contained in:
Matthias Krüger 2025-05-08 20:22:13 +02:00 committed by GitHub
commit 32e3207969
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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