Macro kernel::build_error[][src]

macro_rules! build_error {
    () => { ... };
    ($msg:expr) => { ... };
}
Expand description

Fails the build if the code path calling build_error! can possibly be executed.

If the macro is executed in const context, build_error! will panic. If the compiler or optimizer cannot guarantee that build_error! can never be called, a build error will be triggered.

Examples

#[inline]
fn foo(a: usize) -> usize {
    a.checked_add(1).unwrap_or_else(|| build_error!("overflow"))
}