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

Panics if reached when debug assertions are enabled.

This is a variant of the standard library’s unreachable! macro that is controlled by cfg!(debug_assertions). For builds without debug assertions enabled (such as typical release builds), it is a no-op.

Example

use more_asserts as ma;

let mut value = 0.5;
if value < 0.0 {
    ma::debug_unreachable!("Value out of range {}", value);
    value = 0.0;
}