File tree Expand file tree Collapse file tree 2 files changed +51
-0
lines changed Expand file tree Collapse file tree 2 files changed +51
-0
lines changed Original file line number Diff line number Diff line change 1+ // edition:2021
2+
3+ fn main ( ) {
4+ panic ! ( 123 ) ; //~ ERROR: format argument must be a string literal
5+ panic ! ( "{}" ) ; //~ ERROR: 1 positional argument in format string
6+ core:: panic!( "{}" ) ; //~ ERROR: 1 positional argument in format string
7+ assert ! ( false , 123 ) ; //~ ERROR: format argument must be a string literal
8+ assert ! ( false , "{}" ) ; //~ ERROR: 1 positional argument in format string
9+ }
Original file line number Diff line number Diff line change 1+ error: format argument must be a string literal
2+ --> $DIR/panic-2021.rs:4:12
3+ |
4+ LL | panic!(123);
5+ | ^^^
6+ |
7+ help: you might be missing a string literal to format with
8+ |
9+ LL | panic!("{}", 123);
10+ | ^^^^^
11+
12+ error: 1 positional argument in format string, but no arguments were given
13+ --> $DIR/panic-2021.rs:5:13
14+ |
15+ LL | panic!("{}");
16+ | ^^
17+
18+ error: 1 positional argument in format string, but no arguments were given
19+ --> $DIR/panic-2021.rs:6:19
20+ |
21+ LL | core::panic!("{}");
22+ | ^^
23+
24+ error: format argument must be a string literal
25+ --> $DIR/panic-2021.rs:7:20
26+ |
27+ LL | assert!(false, 123);
28+ | ^^^
29+ |
30+ help: you might be missing a string literal to format with
31+ |
32+ LL | assert!(false, "{}", 123);
33+ | ^^^^^
34+
35+ error: 1 positional argument in format string, but no arguments were given
36+ --> $DIR/panic-2021.rs:8:21
37+ |
38+ LL | assert!(false, "{}");
39+ | ^^
40+
41+ error: aborting due to 5 previous errors
42+
You can’t perform that action at this time.
0 commit comments