]> git.lizzy.rs Git - rust.git/blob - src/test/ui/fmt/ifmt-bad-arg.stderr
Auto merge of #95454 - randomicon00:fix95444, r=wesleywiser
[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: 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: 2 positional arguments in format string, but no arguments were given
255   --> $DIR/ifmt-bad-arg.rs:92:15
256    |
257 LL |     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
265 error[E0425]: cannot find value `foo` in this scope
266   --> $DIR/ifmt-bad-arg.rs:27:18
267    |
268 LL |     format!("{} {foo} {} {bar} {}", 1, 2, 3);
269    |                  ^^^ not found in this scope
270
271 error[E0425]: cannot find value `bar` in this scope
272   --> $DIR/ifmt-bad-arg.rs:27:27
273    |
274 LL |     format!("{} {foo} {} {bar} {}", 1, 2, 3);
275    |                           ^^^ not found in this scope
276
277 error[E0425]: cannot find value `foo` in this scope
278   --> $DIR/ifmt-bad-arg.rs:31:15
279    |
280 LL |     format!("{foo}");
281    |               ^^^ not found in this scope
282
283 error[E0425]: cannot find value `valueb` in this scope
284   --> $DIR/ifmt-bad-arg.rs:45:24
285    |
286 LL |     format!("{valuea} {valueb}", valuea=5, valuec=7);
287    |                        ^^^^^^ not found in this scope
288
289 error[E0425]: cannot find value `foo` in this scope
290   --> $DIR/ifmt-bad-arg.rs:60:10
291    |
292 LL |         {foo}
293    |          ^^^ not found in this scope
294
295 error[E0308]: mismatched types
296   --> $DIR/ifmt-bad-arg.rs:78:32
297    |
298 LL |     println!("{} {:.*} {}", 1, 3.2, 4);
299    |     ---------------------------^^^----
300    |     |                          |
301    |     |                          expected `usize`, found floating-point number
302    |     arguments to this function are incorrect
303    |
304    = note: expected reference `&usize`
305               found reference `&{float}`
306 note: associated function defined here
307   --> $SRC_DIR/core/src/fmt/mod.rs:LL:COL
308    |
309 LL |     pub fn from_usize(x: &usize) -> ArgumentV1<'_> {
310    |            ^^^^^^^^^^
311    = note: this error originates in the macro `$crate::format_args_nl` (in Nightly builds, run with -Z macro-backtrace for more info)
312
313 error[E0308]: mismatched types
314   --> $DIR/ifmt-bad-arg.rs:81:35
315    |
316 LL |     println!("{} {:07$.*} {}", 1, 3.2, 4);
317    |     ------------------------------^^^----
318    |     |                             |
319    |     |                             expected `usize`, found floating-point number
320    |     arguments to this function are incorrect
321    |
322    = note: expected reference `&usize`
323               found reference `&{float}`
324 note: associated function defined here
325   --> $SRC_DIR/core/src/fmt/mod.rs:LL:COL
326    |
327 LL |     pub fn from_usize(x: &usize) -> ArgumentV1<'_> {
328    |            ^^^^^^^^^^
329    = note: this error originates in the macro `$crate::format_args_nl` (in Nightly builds, run with -Z macro-backtrace for more info)
330
331 error: aborting due to 36 previous errors
332
333 Some errors have detailed explanations: E0308, E0425.
334 For more information about an error, try `rustc --explain E0308`.