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") + } }