macro_rules! assert_unchecked {
    ($e: expr, $($t: tt)*) => { ... };
}
Expand description

Expands to assert!(condition) in debug builds or if --cfg check_unreachable=true has been set in the RUST_FLAGS, and to if condition {core::hint::unreachable_unchecked()} otherwise.

This lets the compiler take advantage of the fact that the condition is always true in release builds, and optimize accordingly, while giving you the opportunity to double check this at runtime in case of doubts.

§Panics

This macro panics if the code is actually false in debug mode. This would mean that release code would be UB!

§Safety

This macro is inherently unsafe, as it can cause UB in release mode if the assertion can actually be false.