static_assertionsMacro const_assert_ne
Source macro_rules! const_assert_ne {
($x:expr, $y:expr $(,)?) => { ... };
}
Expand description
Asserts that constants are not equal in value.
§Examples
This works as a shorthand for const_assert!(a != b)
:
const NUM: usize = 32;
const_assert_ne!(NUM * NUM, 64);
The following example fails to compile because 2 is magic and 2 × 2 = 2 + 2:
ⓘconst_assert_ne!(2 + 2, 2 * 2);