Skip to content

Fix ICE in span_extend_prev_while with multibyte characters#155068

Open
lapla-cogito wants to merge 1 commit intorust-lang:mainfrom
lapla-cogito:multibyte_char
Open

Fix ICE in span_extend_prev_while with multibyte characters#155068
lapla-cogito wants to merge 1 commit intorust-lang:mainfrom
lapla-cogito:multibyte_char

Conversation

@lapla-cogito
Copy link
Copy Markdown
Contributor

Fixes #155037

The function assumed that the character found by rfind was always one byte wide, using a hardcoded 1 instead of c.len_utf8(). When a multibyte character appeared immediately before the span, this caused the resulting span to point into the middle of a UTF-8 sequence, triggering an assertion failure in bytepos_to_file_charpos.

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Apr 9, 2026
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Apr 9, 2026

r? @mati865

rustbot has assigned @mati865.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: compiler
  • compiler expanded to 69 candidates
  • Random selection from 12 candidates

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[ICE]: bpos.to_u32() >= mbc.pos.to_u32() + mbc.bytes as u32

3 participants