W3cubDocs

/Rust

Function std::hint::black_box

pub fn black_box<T>(dummy: T) -> T
🔬 This is a nightly-only experimental API. (test #27812)

A function that is opaque to the optimizer, to allow benchmarks to pretend to use outputs to assist in avoiding dead-code elimination.

This function is a no-op, and does not even read from dummy.

© 2010 The Rust Project Developers
Licensed under the Apache License, Version 2.0 or the MIT license, at your option.
https://doc.rust-lang.org/std/hint/fn.black_box.html