Skip to content

Commit ce4e668

Browse files
committed
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 rust-lang#83344
1 parent 9f6b5de commit ce4e668

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

tests/ui/write_literal_2.stderr

+3-2
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,9 @@ LL | "1", "2", "3",
7575
|
7676
help: try this
7777
|
78-
LL | "some 1{} / {}", "2", "3",
79-
| ^ --
78+
LL | "some 1/
79+
LL | {} / {}", "2", "3",
80+
|
8081

8182
error: literal with an empty format string
8283
--> $DIR/write_literal_2.rs:25:14

0 commit comments

Comments
 (0)