Skip to content

Commit 7523af9

Browse files
committed
Note that it is a bug if you can write your own better black_box
1 parent 5ae50d3 commit 7523af9

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

library/core/src/hint.rs

+5
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,11 @@ pub fn spin_loop() {
322322
///
323323
/// </div>
324324
///
325+
/// You should not be able to write a better `black_box` than the standard library provides. If you
326+
/// can write a function that looks like `black_box` but is more effective at hiding the value of
327+
/// the argument from optimizations, that would be a bug and should be reported. It just would not
328+
/// be a *security* bug.
329+
///
325330
/// [`std::convert::identity`]: crate::convert::identity
326331
///
327332
/// # When is this useful?

0 commit comments

Comments
 (0)