From 9042d1424ce6ce9b5edc09062483df2b370b40ac Mon Sep 17 00:00:00 2001 From: Bruce Mitchener Date: Mon, 14 Aug 2023 11:01:01 +0700 Subject: [PATCH] Use std::hint::black_box consistently. This also removes the `#![feature(bench_black_box)]`. This was stabilized in Rust 1.66 and anyone building benchmarks will be on that or later (as they previously would have been on nightly). This also allows building `cargo build --all-targets` on stable Rust as it no longer dies when hitting the feature addition in the benchmarks. --- benches/core/matrix.rs | 4 ++-- benches/lib.rs | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/benches/core/matrix.rs b/benches/core/matrix.rs index 8f3d6305..ec1102b7 100644 --- a/benches/core/matrix.rs +++ b/benches/core/matrix.rs @@ -142,7 +142,7 @@ fn iter(bench: &mut criterion::Criterion) { bench.bench_function("iter", move |bh| { bh.iter(|| { for value in a.iter() { - criterion::black_box(value); + std::hint::black_box(value); } }) }); @@ -154,7 +154,7 @@ fn iter_rev(bench: &mut criterion::Criterion) { bench.bench_function("iter_rev", move |bh| { bh.iter(|| { for value in a.iter().rev() { - criterion::black_box(value); + std::hint::black_box(value); } }) }); diff --git a/benches/lib.rs b/benches/lib.rs index 1f75ff7e..d0ade4b9 100644 --- a/benches/lib.rs +++ b/benches/lib.rs @@ -1,4 +1,3 @@ -#![feature(bench_black_box)] #![allow(unused_macros)] extern crate nalgebra as na;