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.
This commit is contained in:
i509VCB authored and Connor Fitzgerald committed 2022-11-01 04:59:24 -04:00
1 parent 51b34c5b51
commit 085e41171f
1 file changed
+9 -3
+9 -3
View File
@@ -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 )* )
};
}