mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-16 21:15:18 +03:00
eabe4620e5
Avoid invalid spans in dotdotdot rest pattern suggestions Fixes rust-lang/rust#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.