fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #66089 - Mark-Simulacrum:stable-next, r=Mark-Simulacrum4560ea788cb

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