macro panic($reason, $args/* ... */) { ... }

Ungracefully terminate the thread or process with an error message.

Use this macro to bail on conditions that the program cannot reasonably be expected to recover from (e.g. when a condition means a certain programming bug).

Since panics usually cannot be recovered from, prefer to use structured error handling as a general purpose failure handling mechanism.

Panicking in Alumina does not perform any stack unwinding.

See also spawn for details on how panics are handled in a multithreaded program.

When compiled in debug mode, panic prints the provided message along with the stack trace (on platforms that support it)

Example

Expressions that unconditionally panic have a never type.