Skip to content

Commit ab7e01e

Browse files
authored
Rollup merge of #108416 - pat-nel87:Issue-107957-black_box_docs, r=jyn514
black_box doc corrections for clarification - Issue #107957 Made a complete pass through the docs to help resolve #107957 No code changes, just documentation `@rustbot` label +T-libs-api -T-libs
2 parents adaac6b + af489af commit ab7e01e

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 and, in some cases, may
227-
/// do 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)