From f10a7ea095a0760084f0129fcfb4ab18788d7d0b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Kr=C3=B6ning?= Date: Thu, 2 Jan 2025 13:54:56 +0100 Subject: [PATCH] fix(tests): `dead_code` --- tests/basic_math.rs | 6 ------ tests/common/mod.rs | 8 -------- 2 files changed, 14 deletions(-) diff --git a/tests/basic_math.rs b/tests/basic_math.rs index 2ca982250a..29d3c49ea3 100644 --- a/tests/basic_math.rs +++ b/tests/basic_math.rs @@ -18,12 +18,6 @@ use core::hint::black_box; use common::exit; -// Either use black_box from core::hint or the value_fence definition -// core hint is a nop, but possibly only prevents dead code elimination -// value_fence has higher overhead but should be a bit safer regarding preventing optimizations -// pub fn black_box(x: T) -> T { -// common::value_fence::(x) -// } mod common; #[test_case] diff --git a/tests/common/mod.rs b/tests/common/mod.rs index b6294b86dc..6ffda05422 100644 --- a/tests/common/mod.rs +++ b/tests/common/mod.rs @@ -275,11 +275,3 @@ macro_rules! runtime_entry_with_args { } }; } - -//adapted from: https://rust-lang.github.io/rfcs/2360-bench-black-box.html -#[inline(always)] -pub fn value_fence(x: T) -> T { - let y = unsafe { (&x as *const T).read_volatile() }; - //std::hint::forget(x); - doesn't exist (anymore) - y -}