[][src]Macro static_assertions::const_assert_ne

macro_rules! const_assert_ne {
    ($x:expr, $($xs:expr),+ $(,)*) => { ... };
    ($label:ident; $x:expr, $($xs:expr),+ $(,)*) => { ... };
}

Asserts that constants are not equal in value.

Examples

Works as a shorthand for const_assert!(a != b):

const_assert_ne!(nums; 1, 2, 3, 4);

fn main() {
    const NUM: usize = 32;
    const_assert_ne!(NUM * NUM, 64);
}

The magic number 2, where 2 × 2 = 2 + 2:

This example deliberately fails to compile
const_assert_ne!(2 + 2, 2 * 2);