Skip to main content

black_box

Function black_box 

Source
pub fn black_box<T>(dummy: T) -> T
Expand description

A function that is opaque to the optimizer, used to prevent the compiler from optimizing away computations in a benchmark.

Now that std::hint::black_box is stable this is a thin forwarding wrapper; prefer calling std::hint::black_box directly. Retained only for existing call sites and can be removed once they migrate.