File tree Expand file tree Collapse file tree 2 files changed +13
-7
lines changed
Expand file tree Collapse file tree 2 files changed +13
-7
lines changed Original file line number Diff line number Diff line change @@ -35,9 +35,11 @@ pub macro panic_2015 {
3535 ( "{}" , $arg: expr $( , ) ?) => (
3636 $crate:: panicking:: panic_display ( & $arg)
3737 ) ,
38- ( $fmt: expr, $( $arg: tt) +) => (
39- $crate:: panicking:: panic_fmt ( $crate:: const_format_args!( $fmt, $( $arg) +) )
40- ) ,
38+ ( $fmt: expr, $( $arg: tt) +) => ( {
39+ // Semicolon to prevent temporaries inside the formatting machinery from
40+ // being considered alive in the caller after the panic_fmt call.
41+ $crate:: panicking:: panic_fmt ( $crate:: const_format_args!( $fmt, $( $arg) +) ) ;
42+ } ) ,
4143}
4244
4345#[ doc ( hidden) ]
@@ -53,9 +55,11 @@ pub macro panic_2021 {
5355 ( "{}" , $arg: expr $( , ) ?) => (
5456 $crate:: panicking:: panic_display ( & $arg)
5557 ) ,
56- ( $( $t: tt) +) => (
57- $crate:: panicking:: panic_fmt ( $crate:: const_format_args!( $( $t) +) )
58- ) ,
58+ ( $( $t: tt) +) => ( {
59+ // Semicolon to prevent temporaries inside the formatting machinery from
60+ // being considered alive in the caller after the panic_fmt call.
61+ $crate:: panicking:: panic_fmt ( $crate:: const_format_args!( $( $t) +) ) ;
62+ } ) ,
5963}
6064
6165#[ doc ( hidden) ]
Original file line number Diff line number Diff line change @@ -26,7 +26,9 @@ pub macro panic_2015 {
2626 $crate:: rt:: panic_display ( & $arg)
2727 } ) ,
2828 ( $fmt: expr, $( $arg: tt) +) => ( {
29- $crate:: rt:: panic_fmt ( $crate:: const_format_args!( $fmt, $( $arg) +) )
29+ // Semicolon to prevent temporaries inside the formatting machinery from
30+ // being considered alive in the caller after the panic_fmt call.
31+ $crate:: rt:: panic_fmt ( $crate:: const_format_args!( $fmt, $( $arg) +) ) ;
3032 } ) ,
3133}
3234
You can’t perform that action at this time.
0 commit comments