Macro more_asserts::debug_unreachable[][src]

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

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

#[macro_use]
extern crate more_asserts;

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