Skip to content

Commit

Permalink
format macro argument parsing fix
Browse files Browse the repository at this point in the history
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
  • Loading branch information
osa1 committed Mar 27, 2021
1 parent 9f6b5de commit ce4e668
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions tests/ui/write_literal_2.stderr
Expand Up @@ -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
Expand Down

0 comments on commit ce4e668

Please sign in to comment.