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