fork/rust

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

borsAuto merge of #103046 - JanBeh:PR_clarify_cmp_terminology, r=workingjubilee3bcad65fbf6

master
11.1 KiB330 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:15
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:19
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:23
39   |
40LL |     format!("{0} {1} {2}", 1, 2);
41   |                       ^
42   |
43   = note: positional arguments are zero-based
44
45error: 3 positional arguments in format string, but there are 2 arguments
46  --> $DIR/ifmt-bad-arg.rs:22:14
47   |
48LL |     format!("{} {value} {} {}", 1, value=2);
49   |              ^^         ^^ ^^   -        -
50
51error: 6 positional arguments in format string, but there are 3 arguments
52  --> $DIR/ifmt-bad-arg.rs:24:29
53   |
54LL |     format!("{name} {value} {} {} {} {} {} {}", 0, name=1, value=2);
55   |                             ^^ ^^ ^^ ^^ ^^ ^^   -       -        -
56
57error: multiple unused formatting arguments
58  --> $DIR/ifmt-bad-arg.rs:32:17
59   |
60LL |     format!("", 1, 2);
61   |             --  ^  ^ argument never used
62   |             |   |
63   |             |   argument never used
64   |             multiple missing formatting specifiers
65
66error: argument never used
67  --> $DIR/ifmt-bad-arg.rs:33:22
68   |
69LL |     format!("{}", 1, 2);
70   |             ----     ^ argument never used
71   |             |
72   |             formatting specifier missing
73
74error: argument never used
75  --> $DIR/ifmt-bad-arg.rs:34:20
76   |
77LL |     format!("{1}", 1, 2);
78   |             -----  ^ argument never used
79   |             |
80   |             formatting specifier missing
81
82error: named argument never used
83  --> $DIR/ifmt-bad-arg.rs:35:26
84   |
85LL |     format!("{}", 1, foo=2);
86   |             ----         ^ named argument never used
87   |             |
88   |             formatting specifier missing
89
90error: argument never used
91  --> $DIR/ifmt-bad-arg.rs:36:22
92   |
93LL |     format!("{foo}", 1, foo=2);
94   |             -------  ^ argument never used
95   |             |
96   |             formatting specifier missing
97
98error: named argument never used
99  --> $DIR/ifmt-bad-arg.rs:37:21
100   |
101LL |     format!("", foo=2);
102   |             --      ^ named argument never used
103   |             |
104   |             formatting specifier missing
105
106error: multiple unused formatting arguments
107  --> $DIR/ifmt-bad-arg.rs:38:32
108   |
109LL |     format!("{} {}", 1, 2, foo=1, bar=2);
110   |             -------            ^      ^ named argument never used
111   |             |                  |
112   |             |                  named argument never used
113   |             multiple missing formatting specifiers
114
115error: duplicate argument named `foo`
116  --> $DIR/ifmt-bad-arg.rs:40:29
117   |
118LL |     format!("{foo}", foo=1, foo=2);
119   |                      ---    ^^^ duplicate argument
120   |                      |
121   |                      previously here
122
123error: positional arguments cannot follow named arguments
124  --> $DIR/ifmt-bad-arg.rs:41:35
125   |
126LL |     format!("{foo} {} {}", foo=1, 2);
127   |                            -----  ^ positional arguments must be before named arguments
128   |                            |
129   |                            named argument
130
131error: named argument never used
132  --> $DIR/ifmt-bad-arg.rs:45:51
133   |
134LL |     format!("{valuea} {valueb}", valuea=5, valuec=7);
135   |             -------------------                   ^ named argument never used
136   |             |
137   |             formatting specifier missing
138
139error: invalid format string: expected `'}'` but string was terminated
140  --> $DIR/ifmt-bad-arg.rs:51:15
141   |
142LL |     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
149error: invalid format string: unmatched `}` found
150  --> $DIR/ifmt-bad-arg.rs:53:18
151   |
152LL |     format!("foo } bar");
153   |                  ^ unmatched `}` in format string
154   |
155   = note: if you intended to print `}`, you can escape it using `}}`
156
157error: invalid format string: unmatched `}` found
158  --> $DIR/ifmt-bad-arg.rs:54:18
159   |
160LL |     format!("foo }");
161   |                  ^ unmatched `}` in format string
162   |
163   = note: if you intended to print `}`, you can escape it using `}}`
164
165error: argument never used
166  --> $DIR/ifmt-bad-arg.rs:56:27
167   |
168LL |     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
175error: invalid format string: expected `'}'`, found `'t'`
176  --> $DIR/ifmt-bad-arg.rs:75:1
177   |
178LL | ninth number: {
179   |               - because of this opening brace
180LL | tenth number: {}",
181   | ^ expected `'}'` in format string
182   |
183   = note: if you intended to print `{`, you can escape it using `{{`
184
185error: 4 positional arguments in format string, but there are 3 arguments
186  --> $DIR/ifmt-bad-arg.rs:78:15
187   |
188LL |     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
196error: invalid reference to positional arguments 3 and 7 (there are 3 arguments)
197  --> $DIR/ifmt-bad-arg.rs:81:21
198   |
199LL |     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
205error: invalid reference to positional argument 7 (there are 3 arguments)
206  --> $DIR/ifmt-bad-arg.rs:84:21
207   |
208LL |     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
214error: unknown format trait `foo`
215  --> $DIR/ifmt-bad-arg.rs:86:17
216   |
217LL |     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
231error: invalid reference to positional arguments 4, 5, 6 and 7 (there is 1 argument)
232  --> $DIR/ifmt-bad-arg.rs:87:16
233   |
234LL |     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
240error: invalid reference to positional argument 0 (no arguments were given)
241  --> $DIR/ifmt-bad-arg.rs:90:20
242   |
243LL |     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
249error: 2 positional arguments in format string, but no arguments were given
250  --> $DIR/ifmt-bad-arg.rs:95:15
251   |
252LL |     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
260error: invalid reference to positional argument 0 (no arguments were given)
261  --> $DIR/ifmt-bad-arg.rs:97:16
262   |
263LL |     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
269error[E0425]: cannot find value `foo` in this scope
270  --> $DIR/ifmt-bad-arg.rs:27:18
271   |
272LL |     format!("{} {foo} {} {bar} {}", 1, 2, 3);
273   |                  ^^^ not found in this scope
274
275error[E0425]: cannot find value `bar` in this scope
276  --> $DIR/ifmt-bad-arg.rs:27:27
277   |
278LL |     format!("{} {foo} {} {bar} {}", 1, 2, 3);
279   |                           ^^^ not found in this scope
280
281error[E0425]: cannot find value `foo` in this scope
282  --> $DIR/ifmt-bad-arg.rs:31:15
283   |
284LL |     format!("{foo}");
285   |               ^^^ not found in this scope
286
287error[E0425]: cannot find value `valueb` in this scope
288  --> $DIR/ifmt-bad-arg.rs:45:24
289   |
290LL |     format!("{valuea} {valueb}", valuea=5, valuec=7);
291   |                        ^^^^^^ not found in this scope
292
293error[E0425]: cannot find value `foo` in this scope
294  --> $DIR/ifmt-bad-arg.rs:60:10
295   |
296LL |         {foo}
297   |          ^^^ not found in this scope
298
299error[E0308]: mismatched types
300  --> $DIR/ifmt-bad-arg.rs:78:32
301   |
302LL |     println!("{} {:.*} {}", 1, 3.2, 4);
303   |                    --          ^^^ expected `&usize`, found `&{float}`
304   |                    |
305   |                    arguments to this function are incorrect
306   |
307   = note: expected reference `&usize`
308              found reference `&{float}`
309note: associated function defined here
310  --> $SRC_DIR/core/src/fmt/rt.rs:LL:COL
311   = 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)
312
313error[E0308]: mismatched types
314  --> $DIR/ifmt-bad-arg.rs:81:35
315   |
316LL |     println!("{} {:07$.*} {}", 1, 3.2, 4);
317   |                       --          ^^^ expected `&usize`, found `&{float}`
318   |                       |
319   |                       arguments to this function are incorrect
320   |
321   = note: expected reference `&usize`
322              found reference `&{float}`
323note: associated function defined here
324  --> $SRC_DIR/core/src/fmt/rt.rs:LL:COL
325   = 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)
326
327error: aborting due to 38 previous errors
328
329Some errors have detailed explanations: E0308, E0425.
330For more information about an error, try `rustc --explain E0308`.