Macro always_assert::never[][src]

macro_rules! never {
    (true $($tt:tt)*) => { ... };
    (false $($tt:tt)*) => { ... };
    () => { ... };
    ($fmt:literal $(, $($arg:tt)*)?) => { ... };
    ($cond:expr) => { ... };
    ($cond:expr, $fmt:literal $($arg:tt)*) => { ... };
}

Asserts that the condition is never true and returns its actual value.

If the condition is false does nothing and and evaluates to false.

If the condition is true:

  • panics if force feature or debug_assertions are enabled,
  • logs an error if log feature is enabled,
  • evaluates to true.

Accepts format! style arguments.

Empty condition is equivalent to false:

never!("oups") ~= unreachable!("oups")