[][src]Macro chek::debug_unreachable

macro_rules! debug_unreachable {
    ($($arg:tt)*) => { ... };
}

Panics if reached. This is a variant of the standard library's unreachable! macro that is controlled by cfg!(debug_assertions).

Same as prelude's unreachable! in debug builds or release builds where the -C debug-assertions was provided to the compiler. For all other builds, vanishes without a trace.

Example

// You probably wouldn't actually use this here
let mut value = 0.5;
if value < 0.0 {
    chek::debug_unreachable!("Value out of range {}", value);
    value = 0.0;
}