Skip to content

Commit 44232a6

Browse files
committed
Add ui test parser/issues/invalid-parse-format-issue-139104.rs
Signed-off-by: xizheyin <[email protected]>
1 parent 645d0ad commit 44232a6

File tree

2 files changed

+74
-0
lines changed

2 files changed

+74
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
fn main() {
2+
println!("{foo:_1.4}", foo = 3.14); //~ ERROR invalid format string: tuple index access isn't supported
3+
println!("{foo:1.4_1.4}", foo = 3.14); //~ ERROR invalid format string: tuple index access isn't supported
4+
println!("xxx{0:_1.4", 1.11); //~ ERROR invalid format string: expected `}`, found `.`
5+
println!("{foo:_1.4", foo = 3.14); //~ ERROR invalid format string: expected `}`, found `.`
6+
println!("xxx{0:_1.4", 1.11); //~ ERROR invalid format string: expected `}`, found `.`
7+
println!("xxx{ 0", 1.11); //~ ERROR invalid format string: expected `}`, found `0`
8+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
error: invalid format string: tuple index access isn't supported
2+
--> $DIR/invalid-parse-format-issue-139104.rs:2:16
3+
|
4+
LL | println!("{foo:_1.4}", foo = 3.14);
5+
| ^^^^^^^^ not supported in format string
6+
|
7+
help: consider using a positional formatting argument instead
8+
|
9+
LL - println!("{foo:_1.4}", foo = 3.14);
10+
LL + println!("{0}", foo:_1.4, foo = 3.14);
11+
|
12+
13+
error: invalid format string: tuple index access isn't supported
14+
--> $DIR/invalid-parse-format-issue-139104.rs:3:16
15+
|
16+
LL | println!("{foo:1.4_1.4}", foo = 3.14);
17+
| ^^^^^^^^^^^ not supported in format string
18+
|
19+
help: consider using a positional formatting argument instead
20+
|
21+
LL - println!("{foo:1.4_1.4}", foo = 3.14);
22+
LL + println!("{0}", foo:1.4_1.4, foo = 3.14);
23+
|
24+
25+
error: invalid format string: expected `}`, found `.`
26+
--> $DIR/invalid-parse-format-issue-139104.rs:4:23
27+
|
28+
LL | println!("xxx{0:_1.4", 1.11);
29+
| - ^ expected `}` in format string
30+
| |
31+
| because of this opening brace
32+
|
33+
= note: if you intended to print `{`, you can escape it using `{{`
34+
35+
error: invalid format string: expected `}`, found `.`
36+
--> $DIR/invalid-parse-format-issue-139104.rs:5:22
37+
|
38+
LL | println!("{foo:_1.4", foo = 3.14);
39+
| - ^ expected `}` in format string
40+
| |
41+
| because of this opening brace
42+
|
43+
= note: if you intended to print `{`, you can escape it using `{{`
44+
45+
error: invalid format string: expected `}`, found `.`
46+
--> $DIR/invalid-parse-format-issue-139104.rs:6:23
47+
|
48+
LL | println!("xxx{0:_1.4", 1.11);
49+
| - ^ expected `}` in format string
50+
| |
51+
| because of this opening brace
52+
|
53+
= note: if you intended to print `{`, you can escape it using `{{`
54+
55+
error: invalid format string: expected `}`, found `0`
56+
--> $DIR/invalid-parse-format-issue-139104.rs:7:21
57+
|
58+
LL | println!("xxx{ 0", 1.11);
59+
| - ^ expected `}` in format string
60+
| |
61+
| because of this opening brace
62+
|
63+
= note: if you intended to print `{`, you can escape it using `{{`
64+
65+
error: aborting due to 6 previous errors
66+

0 commit comments

Comments
 (0)