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