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 {
35
35
( "{}" , $arg: expr $( , ) ?) => (
36
36
$crate:: panicking:: panic_display ( & $arg)
37
37
) ,
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
+ } ) ,
41
43
}
42
44
43
45
#[ doc ( hidden) ]
@@ -53,9 +55,11 @@ pub macro panic_2021 {
53
55
( "{}" , $arg: expr $( , ) ?) => (
54
56
$crate:: panicking:: panic_display ( & $arg)
55
57
) ,
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
+ } ) ,
59
63
}
60
64
61
65
#[ doc ( hidden) ]
Original file line number Diff line number Diff line change @@ -26,7 +26,9 @@ pub macro panic_2015 {
26
26
$crate:: rt:: panic_display ( & $arg)
27
27
} ) ,
28
28
( $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) +) ) ;
30
32
} ) ,
31
33
}
32
34
You can’t perform that action at this time.
0 commit comments