From d02f1667652fd26b64514d02d79a10892c96c805 Mon Sep 17 00:00:00 2001 From: Jim Turner Date: Mon, 23 Sep 2019 22:12:35 -0400 Subject: [PATCH] Restrict panic testing to when std is enabled --- src/lib.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 7146002..28855f4 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -438,10 +438,12 @@ fn clamp_test() { #[test] fn clamp_nan_bound() { - /// When debug assertions are enabled, checks that the expression panics. + /// When debug assertions and the `std` feature are enabled, checks that + /// the expression panics. macro_rules! assert_debug_panics { ($body:expr) => { - if cfg!(debug_assertions) { + #[cfg(all(debug_assertions, feature = "std"))] + { if let Ok(v) = ::std::panic::catch_unwind(|| $body) { panic!( "assertion failed: should_panic; non-panicking result: {:?}",