mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 23:04:33 +00:00
Shorten lifetime of even more panic temporaries
This commit is contained in:
parent
0ebb5cbab6
commit
2f5d993945
@ -28,13 +28,13 @@ pub macro panic_2015 {
|
||||
$crate::panicking::panic($msg)
|
||||
),
|
||||
// Use `panic_str` instead of `panic_display::<&str>` for non_fmt_panic lint.
|
||||
($msg:expr $(,)?) => (
|
||||
$crate::panicking::panic_str($msg)
|
||||
),
|
||||
($msg:expr $(,)?) => ({
|
||||
$crate::panicking::panic_str($msg);
|
||||
}),
|
||||
// Special-case the single-argument case for const_panic.
|
||||
("{}", $arg:expr $(,)?) => (
|
||||
$crate::panicking::panic_display(&$arg)
|
||||
),
|
||||
("{}", $arg:expr $(,)?) => ({
|
||||
$crate::panicking::panic_display(&$arg);
|
||||
}),
|
||||
($fmt:expr, $($arg:tt)+) => ({
|
||||
// Semicolon to prevent temporaries inside the formatting machinery from
|
||||
// being considered alive in the caller after the panic_fmt call.
|
||||
@ -52,9 +52,9 @@ pub macro panic_2021 {
|
||||
$crate::panicking::panic("explicit panic")
|
||||
),
|
||||
// Special-case the single-argument case for const_panic.
|
||||
("{}", $arg:expr $(,)?) => (
|
||||
$crate::panicking::panic_display(&$arg)
|
||||
),
|
||||
("{}", $arg:expr $(,)?) => ({
|
||||
$crate::panicking::panic_display(&$arg);
|
||||
}),
|
||||
($($t:tt)+) => ({
|
||||
// Semicolon to prevent temporaries inside the formatting machinery from
|
||||
// being considered alive in the caller after the panic_fmt call.
|
||||
@ -73,9 +73,9 @@ pub macro unreachable_2015 {
|
||||
),
|
||||
// Use of `unreachable_display` for non_fmt_panic lint.
|
||||
// NOTE: the message ("internal error ...") is embedded directly in unreachable_display
|
||||
($msg:expr $(,)?) => (
|
||||
$crate::panicking::unreachable_display(&$msg)
|
||||
),
|
||||
($msg:expr $(,)?) => ({
|
||||
$crate::panicking::unreachable_display(&$msg);
|
||||
}),
|
||||
($fmt:expr, $($arg:tt)*) => (
|
||||
$crate::panic!($crate::concat!("internal error: entered unreachable code: ", $fmt), $($arg)*)
|
||||
),
|
||||
|
@ -19,11 +19,11 @@ pub macro panic_2015 {
|
||||
$crate::rt::begin_panic("explicit panic")
|
||||
}),
|
||||
($msg:expr $(,)?) => ({
|
||||
$crate::rt::begin_panic($msg)
|
||||
$crate::rt::begin_panic($msg);
|
||||
}),
|
||||
// Special-case the single-argument case for const_panic.
|
||||
("{}", $arg:expr $(,)?) => ({
|
||||
$crate::rt::panic_display(&$arg)
|
||||
$crate::rt::panic_display(&$arg);
|
||||
}),
|
||||
($fmt:expr, $($arg:tt)+) => ({
|
||||
// Semicolon to prevent temporaries inside the formatting machinery from
|
||||
|
Loading…
Reference in New Issue
Block a user