/// Binds the given expression to the given pattern, or else executes
/// `debug_assert!(false);` with a helpful panic message and returns.
macro_rules! assume {
    ($pattern:pat, $value:expr) => {
        // The expression might change each time it's evaluated, so we
        // have to bind it so that we can reuse it in the panic message.
        let _value = $value;

        let $pattern = _value else {
            debug_assert!(
                false,
                "assertion `left matches right` failed:
 left: {}
right: {:?}",
                stringify!($pattern),
                _value
            );
            return;
        };
    };
}

pub(crate) use assume;