1 /// A simple static assertion macro.
3 #[allow_internal_unstable(type_ascription, underscore_const_names)]
4 macro_rules! static_assert {
6 // Use the bool to access an array such that if the bool is false, the access
9 const _: () = [()][!($test: bool) as usize];
13 /// Type size assertion. The first argument is a type and the second argument is its expected size.
15 #[allow_internal_unstable(underscore_const_names)]
16 macro_rules! static_assert_size {
17 ($ty:ty, $size:expr) => {
18 const _: [(); $size] = [(); ::std::mem::size_of::<$ty>()];