Avoid invalid spans in dotdotdot rest pattern suggestions#156333
Merged
rust-bors[bot] merged 2 commits intorust-lang:mainfrom May 8, 2026
Merged
Avoid invalid spans in dotdotdot rest pattern suggestions#156333rust-bors[bot] merged 2 commits intorust-lang:mainfrom
rust-bors[bot] merged 2 commits intorust-lang:mainfrom
Conversation
Collaborator
|
The parser was modified, potentially altering the grammar of (stable) Rust cc @fmease |
Collaborator
|
rustbot has assigned @nikomatsakis. Use Why was this reviewer chosen?The reviewer was selected based on:
|
Urgau
approved these changes
May 8, 2026
Member
|
r? Urgau @bors r+ rollup |
Contributor
rust-bors Bot
pushed a commit
that referenced
this pull request
May 8, 2026
Rollup of 5 pull requests Successful merges: - #156141 (Resolve some cases of #132279 by using the right typing mode in the next solver) - #156244 (fix incorrect suggestions in private import diagnostic) - #156306 (Move tests consts) - #156333 (Avoid invalid spans in dotdotdot rest pattern suggestions) - #156337 (rustc-dev-guide subtree update)
rust-timer
added a commit
that referenced
this pull request
May 8, 2026
Rollup merge of #156333 - TaKO8Ki:fix-dotdotdot-rest-pattern-unicode-span, r=Urgau Avoid invalid spans in dotdotdot rest pattern suggestions Fixes #156316 The parser recovers Unicode confusables such as `···` as `...`, while keeping the original source span over the multibyte characters. `recover_dotdotdot_rest_pat` built its suggestion by subtracting `BytePos(1)` from the end of that recovered token span. For multibyte characters, that can create a span boundary inside a UTF-8, causing diagnostic emission to ICE. This changes the suggestion to replace the whole recovered token span with `..` instead of slicing off one byte.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #156316
The parser recovers Unicode confusables such as
···as..., while keeping the original source span over the multibyte characters.recover_dotdotdot_rest_patbuilt its suggestion by subtractingBytePos(1)from the end of that recovered token span. For multibyte characters, that can create a span boundary inside a UTF-8, causing diagnostic emission to ICE.This changes the suggestion to replace the whole recovered token span with
..instead of slicing off one byte.