core::debug_assert_eq! [-] [+] [src]

macro_rules! debug_assert_eq {
    ($($arg:tt)*) => (if cfg!(not(ndebug)) { assert_eq!($($arg)*); })
}

Asserts that two expressions are equal to each other, testing equality in both directions.

On panic, this macro will print the values of the expressions.

Unlike assert_eq!, debug_assert_eq! statements can be disabled by passing --cfg ndebug to the compiler. This makes debug_assert_eq! useful for checks that are too expensive to be present in a release build but may be helpful during development.

Example

fn main() { let a = 3; let b = 1 + 2; debug_assert_eq!(a, b); }
let a = 3;
let b = 1 + 2;
debug_assert_eq!(a, b);