#[doc(hidden)] pub macro const_panic {
($const_msg:literal, $runtime_msg:literal, $($arg:ident : $ty:ty = $val:expr),* $(,)?) => { ... },
($const_msg:literal, $runtime_msg:literal, $($arg:ident : $ty:ty),* $(,)?) => { ... },
}
🔬This is a nightly-only experimental API. (
panic_internals
)Expand description
Helper macro for panicking in a const fn
.
Invoke as:
ⓘ
core::macros::const_panic!("boring message", "flavored message {a} {b:?}", a: u32 = foo.len(), b: Something = bar);
where the first message will be printed in const-eval, and the second message will be printed at runtime.