Skip to content

Commit b65b5ef

Browse files
committed
fix: add imports in code examples
1 parent 1f13be2 commit b65b5ef

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

library/core/src/hint.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,8 @@ pub fn spin_loop() {
320320
/// to the function, though.
321321
///
322322
/// ```
323+
/// # use std::hint::black_box;
324+
/// #
323325
/// // This...
324326
/// let y = black_box(5 * 10);
325327
/// // ...will still be optimized to this:
@@ -330,6 +332,8 @@ pub fn spin_loop() {
330332
/// moving the multiplication outside of `black_box`:
331333
///
332334
/// ```
335+
/// # use std::hint::black_box;
336+
/// #
333337
/// // No assumptions can be made about either number, so the multiplication is kept.
334338
/// let y = black_box(5) * black_box(10);
335339
/// ```

0 commit comments

Comments
 (0)