Panic! At The Compiler
Operating on invalid data often leaves your program in a bad state. It’s best in these situations to abort, especially when your code is safety-critical. For unrecoverable errors, Rust has the panic! macro to print a failure message, unwind the stack, and exit: