1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
|
error: 1 positional argument in format string, but no arguments were given
--> $DIR/ifmt-bad-arg.rs:6:14
|
LL | format!("{}");
| ^^
error: invalid reference to positional argument 1 (there is 1 argument)
--> $DIR/ifmt-bad-arg.rs:9:15
|
LL | format!("{1}", 1);
| ^
|
= note: positional arguments are zero-based
error: argument never used
--> $DIR/ifmt-bad-arg.rs:9:20
|
LL | format!("{1}", 1);
| ----- ^ argument never used
| |
| formatting specifier missing
error: 2 positional arguments in format string, but no arguments were given
--> $DIR/ifmt-bad-arg.rs:13:14
|
LL | format!("{} {}");
| ^^ ^^
error: invalid reference to positional argument 1 (there is 1 argument)
--> $DIR/ifmt-bad-arg.rs:16:19
|
LL | format!("{0} {1}", 1);
| ^
|
= note: positional arguments are zero-based
error: invalid reference to positional argument 2 (there are 2 arguments)
--> $DIR/ifmt-bad-arg.rs:19:23
|
LL | format!("{0} {1} {2}", 1, 2);
| ^
|
= note: positional arguments are zero-based
error: 3 positional arguments in format string, but there are 2 arguments
--> $DIR/ifmt-bad-arg.rs:22:14
|
LL | format!("{} {value} {} {}", 1, value=2);
| ^^ ^^ ^^ - -
error: 6 positional arguments in format string, but there are 3 arguments
--> $DIR/ifmt-bad-arg.rs:24:29
|
LL | format!("{name} {value} {} {} {} {} {} {}", 0, name=1, value=2);
| ^^ ^^ ^^ ^^ ^^ ^^ - - -
error: multiple unused formatting arguments
--> $DIR/ifmt-bad-arg.rs:32:17
|
LL | format!("", 1, 2);
| -- ^ ^ argument never used
| | |
| | argument never used
| multiple missing formatting specifiers
error: argument never used
--> $DIR/ifmt-bad-arg.rs:33:22
|
LL | format!("{}", 1, 2);
| ---- ^ argument never used
| |
| formatting specifier missing
error: argument never used
--> $DIR/ifmt-bad-arg.rs:34:20
|
LL | format!("{1}", 1, 2);
| ----- ^ argument never used
| |
| formatting specifier missing
error: named argument never used
--> $DIR/ifmt-bad-arg.rs:35:26
|
LL | format!("{}", 1, foo=2);
| ---- ^ named argument never used
| |
| formatting specifier missing
error: argument never used
--> $DIR/ifmt-bad-arg.rs:36:22
|
LL | format!("{foo}", 1, foo=2);
| ------- ^ argument never used
| |
| formatting specifier missing
error: named argument never used
--> $DIR/ifmt-bad-arg.rs:37:21
|
LL | format!("", foo=2);
| -- ^ named argument never used
| |
| formatting specifier missing
error: multiple unused formatting arguments
--> $DIR/ifmt-bad-arg.rs:38:32
|
LL | format!("{} {}", 1, 2, foo=1, bar=2);
| ------- ^ ^ named argument never used
| | |
| | named argument never used
| multiple missing formatting specifiers
error: duplicate argument named `foo`
--> $DIR/ifmt-bad-arg.rs:40:29
|
LL | format!("{foo}", foo=1, foo=2);
| --- ^^^ duplicate argument
| |
| previously here
error: positional arguments cannot follow named arguments
--> $DIR/ifmt-bad-arg.rs:41:35
|
LL | format!("{foo} {} {}", foo=1, 2);
| ----- ^ positional arguments must be before named arguments
| |
| named argument
error: named argument never used
--> $DIR/ifmt-bad-arg.rs:45:51
|
LL | format!("{valuea} {valueb}", valuea=5, valuec=7);
| ------------------- ^ named argument never used
| |
| formatting specifier missing
error: invalid format string: expected `'}'` but string was terminated
--> $DIR/ifmt-bad-arg.rs:51:15
|
LL | format!("{");
| -^ expected `'}'` in format string
| |
| because of this opening brace
|
= note: if you intended to print `{`, you can escape it using `{{`
error: invalid format string: unmatched `}` found
--> $DIR/ifmt-bad-arg.rs:53:18
|
LL | format!("foo } bar");
| ^ unmatched `}` in format string
|
= note: if you intended to print `}`, you can escape it using `}}`
error: invalid format string: unmatched `}` found
--> $DIR/ifmt-bad-arg.rs:54:18
|
LL | format!("foo }");
| ^ unmatched `}` in format string
|
= note: if you intended to print `}`, you can escape it using `}}`
error: argument never used
--> $DIR/ifmt-bad-arg.rs:56:27
|
LL | format!("foo %s baz", "bar");
| -- ^^^^^ argument never used
| |
| help: format specifiers use curly braces: `{}`
|
= note: printf formatting not supported; see the documentation for `std::fmt`
error: invalid format string: expected `'}'`, found `'t'`
--> $DIR/ifmt-bad-arg.rs:75:1
|
LL | ninth number: {
| - because of this opening brace
LL | tenth number: {}",
| ^ expected `}` in format string
|
= note: if you intended to print `{`, you can escape it using `{{`
error: 4 positional arguments in format string, but there are 3 arguments
--> $DIR/ifmt-bad-arg.rs:78:15
|
LL | println!("{} {:.*} {}", 1, 3.2, 4);
| ^^ ^^--^ ^^ - --- -
| |
| this precision flag adds an extra required argument at position 1, which is why there are 4 arguments expected
|
= note: positional arguments are zero-based
= note: for information about formatting flags, visit https://doc.rust-lang.org/std/fmt/index.html
error: invalid reference to positional arguments 3 and 7 (there are 3 arguments)
--> $DIR/ifmt-bad-arg.rs:81:21
|
LL | println!("{} {:07$.*} {}", 1, 3.2, 4);
| ^^ ^
|
= note: positional arguments are zero-based
= note: for information about formatting flags, visit https://doc.rust-lang.org/std/fmt/index.html
error: invalid reference to positional argument 7 (there are 3 arguments)
--> $DIR/ifmt-bad-arg.rs:84:21
|
LL | println!("{} {:07$} {}", 1, 3.2, 4);
| ^^
|
= note: positional arguments are zero-based
= note: for information about formatting flags, visit https://doc.rust-lang.org/std/fmt/index.html
error: unknown format trait `foo`
--> $DIR/ifmt-bad-arg.rs:86:17
|
LL | println!("{:foo}", 1);
| ^^^
|
= note: the only appropriate formatting traits are:
- ``, which uses the `Display` trait
- `?`, which uses the `Debug` trait
- `e`, which uses the `LowerExp` trait
- `E`, which uses the `UpperExp` trait
- `o`, which uses the `Octal` trait
- `p`, which uses the `Pointer` trait
- `b`, which uses the `Binary` trait
- `x`, which uses the `LowerHex` trait
- `X`, which uses the `UpperHex` trait
error: invalid reference to positional arguments 4, 5, 6 and 7 (there is 1 argument)
--> $DIR/ifmt-bad-arg.rs:87:16
|
LL | println!("{5} {:4$} {6:7$}", 1);
| ^ ^^ ^ ^^
|
= note: positional arguments are zero-based
= note: for information about formatting flags, visit https://doc.rust-lang.org/std/fmt/index.html
error: invalid reference to positional argument 0 (no arguments were given)
--> $DIR/ifmt-bad-arg.rs:90:20
|
LL | println!("{foo:0$}");
| ^^
|
= note: positional arguments are zero-based
= note: for information about formatting flags, visit https://doc.rust-lang.org/std/fmt/index.html
error: 2 positional arguments in format string, but no arguments were given
--> $DIR/ifmt-bad-arg.rs:95:15
|
LL | println!("{:.*}");
| ^^--^
| |
| this precision flag adds an extra required argument at position 0, which is why there are 2 arguments expected
|
= note: positional arguments are zero-based
= note: for information about formatting flags, visit https://doc.rust-lang.org/std/fmt/index.html
error: invalid reference to positional argument 0 (no arguments were given)
--> $DIR/ifmt-bad-arg.rs:97:16
|
LL | println!("{:.0$}");
| ^^^^
|
= note: positional arguments are zero-based
= note: for information about formatting flags, visit https://doc.rust-lang.org/std/fmt/index.html
error[E0425]: cannot find value `foo` in this scope
--> $DIR/ifmt-bad-arg.rs:27:18
|
LL | format!("{} {foo} {} {bar} {}", 1, 2, 3);
| ^^^ not found in this scope
error[E0425]: cannot find value `bar` in this scope
--> $DIR/ifmt-bad-arg.rs:27:27
|
LL | format!("{} {foo} {} {bar} {}", 1, 2, 3);
| ^^^ not found in this scope
error[E0425]: cannot find value `foo` in this scope
--> $DIR/ifmt-bad-arg.rs:31:15
|
LL | format!("{foo}");
| ^^^ not found in this scope
error[E0425]: cannot find value `valueb` in this scope
--> $DIR/ifmt-bad-arg.rs:45:24
|
LL | format!("{valuea} {valueb}", valuea=5, valuec=7);
| ^^^^^^ not found in this scope
error[E0425]: cannot find value `foo` in this scope
--> $DIR/ifmt-bad-arg.rs:60:10
|
LL | {foo}
| ^^^ not found in this scope
error[E0308]: mismatched types
--> $DIR/ifmt-bad-arg.rs:78:32
|
LL | println!("{} {:.*} {}", 1, 3.2, 4);
| ^^^
| |
| expected `usize`, found floating-point number
| arguments to this function are incorrect
|
= note: expected reference `&usize`
found reference `&{float}`
note: associated function defined here
--> $SRC_DIR/core/src/fmt/mod.rs:LL:COL
|
LL | pub fn from_usize(x: &usize) -> ArgumentV1<'_> {
| ^^^^^^^^^^
= note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0308]: mismatched types
--> $DIR/ifmt-bad-arg.rs:81:35
|
LL | println!("{} {:07$.*} {}", 1, 3.2, 4);
| ^^^
| |
| expected `usize`, found floating-point number
| arguments to this function are incorrect
|
= note: expected reference `&usize`
found reference `&{float}`
note: associated function defined here
--> $SRC_DIR/core/src/fmt/mod.rs:LL:COL
|
LL | pub fn from_usize(x: &usize) -> ArgumentV1<'_> {
| ^^^^^^^^^^
= note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 38 previous errors
Some errors have detailed explanations: E0308, E0425.
For more information about an error, try `rustc --explain E0308`.
|