]> git.lizzy.rs Git - rust.git/blobdiff - library/test/src/bench.rs
Merge commit '4236289b75ee55c78538c749512cdbeea5e1c332' into update-rustfmt
[rust.git] / library / test / src / bench.rs
index 169154187f2500004904fd69f2da0a336faea120..7869ba2c04178b60a28148e1c2ff296fada7745c 100644 (file)
@@ -1,6 +1,4 @@
 //! Benchmarking module.
-pub use std::hint::black_box;
-
 use super::{
     event::CompletedTest,
     options::BenchMode,
 use std::sync::{Arc, Mutex};
 use std::time::{Duration, Instant};
 
+/// An identity function that *__hints__* to the compiler to be maximally pessimistic about what
+/// `black_box` could do.
+///
+/// See [`std::hint::black_box`] for details.
+#[inline(always)]
+pub fn black_box<T>(dummy: T) -> T {
+    std::hint::black_box(dummy)
+}
+
 /// Manager of the benchmarking runs.
 ///
 /// This is fed into functions marked with `#[bench]` to allow for