Add ui test parser/issues/invalid-parse-format-issue-139104.rs
Signed-off-by: xizheyin <xizheyin@smail.nju.edu.cn>
diff --git a/tests/ui/parser/issues/invalid-parse-format-issue-139104.rs b/tests/ui/parser/issues/invalid-parse-format-issue-139104.rs
new file mode 100644
index 0000000..40af626
--- /dev/null
+++ b/tests/ui/parser/issues/invalid-parse-format-issue-139104.rs
@@ -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`
+}
diff --git a/tests/ui/parser/issues/invalid-parse-format-issue-139104.stderr b/tests/ui/parser/issues/invalid-parse-format-issue-139104.stderr
new file mode 100644
index 0000000..d0a8d09
--- /dev/null
+++ b/tests/ui/parser/issues/invalid-parse-format-issue-139104.stderr
@@ -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
+