File tree 2 files changed +23
-1
lines changed
2 files changed +23
-1
lines changed Original file line number Diff line number Diff line change @@ -29,6 +29,12 @@ fn main() {
29
29
fancy_panic:: fancy_panic!( S ) ;
30
30
//~^ WARN panic message is not a string literal
31
31
32
+ macro_rules! a {
33
+ ( ) => { 123 } ;
34
+ }
35
+
36
+ panic ! ( a!( ) ) ; //~ WARN panic message is not a string literal
37
+
32
38
// Check that the lint only triggers for std::panic and core::panic,
33
39
// not any panic macro:
34
40
macro_rules! panic {
Original file line number Diff line number Diff line change @@ -183,5 +183,21 @@ LL | fancy_panic::fancy_panic!(S);
183
183
|
184
184
= note: this is no longer accepted in Rust 2021
185
185
186
- warning: 14 warnings emitted
186
+ warning: panic message is not a string literal
187
+ --> $DIR/non-fmt-panic.rs:36:12
188
+ |
189
+ LL | panic!(a!());
190
+ | ^^^^
191
+ |
192
+ = note: this is no longer accepted in Rust 2021
193
+ help: add a "{}" format string to Display the message
194
+ |
195
+ LL | panic!("{}", a!());
196
+ | ^^^^^
197
+ help: or use std::panic::panic_any instead
198
+ |
199
+ LL | std::panic::panic_any(a!());
200
+ | ^^^^^^^^^^^^^^^^^^^^^^
201
+
202
+ warning: 15 warnings emitted
187
203
You can’t perform that action at this time.
0 commit comments