1#![allow(dead_code)]
2#![allow(unused_macros)]
3#![allow(unused_imports)]
4
5pub(crate) struct NumAssert<const L: usize, const R: usize>;
6
7#[allow(clippy::erasing_op)]
8impl<const L: usize, const R: usize> NumAssert<L, R> {
9 pub const LEQ: usize = R - L;
10 pub const LT: usize = R - L - 1;
11}
12
13macro_rules! num_assert_leq {
14 ($a:expr, $b:expr) => {
15 #[allow(path_statements)]
16 #[allow(clippy::no_effect)]
17 {
18 $crate::util::NumAssert::<{ $a }, { $b }>::LEQ;
19 }
20 };
21}
22
23macro_rules! num_assert_lt {
24 ($a:expr, $b:expr) => {
25 #[allow(path_statements)]
26 #[allow(clippy::no_effect)]
27 {
28 $crate::util::NumAssert::<{ $a }, { $b }>::LT;
29 }
30 };
31}
32
33pub(crate) use num_assert_leq;
34pub(crate) use num_assert_lt;
35
36macro_rules! debug_checked_assume {
43 ($ex:expr) => {
44 if (!$ex) {
45 debug_assert!(false);
46 ::std::hint::unreachable_unchecked();
47 }
48 };
49}
50
51macro_rules! debug_checked_unreachable {
58 () => {
59 debug_assert!(false);
60 ::std::hint::unreachable_unchecked();
61 };
62}
63
64pub(crate) use debug_checked_assume;
65pub(crate) use debug_checked_unreachable;