Skip to content
masterclass Buddy

Rust · Macro

panic!

panic! stops the current thread and reports a formatted message. Use it for detected program bugs, not ordinary failures that callers should handle with Result.

Last updated

Since
1.0.0

Syntax

macro_rules! panic { ($($arg:tt)*) => { ... }; }

In-depth API docs are only for subscribers: parameters, examples, common mistakes and interview practice.

Subscribe
  • Result
  • Option::unwrap
  • Result::unwrap
  • std::panic::panic_any
  • std::panic::set_hook
  • compile_error!

Source: panic in std - Rust. Checked 2026-11-03.