From b23f7c45f708ed168196b31439e38cf35573985a Mon Sep 17 00:00:00 2001 From: Bradlee Speice Date: Thu, 6 Dec 2018 23:11:48 -0500 Subject: [PATCH] Handle release mode compiler seeing through us --- tests/assert_macro.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/assert_macro.rs b/tests/assert_macro.rs index 78b7e9f..a2935d1 100644 --- a/tests/assert_macro.rs +++ b/tests/assert_macro.rs @@ -21,6 +21,11 @@ fn into_box() -> Box { #[test] #[should_panic] fn early_return_boxing() { - into_box(); + if cfg!(debug_assertions) { + // The release-mode compiler is able to optimize through the Box + into_box(); + } else { + panic!("Intentional") + } }