macro
debug_assert_ne! — Check inequality during diagnostic builds
Require inequality when debug assertions are enabled. Use it for optional diagnostic checks of internal assumptions; use assert_ne! or explicit error handling for a difference that must be enforced in every build. Expression result: (). Expected result (not executed): stdout: 'Pair: 2, 5\n'; no stderr. Common mistake: Relying on debug_assert_ne! to reject a prohibited production input.
Formal Syntax & Structure
rust syntaxrust
debug_assert_ne!(left, right) or debug_assert_ne!(left, right, "message", arguments...)Working Example
Example Snippetrust
fn main() { let active = 2; let standby = 5; debug_assert_ne!(active, standby); println!("Pair: {active}, {standby}");}