Created
October 7, 2020 20:06
-
-
Save DutchGhost/2d44c00c03444c2921c4f66357f17890 to your computer and use it in GitHub Desktop.
Constant unreachable function
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#[inline(always)] | |
#[track_caller] | |
const unsafe fn unreachable() -> ! { | |
#[derive(Copy, Clone)] | |
enum Void {} | |
const NEVER: *const Void = [].as_ptr(); | |
match *NEVER {} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment