From 085e41171fa8d299a942aa182d1b5902a441f908 Mon Sep 17 00:00:00 2001 From: i509VCB Date: Tue, 1 Nov 2022 00:21:22 -0500 Subject: [PATCH] use debug_assert_** with not(feature = "strict_asserts") strict_asserts should at least validate with the debug_assert_** family of macros in debug builds. Otherwise undefined behavior can sneak by. --- wgpu-core/src/assertions.rs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/wgpu-core/src/assertions.rs b/wgpu-core/src/assertions.rs index 98e8bd8797..95b6ac78d0 100644 --- a/wgpu-core/src/assertions.rs +++ b/wgpu-core/src/assertions.rs @@ -35,15 +35,21 @@ macro_rules! strict_assert_ne { #[cfg(not(feature = "strict_asserts"))] #[macro_export] macro_rules! strict_assert { - ( $( $arg:tt )* ) => {}; + ( $( $arg:tt )* ) => { + debug_assert!( $( $arg )* ) + }; } #[cfg(not(feature = "strict_asserts"))] macro_rules! strict_assert_eq { - ( $( $arg:tt )* ) => {}; + ( $( $arg:tt )* ) => { + debug_assert_eq!( $( $arg )* ) + }; } #[cfg(not(feature = "strict_asserts"))] macro_rules! strict_assert_ne { - ( $( $arg:tt )* ) => {}; + ( $( $arg:tt )* ) => { + debug_assert_ne!( $( $arg )* ) + }; }