Commit f984966
authored
Rollup merge of rust-lang#146899 - Teapot4195:issue-146847-fix, r=nnethercote
Fix a crash/mislex when more than one frontmatter closing possibility is considered
When the less fortunate recovery path for frontmatters are taken, if the lexer considers more than one possible frontmatter closing possibility, the current index is entirely mis-tracked and can result in bump_bytes landing in the middle of a multichar unicode character.
This fixes it by tracking the actual base index and updating it as it considers additional closing possibilities.
fixes rust-lang#146847File tree
3 files changed
+34
-1
lines changed- compiler/rustc_lexer/src
- tests/ui/frontmatter
3 files changed
+34
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
599 | 599 | | |
600 | 600 | | |
601 | 601 | | |
| 602 | + | |
602 | 603 | | |
603 | 604 | | |
604 | 605 | | |
605 | 606 | | |
606 | | - | |
| 607 | + | |
607 | 608 | | |
608 | 609 | | |
609 | 610 | | |
| 611 | + | |
610 | 612 | | |
611 | 613 | | |
612 | 614 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
0 commit comments