diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2024-01-09 05:33:22 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-01-09 05:33:22 +0100 |
| commit | deb504b777ac4413deb452dcb3c71c7bb5f27bd1 (patch) | |
| tree | ccd8848468fef7aca888cdddfc1f3e16c1b3eec9 /tests | |
| parent | 50982bd4abd8285e7c99658b6c90a1519f47a9ff (diff) | |
| parent | 506c06636b5fe4b59558cbb08cf87809175648b8 (diff) | |
Rollup merge of #119712 - madsravn:parsing-errors, r=estebank
Adding alignment to the cases to test for specific error messages. Adding alignment to the list of cases to test for specific error message. Covers `>`, `^` and `<`. Pinging people who chimed in last time ( https://github.com/rust-lang/rust/pull/106805 ): ``@estebank`` , ``@compiler-errors`` and ``@Nilstrieb``
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/ui/fmt/format-string-wrong-order.rs | 6 | ||||
| -rw-r--r-- | tests/ui/fmt/format-string-wrong-order.stderr | 20 |
2 files changed, 25 insertions, 1 deletions
diff --git a/tests/ui/fmt/format-string-wrong-order.rs b/tests/ui/fmt/format-string-wrong-order.rs index 0bad5402396..da775be3ffd 100644 --- a/tests/ui/fmt/format-string-wrong-order.rs +++ b/tests/ui/fmt/format-string-wrong-order.rs @@ -12,4 +12,10 @@ fn main() { //~^ ERROR invalid format string: expected `'}'`, found `'?'` format!("{?:#?}", bar); //~^ ERROR invalid format string: expected format parameter to occur after `:` + format!("Hello {<5:}!", "x"); + //~^ ERROR invalid format string: expected format parameter to occur after `:` + format!("Hello {^5:}!", "x"); + //~^ ERROR invalid format string: expected format parameter to occur after `:` + format!("Hello {>5:}!", "x"); + //~^ ERROR invalid format string: expected format parameter to occur after `:` } diff --git a/tests/ui/fmt/format-string-wrong-order.stderr b/tests/ui/fmt/format-string-wrong-order.stderr index 0a2e04026d9..3ef07720c15 100644 --- a/tests/ui/fmt/format-string-wrong-order.stderr +++ b/tests/ui/fmt/format-string-wrong-order.stderr @@ -50,5 +50,23 @@ LL | format!("{?:#?}", bar); | = note: `?` comes after `:`, try `:?` instead -error: aborting due to 6 previous errors +error: invalid format string: expected format parameter to occur after `:` + --> $DIR/format-string-wrong-order.rs:15:21 + | +LL | format!("Hello {<5:}!", "x"); + | ^ expected `<` to occur after `:` in format string + +error: invalid format string: expected format parameter to occur after `:` + --> $DIR/format-string-wrong-order.rs:17:21 + | +LL | format!("Hello {^5:}!", "x"); + | ^ expected `^` to occur after `:` in format string + +error: invalid format string: expected format parameter to occur after `:` + --> $DIR/format-string-wrong-order.rs:19:21 + | +LL | format!("Hello {>5:}!", "x"); + | ^ expected `>` to occur after `:` in format string + +error: aborting due to 9 previous errors |
