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