We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 67be0e6 commit e501deaCopy full SHA for e501dea
src/lib.rs
@@ -45,6 +45,19 @@ macro_rules! const_fn {
45
};
46
}
47
48
+// Helper method for assert! in const fn. Uses out of bounds indexing if an
49
+// assertion fails and the "const_fn" feature is not enabled.
50
+#[cfg(feature = "const_fn")]
51
+macro_rules! const_assert {
52
+ ($cond:expr, $($arg:tt)+) => { assert!($cond, $($arg)*) };
53
+}
54
+#[cfg(not(feature = "const_fn"))]
55
56
+ ($cond:expr, $($arg:tt)+) => {
57
+ [(); 1][!($cond as bool) as usize]
58
+ };
59
60
+
61
#[cfg(all(feature = "instructions", feature = "external_asm"))]
62
pub(crate) mod asm;
63
0 commit comments