diff options
| author | pat-nel87 <71235856+pat-nel87@users.noreply.github.com> | 2023-03-07 18:32:58 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-03-07 18:32:58 -0500 |
| commit | 21549dac539dc220f052d038ec643645cedbbd6d (patch) | |
| tree | af6040a49306e586167b227df3c246c1c05ecd70 | |
| parent | 6f7ca32ae7f5cd9159a986ca0c30b77420cce933 (diff) | |
| download | rust-21549dac539dc220f052d038ec643645cedbbd6d.tar.gz rust-21549dac539dc220f052d038ec643645cedbbd6d.zip | |
black_box hint - Adjust for improved readability
| -rw-r--r-- | library/core/src/hint.rs | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/library/core/src/hint.rs b/library/core/src/hint.rs index f90077eecd1..a35f4e029a2 100644 --- a/library/core/src/hint.rs +++ b/library/core/src/hint.rs @@ -217,17 +217,14 @@ pub fn spin_loop() { /// Note however, that `black_box` is only (and can only be) provided on a "best-effort" basis. The /// extent to which it can block optimisations may vary depending upon the platform and code-gen /// backend used. Programs cannot rely on `black_box` for *correctness*, beyond it behaving as the -/// identity function. +/// identity function. As such, it **must not be relied upon to control critical program behavior.** +/// This _immediately_ precludes any direct use of this function for cryptographic or security +/// purposes. /// /// [`std::convert::identity`]: crate::convert::identity /// /// # When is this useful? /// -/// First and foremost: `black_box` does _not_ guarantee any exact behavior beyond behaving as the identity function -/// and, in some cases, does nothing at all. As such, it **must not be relied upon to control critical program behavior.** -/// This _immediately_ precludes any direct use of this function for cryptographic or security -/// purposes. -/// /// While not suitable in those mission-critical cases, `black_box`'s functionality can generally be /// relied upon for benchmarking, and should be used there. It will try to ensure that the /// compiler doesn't optimize away part of the intended test code based on context. For |
