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