std::assert

Macro std::assert

macro_rules! assert {
    ( $ cond : expr ) => { ... };
    (
$ cond : expr , $ ( $ arg : tt ) + ) => { ... };
}

Ensure that a boolean expression is true at runtime.

This will invoke the panic! macro if the provided expression cannot be evaluated to true at runtime.

Assertions are always checked in both debug and release builds, and cannot be disabled. See debug_assert! for assertions that are not enabled in release builds by default.

Unsafe code relies on assert! to enforce run-time invariants that, if violated could lead to unsafety.

Other use-cases of assert! include testing and enf