Skip to content

Commit 21549da

Browse files
authored
black_box hint - Adjust for improved readability
1 parent 6f7ca32 commit 21549da

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

library/core/src/hint.rs

+3-6
Original file line numberDiff line numberDiff line change
@@ -217,17 +217,14 @@ pub fn spin_loop() {
217217
/// Note however, that `black_box` is only (and can only be) provided on a "best-effort" basis. The
218218
/// extent to which it can block optimisations may vary depending upon the platform and code-gen
219219
/// backend used. Programs cannot rely on `black_box` for *correctness*, beyond it behaving as the
220-
/// identity function.
220+
/// identity function. As such, it **must not be relied upon to control critical program behavior.**
221+
/// This _immediately_ precludes any direct use of this function for cryptographic or security
222+
/// purposes.
221223
///
222224
/// [`std::convert::identity`]: crate::convert::identity
223225
///
224226
/// # When is this useful?
225227
///
226-
/// First and foremost: `black_box` does _not_ guarantee any exact behavior beyond behaving as the identity function
227-
/// and, in some cases, does nothing at all. As such, it **must not be relied upon to control critical program behavior.**
228-
/// This _immediately_ precludes any direct use of this function for cryptographic or security
229-
/// purposes.
230-
///
231228
/// While not suitable in those mission-critical cases, `black_box`'s functionality can generally be
232229
/// relied upon for benchmarking, and should be used there. It will try to ensure that the
233230
/// compiler doesn't optimize away part of the intended test code based on context. For

0 commit comments

Comments
 (0)