diff --git a/src/macros.rs b/src/macros.rs index 382e568..49ed9ca 100644 --- a/src/macros.rs +++ b/src/macros.rs @@ -95,29 +95,32 @@ macro_rules! fmt_bits { #[allow(unused_macros)] macro_rules! unreachable_unchecked { - ($($arg:tt)+) => { - crate::unreachable_unchecked!(@inner , format_args!(": {}", format_args!($($arg)*))) + (@inner $msg:expr) => { + { + #[cfg(debug_assertions)] { + panic!( + "internal error: entered unreachable code{}\n\n\ + /!\\ EXTREMELY SERIOUS WARNING /!\\\n + This code should NEVER be entered; in release mode, this would \ + have been an `unreachable_unchecked` hint. The fact that this \ + occurred means something VERY bad is going on. \n\ + Please contact the `thingbuf` maintainers immediately. Sorry!", + $msg, + ); + } + #[cfg(not(debug_assertions))] + unsafe { + core::hint::unreachable_unchecked(); + } + + } }; - () => { - crate::unreachable_unchecked!(@inner ".") + ($($arg:tt)+) => { + unreachable_unchecked!(@inner format_args!(": {}", format_args!($($arg)*))) }; - (@inner $msg:expr) => { - #[cfg(debug_assertions)] { - panic!( - "internal error: entered unreachable code{}\n\n\ - /!\\ EXTREMELY SERIOUS WARNING /!\\\n - This code should NEVER be entered; in release mode, this would \ - have been an `unreachable_unchecked` hint. The fact that this \ - occurred means something VERY bad is going on. \n\ - Please contact the `thingbuf` maintainers immediately. Sorry!", - $msg, - ); - } - #[cfg(not(debug_assertions))] - unsafe { - core::hint::unreachable_unchecked(); - } + () => { + unreachable_unchecked!(@inner ".") }; }