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 2022-11-01 00:21:22 -05:00 committed by Connor Fitzgerald
parent 51b34c5b51
commit 085e41171f

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 )* )
};
}