diff options
| author | Ömer Sinan Ağacan <omeragacan@gmail.com> | 2021-03-21 17:29:21 +0300 |
|---|---|---|
| committer | Ömer Sinan Ağacan <omeragacan@gmail.com> | 2021-03-27 13:06:36 +0300 |
| commit | ce4e668e39f710dae60c3d476eb594aebd9da11c (patch) | |
| tree | 09f71f8255972b682eab960f53874ee15804159b | |
| parent | 9f6b5de7deaf4dc9e7917370ad09ab85dc23997c (diff) | |
| download | rust-ce4e668e39f710dae60c3d476eb594aebd9da11c.tar.gz rust-ce4e668e39f710dae60c3d476eb594aebd9da11c.zip | |
format macro argument parsing fix
When the character next to `{}` is "shifted" (when mapping a byte index
in the format string to span) we should avoid shifting the span end
index, so first map the index of `}` to span, then bump the span,
instead of first mapping the next byte index to a span (which causes
bumping the end span too much).
Regression test added.
Fixes #83344
| -rw-r--r-- | tests/ui/write_literal_2.stderr | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/tests/ui/write_literal_2.stderr b/tests/ui/write_literal_2.stderr index 5b488358011..0aa1b55e58c 100644 --- a/tests/ui/write_literal_2.stderr +++ b/tests/ui/write_literal_2.stderr @@ -75,8 +75,9 @@ LL | "1", "2", "3", | help: try this | -LL | "some 1{} / {}", "2", "3", - | ^ -- +LL | "some 1/ +LL | {} / {}", "2", "3", + | error: literal with an empty format string --> $DIR/write_literal_2.rs:25:14 |
