Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /// Uses `unreachable!()` in debug mode but `std::hint::unreachable_unchecked()`
- /// in release mode.
- unsafe fn unreachable_debug() {
- #[cfg(debug_assertions)]
- unreachable!();
- #[cfg(not(debug_assertions))]
- std::hint::unreachable_unchecked();
- }
- fn main() {
- match 1 {
- 1 => {},
- _ => unsafe { unreachable_debug() },
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement