File tree Expand file tree Collapse file tree 2 files changed +23
-1
lines changed Expand file tree Collapse file tree 2 files changed +23
-1
lines changed Original file line number Diff line number Diff line change @@ -29,6 +29,12 @@ fn main() {
2929 fancy_panic:: fancy_panic!( S ) ;
3030 //~^ WARN panic message is not a string literal
3131
32+ macro_rules! a {
33+ ( ) => { 123 } ;
34+ }
35+
36+ panic ! ( a!( ) ) ; //~ WARN panic message is not a string literal
37+
3238 // Check that the lint only triggers for std::panic and core::panic,
3339 // not any panic macro:
3440 macro_rules! panic {
Original file line number Diff line number Diff line change @@ -183,5 +183,21 @@ LL | fancy_panic::fancy_panic!(S);
183183 |
184184 = note: this is no longer accepted in Rust 2021
185185
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
187203
You can’t perform that action at this time.
0 commit comments