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