Skip to content

Instantly share code, notes, and snippets.

@DutchGhost
Created October 7, 2020 20:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DutchGhost/2d44c00c03444c2921c4f66357f17890 to your computer and use it in GitHub Desktop.
Save DutchGhost/2d44c00c03444c2921c4f66357f17890 to your computer and use it in GitHub Desktop.
Constant unreachable function
#[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