Skip to content

Commit 3ffcb65

Browse files
committed
Update tests.
1 parent 9bec0de commit 3ffcb65

File tree

9 files changed

+190
-215
lines changed

9 files changed

+190
-215
lines changed

src/test/ui-fulldeps/session-diagnostic/diagnostic-derive.stderr

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -237,21 +237,19 @@ LL | #[suggestion(typeck::suggestion, code = "{name}")]
237237
| ^^^^^^^^
238238

239239
error: invalid format string: expected `'}'` but string was terminated
240-
--> $DIR/diagnostic-derive.rs:175:16
240+
--> $DIR/diagnostic-derive.rs:175:10
241241
|
242242
LL | #[derive(Diagnostic)]
243-
| - ^ expected `'}'` in format string
244-
| |
245-
| because of this opening brace
243+
| ^^^^^^^^^^ expected `'}'` in format string
246244
|
247245
= note: if you intended to print `{`, you can escape it using `{{`
248246
= note: this error originates in the derive macro `Diagnostic` (in Nightly builds, run with -Z macro-backtrace for more info)
249247

250248
error: invalid format string: unmatched `}` found
251-
--> $DIR/diagnostic-derive.rs:185:15
249+
--> $DIR/diagnostic-derive.rs:185:10
252250
|
253251
LL | #[derive(Diagnostic)]
254-
| ^ unmatched `}` in format string
252+
| ^^^^^^^^^^ unmatched `}` in format string
255253
|
256254
= note: if you intended to print `}`, you can escape it using `}}`
257255
= note: this error originates in the derive macro `Diagnostic` (in Nightly builds, run with -Z macro-backtrace for more info)

src/test/ui/fmt/format-args-capture-issue-93378.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ fn main() {
33
let b = "b";
44

55
println!("{a} {b} {} {} {c} {}", c = "c");
6-
//~^ ERROR: invalid reference to positional arguments 1 and 2 (there is 1 argument)
6+
//~^ ERROR: 3 positional arguments in format string, but there is 1 argument
77

88
let n = 1;
99
println!("{a:.n$} {b:.*}");
10-
//~^ ERROR: invalid reference to positional argument 0 (no arguments were given)
10+
//~^ ERROR: 1 positional argument in format string, but no arguments were given
1111
}

src/test/ui/fmt/format-args-capture-issue-93378.stderr

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,14 @@
1-
error: invalid reference to positional arguments 1 and 2 (there is 1 argument)
2-
--> $DIR/format-args-capture-issue-93378.rs:5:26
1+
error: 3 positional arguments in format string, but there is 1 argument
2+
--> $DIR/format-args-capture-issue-93378.rs:5:23
33
|
44
LL | println!("{a} {b} {} {} {c} {}", c = "c");
5-
| ^^ ^^
6-
|
7-
= note: positional arguments are zero-based
5+
| ^^ ^^ ^^ ---
86

9-
error: invalid reference to positional argument 0 (no arguments were given)
10-
--> $DIR/format-args-capture-issue-93378.rs:9:23
7+
error: 1 positional argument in format string, but no arguments were given
8+
--> $DIR/format-args-capture-issue-93378.rs:9:26
119
|
1210
LL | println!("{a:.n$} {b:.*}");
13-
| - ^^^--^
14-
| | |
15-
| | this precision flag adds an extra required argument at position 0, which is why there are 3 arguments expected
16-
| this parameter corresponds to the precision flag
11+
| ^^ this precision flag adds an extra required argument at position 0, which is why there is 1 argument expected
1712
|
1813
= note: positional arguments are zero-based
1914
= note: for information about formatting flags, visit https://doc.rust-lang.org/std/fmt/index.html

src/test/ui/fmt/ifmt-bad-arg.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ fn main() {
2020
//~^ ERROR: invalid reference to positional argument 2 (there are 2 arguments)
2121

2222
format!("{} {value} {} {}", 1, value=2);
23-
//~^ ERROR: invalid reference to positional argument 2 (there are 2 arguments)
23+
//~^ ERROR: 3 positional arguments in format string, but there are 2 arguments
2424
format!("{name} {value} {} {} {} {} {} {}", 0, name=1, value=2);
25-
//~^ ERROR: invalid reference to positional arguments 3, 4 and 5 (there are 3 arguments)
25+
//~^ ERROR: 6 positional arguments in format string, but there are 3 arguments
2626

2727
format!("{} {foo} {} {bar} {}", 1, 2, 3);
2828
//~^ ERROR: cannot find value `foo` in this scope
@@ -79,7 +79,7 @@ tenth number: {}",
7979
//~^ ERROR 4 positional arguments in format string, but there are 3 arguments
8080
//~| ERROR mismatched types
8181
println!("{} {:07$.*} {}", 1, 3.2, 4);
82-
//~^ ERROR 4 positional arguments in format string, but there are 3 arguments
82+
//~^ ERROR invalid reference to positional arguments 3 and 7 (there are 3 arguments)
8383
//~| ERROR mismatched types
8484
println!("{} {:07$} {}", 1, 3.2, 4);
8585
//~^ ERROR invalid reference to positional argument 7 (there are 3 arguments)

src/test/ui/fmt/ifmt-bad-arg.stderr

Lines changed: 30 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ LL | format!("{}");
55
| ^^
66

77
error: invalid reference to positional argument 1 (there is 1 argument)
8-
--> $DIR/ifmt-bad-arg.rs:9:14
8+
--> $DIR/ifmt-bad-arg.rs:9:15
99
|
1010
LL | format!("{1}", 1);
11-
| ^^^
11+
| ^
1212
|
1313
= note: positional arguments are zero-based
1414

@@ -27,36 +27,32 @@ LL | format!("{} {}");
2727
| ^^ ^^
2828

2929
error: invalid reference to positional argument 1 (there is 1 argument)
30-
--> $DIR/ifmt-bad-arg.rs:16:18
30+
--> $DIR/ifmt-bad-arg.rs:16:19
3131
|
3232
LL | format!("{0} {1}", 1);
33-
| ^^^
33+
| ^
3434
|
3535
= note: positional arguments are zero-based
3636

3737
error: invalid reference to positional argument 2 (there are 2 arguments)
38-
--> $DIR/ifmt-bad-arg.rs:19:22
38+
--> $DIR/ifmt-bad-arg.rs:19:23
3939
|
4040
LL | format!("{0} {1} {2}", 1, 2);
41-
| ^^^
41+
| ^
4242
|
4343
= note: positional arguments are zero-based
4444

45-
error: invalid reference to positional argument 2 (there are 2 arguments)
46-
--> $DIR/ifmt-bad-arg.rs:22:28
45+
error: 3 positional arguments in format string, but there are 2 arguments
46+
--> $DIR/ifmt-bad-arg.rs:22:14
4747
|
4848
LL | format!("{} {value} {} {}", 1, value=2);
49-
| ^^
50-
|
51-
= note: positional arguments are zero-based
49+
| ^^ ^^ ^^ - -
5250

53-
error: invalid reference to positional arguments 3, 4 and 5 (there are 3 arguments)
54-
--> $DIR/ifmt-bad-arg.rs:24:38
51+
error: 6 positional arguments in format string, but there are 3 arguments
52+
--> $DIR/ifmt-bad-arg.rs:24:29
5553
|
5654
LL | format!("{name} {value} {} {} {} {} {} {}", 0, name=1, value=2);
57-
| ^^ ^^ ^^
58-
|
59-
= note: positional arguments are zero-based
55+
| ^^ ^^ ^^ ^^ ^^ ^^ - - -
6056

6157
error: multiple unused formatting arguments
6258
--> $DIR/ifmt-bad-arg.rs:32:17
@@ -191,33 +187,26 @@ error: 4 positional arguments in format string, but there are 3 arguments
191187
|
192188
LL | println!("{} {:.*} {}", 1, 3.2, 4);
193189
| ^^ ^^--^ ^^ - --- -
194-
| | |
195-
| | this parameter corresponds to the precision flag
190+
| |
196191
| this precision flag adds an extra required argument at position 1, which is why there are 4 arguments expected
197192
|
198193
= note: positional arguments are zero-based
199194
= note: for information about formatting flags, visit https://doc.rust-lang.org/std/fmt/index.html
200195

201-
error: 4 positional arguments in format string, but there are 3 arguments
202-
--> $DIR/ifmt-bad-arg.rs:81:15
196+
error: invalid reference to positional arguments 3 and 7 (there are 3 arguments)
197+
--> $DIR/ifmt-bad-arg.rs:81:21
203198
|
204199
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
200+
| ^^ ^
210201
|
211202
= note: positional arguments are zero-based
212203
= note: for information about formatting flags, visit https://doc.rust-lang.org/std/fmt/index.html
213204

214205
error: invalid reference to positional argument 7 (there are 3 arguments)
215-
--> $DIR/ifmt-bad-arg.rs:84:18
206+
--> $DIR/ifmt-bad-arg.rs:84:21
216207
|
217208
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
209+
| ^^
221210
|
222211
= note: positional arguments are zero-based
223212
= note: for information about formatting flags, visit https://doc.rust-lang.org/std/fmt/index.html
@@ -240,24 +229,19 @@ LL | println!("{:foo}", 1);
240229
- `X`, which uses the `UpperHex` trait
241230

242231
error: invalid reference to positional arguments 4, 5, 6 and 7 (there is 1 argument)
243-
--> $DIR/ifmt-bad-arg.rs:87:15
232+
--> $DIR/ifmt-bad-arg.rs:87:16
244233
|
245234
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
235+
| ^ ^^ ^ ^^
250236
|
251237
= note: positional arguments are zero-based
252238
= note: for information about formatting flags, visit https://doc.rust-lang.org/std/fmt/index.html
253239

254240
error: invalid reference to positional argument 0 (no arguments were given)
255-
--> $DIR/ifmt-bad-arg.rs:90:15
241+
--> $DIR/ifmt-bad-arg.rs:90:20
256242
|
257243
LL | println!("{foo:0$}");
258-
| ^^^^^--^
259-
| |
260-
| this width flag expects an `usize` argument at position 0, but no arguments were given
244+
| ^^
261245
|
262246
= note: positional arguments are zero-based
263247
= note: for information about formatting flags, visit https://doc.rust-lang.org/std/fmt/index.html
@@ -318,10 +302,10 @@ error[E0308]: mismatched types
318302
--> $DIR/ifmt-bad-arg.rs:78:32
319303
|
320304
LL | println!("{} {:.*} {}", 1, 3.2, 4);
321-
| ---------------------------^^^----
322-
| | |
323-
| | expected `usize`, found floating-point number
324-
| arguments to this function are incorrect
305+
| ^^^
306+
| |
307+
| expected `usize`, found floating-point number
308+
| arguments to this function are incorrect
325309
|
326310
= note: expected reference `&usize`
327311
found reference `&{float}`
@@ -336,10 +320,10 @@ error[E0308]: mismatched types
336320
--> $DIR/ifmt-bad-arg.rs:81:35
337321
|
338322
LL | println!("{} {:07$.*} {}", 1, 3.2, 4);
339-
| ------------------------------^^^----
340-
| | |
341-
| | expected `usize`, found floating-point number
342-
| arguments to this function are incorrect
323+
| ^^^
324+
| |
325+
| expected `usize`, found floating-point number
326+
| arguments to this function are incorrect
343327
|
344328
= note: expected reference `&usize`
345329
found reference `&{float}`

src/test/ui/issues/issue-75307.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
fn main() {
2-
format!(r"{}{}{}", named_arg=1); //~ ERROR invalid reference to positional arguments 1 and 2
2+
format!(r"{}{}{}", named_arg=1); //~ ERROR 3 positional arguments in format string, but there is 1 argument
33
}

src/test/ui/issues/issue-75307.stderr

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
1-
error: invalid reference to positional arguments 1 and 2 (there is 1 argument)
2-
--> $DIR/issue-75307.rs:2:17
1+
error: 3 positional arguments in format string, but there is 1 argument
2+
--> $DIR/issue-75307.rs:2:15
33
|
44
LL | format!(r"{}{}{}", named_arg=1);
5-
| ^^^^
6-
|
7-
= note: positional arguments are zero-based
5+
| ^^^^^^ -
86

97
error: aborting due to previous error
108

0 commit comments

Comments
 (0)