From 9baf47963d9e608553c3c0850b5ce3941fc55a6c Mon Sep 17 00:00:00 2001 From: oxalica Date: Mon, 14 Oct 2024 19:08:50 -0400 Subject: [PATCH] feat(blahd): fail on test features + release build This is a best-effort check for accidental misuse of testing-only features on release build. --- blahd/src/utils.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/blahd/src/utils.rs b/blahd/src/utils.rs index caf8ec2..965d7a8 100644 --- a/blahd/src/utils.rs +++ b/blahd/src/utils.rs @@ -8,6 +8,11 @@ pub use std::time::{Instant, SystemTime}; #[cfg(feature = "unsafe_use_mock_instant_for_testing")] pub use mock_instant::thread_local::{Instant, SystemTime}; +#[cfg(all(feature = "unsafe_use_mock_instant_for_testing", not(debug_assertions)))] +compile_error!( + "`unsafe_use_mock_instant_for_testing` feature must not be enabled in release build", +); + #[derive(Debug)] pub struct ExpiringSet { set: HashSet,