Allow panic!("{}", computed_str)
in const fn.
This commit is contained in:
parent
c3c0f80d60
commit
11c0e58c74
14 changed files with 135 additions and 46 deletions
|
@ -10,7 +10,7 @@ use crate::thread::Result;
|
|||
|
||||
#[doc(hidden)]
|
||||
#[unstable(feature = "edition_panic", issue = "none", reason = "use panic!() instead")]
|
||||
#[allow_internal_unstable(libstd_sys_internals, const_format_args)]
|
||||
#[allow_internal_unstable(libstd_sys_internals, const_format_args, core_panic)]
|
||||
#[cfg_attr(not(test), rustc_diagnostic_item = "std_panic_2015_macro")]
|
||||
#[rustc_macro_transparency = "semitransparent"]
|
||||
pub macro panic_2015 {
|
||||
|
@ -20,6 +20,10 @@ pub macro panic_2015 {
|
|||
($msg:expr $(,)?) => ({
|
||||
$crate::rt::begin_panic($msg)
|
||||
}),
|
||||
// Special-case the single-argument case for const_panic.
|
||||
("{}", $arg:expr $(,)?) => ({
|
||||
$crate::rt::panic_display(&$arg)
|
||||
}),
|
||||
($fmt:expr, $($arg:tt)+) => ({
|
||||
$crate::rt::begin_panic_fmt(&$crate::const_format_args!($fmt, $($arg)+))
|
||||
}),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue