diff options
| author | David Tolnay <dtolnay@gmail.com> | 2022-11-07 13:23:16 -0800 |
|---|---|---|
| committer | David Tolnay <dtolnay@gmail.com> | 2023-05-14 07:27:20 -0700 |
| commit | cb109a672d161ee305d21c98edb84ef50c6f997b (patch) | |
| tree | 5148385ff4e4a1bb9f03487d6907143020e6c9bc /library/std/src/panic.rs | |
| parent | cbee2a1ec44dcc49a0a10b713d6b5dac66cd7ba6 (diff) | |
| download | rust-cb109a672d161ee305d21c98edb84ef50c6f997b.tar.gz rust-cb109a672d161ee305d21c98edb84ef50c6f997b.zip | |
Shorten lifetime of panic temporaries in panic_fmt case
Diffstat (limited to 'library/std/src/panic.rs')
| -rw-r--r-- | library/std/src/panic.rs | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/library/std/src/panic.rs b/library/std/src/panic.rs index 345d72ef867..a2ffd8b1e7e 100644 --- a/library/std/src/panic.rs +++ b/library/std/src/panic.rs @@ -26,7 +26,9 @@ pub macro panic_2015 { $crate::rt::panic_display(&$arg) }), ($fmt:expr, $($arg:tt)+) => ({ - $crate::rt::panic_fmt($crate::const_format_args!($fmt, $($arg)+)) + // Semicolon to prevent temporaries inside the formatting machinery from + // being considered alive in the caller after the panic_fmt call. + $crate::rt::panic_fmt($crate::const_format_args!($fmt, $($arg)+)); }), } |
