Add ui test parser/issues/invalid-parse-format-issue-139104.rs

Signed-off-by: xizheyin <xizheyin@smail.nju.edu.cn>
This commit is contained in:
xizheyin 2025-04-25 17:43:12 +08:00
parent 645d0ad2a4
commit 44232a67c3
No known key found for this signature in database
GPG key ID: 0A0D90BE99CEDEAD
2 changed files with 74 additions and 0 deletions

View file

@ -0,0 +1,8 @@
fn main() {
println!("{foo:_1.4}", foo = 3.14); //~ ERROR invalid format string: tuple index access isn't supported
println!("{foo:1.4_1.4}", foo = 3.14); //~ ERROR invalid format string: tuple index access isn't supported
println!("xxx{0:_1.4", 1.11); //~ ERROR invalid format string: expected `}`, found `.`
println!("{foo:_1.4", foo = 3.14); //~ ERROR invalid format string: expected `}`, found `.`
println!("xxx{0:_1.4", 1.11); //~ ERROR invalid format string: expected `}`, found `.`
println!("xxx{ 0", 1.11); //~ ERROR invalid format string: expected `}`, found `0`
}

View file

@ -0,0 +1,66 @@
error: invalid format string: tuple index access isn't supported
--> $DIR/invalid-parse-format-issue-139104.rs:2:16
|
LL | println!("{foo:_1.4}", foo = 3.14);
| ^^^^^^^^ not supported in format string
|
help: consider using a positional formatting argument instead
|
LL - println!("{foo:_1.4}", foo = 3.14);
LL + println!("{0}", foo:_1.4, foo = 3.14);
|
error: invalid format string: tuple index access isn't supported
--> $DIR/invalid-parse-format-issue-139104.rs:3:16
|
LL | println!("{foo:1.4_1.4}", foo = 3.14);
| ^^^^^^^^^^^ not supported in format string
|
help: consider using a positional formatting argument instead
|
LL - println!("{foo:1.4_1.4}", foo = 3.14);
LL + println!("{0}", foo:1.4_1.4, foo = 3.14);
|
error: invalid format string: expected `}`, found `.`
--> $DIR/invalid-parse-format-issue-139104.rs:4:23
|
LL | println!("xxx{0:_1.4", 1.11);
| - ^ expected `}` in format string
| |
| because of this opening brace
|
= note: if you intended to print `{`, you can escape it using `{{`
error: invalid format string: expected `}`, found `.`
--> $DIR/invalid-parse-format-issue-139104.rs:5:22
|
LL | println!("{foo:_1.4", foo = 3.14);
| - ^ expected `}` in format string
| |
| because of this opening brace
|
= note: if you intended to print `{`, you can escape it using `{{`
error: invalid format string: expected `}`, found `.`
--> $DIR/invalid-parse-format-issue-139104.rs:6:23
|
LL | println!("xxx{0:_1.4", 1.11);
| - ^ expected `}` in format string
| |
| because of this opening brace
|
= note: if you intended to print `{`, you can escape it using `{{`
error: invalid format string: expected `}`, found `0`
--> $DIR/invalid-parse-format-issue-139104.rs:7:21
|
LL | println!("xxx{ 0", 1.11);
| - ^ expected `}` in format string
| |
| because of this opening brace
|
= note: if you intended to print `{`, you can escape it using `{{`
error: aborting due to 6 previous errors