close
Skip to content

Fix ICE in borrowck mutability suggestion with multi-byte ref sigil#155428

Merged
rust-bors[bot] merged 1 commit intorust-lang:mainfrom
lapla-cogito:issue_139089
Apr 18, 2026
Merged

Fix ICE in borrowck mutability suggestion with multi-byte ref sigil#155428
rust-bors[bot] merged 1 commit intorust-lang:mainfrom
lapla-cogito:issue_139089

Conversation

@lapla-cogito
Copy link
Copy Markdown
Contributor

@lapla-cogito lapla-cogito commented Apr 17, 2026

Fixes #139089

Similarly to #155068, this is another instance where span arithmetic did not account for multi-byte characters. (Note that the ampersand in the test is full-width)

This change also results in correcting some inappropriate suggestions.

@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 17, 2026
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Apr 17, 2026

r? @jackh726

rustbot has assigned @jackh726.
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 72 candidates
  • Random selection from 18 candidates

@rust-log-analyzer

This comment has been minimized.

@lapla-cogito lapla-cogito force-pushed the issue_139089 branch 2 times, most recently from f82751b to 4556034 Compare April 17, 2026 11:23
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Apr 17, 2026

This PR changes a file inside tests/crashes. If a crash was fixed, please move into the corresponding ui subdir and add 'Fixes #' to the PR description to autoclose the issue upon merge.

Copy link
Copy Markdown
Contributor

@mejrs mejrs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment thread tests/ui/span/mutability-suggestion-fullwidth-ampersand.stderr
Comment thread compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs Outdated
@rustbot rustbot assigned mejrs and unassigned jackh726 Apr 17, 2026
@mejrs mejrs added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Apr 17, 2026
@rust-log-analyzer

This comment has been minimized.

Comment on lines -77 to -78
LL | unsafe fn named_ptr(x: *mut const (i32,)) {
| +++
Copy link
Copy Markdown
Contributor Author

@lapla-cogito lapla-cogito Apr 17, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This suggestion was incorrect.

View changes since the review

@lapla-cogito
Copy link
Copy Markdown
Contributor Author

@rustbot ready

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Apr 17, 2026
@mejrs
Copy link
Copy Markdown
Contributor

mejrs commented Apr 17, 2026

Thanks, just one more thing - can you add a code comment explaining why this exists? Something along the lines of "we may be dealing with parser recovery here and cannot assume the user actually typed &"?

r=me with comment

@mejrs mejrs added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Apr 17, 2026
@lapla-cogito
Copy link
Copy Markdown
Contributor Author

@rustbot ready

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Apr 17, 2026
Copy link
Copy Markdown
Contributor

@mejrs mejrs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors bot commented Apr 18, 2026

📌 Commit a779e05 has been approved by mejrs

It is now in the queue for this repository.

@rust-bors rust-bors bot added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Apr 18, 2026
jhpratt added a commit to jhpratt/rust that referenced this pull request Apr 18, 2026
Fix ICE in borrowck mutability suggestion with multi-byte ref sigil

Fixes rust-lang#139089

Similarly to rust-lang#155068, this is another instance where span arithmetic did not account for multi-byte characters. (Note that the ampersand in the test is full-width)

This change also results in correcting some inappropriate suggestions.
rust-bors bot pushed a commit that referenced this pull request Apr 18, 2026
Rollup of 12 pull requests

Successful merges:

 - #147811 (naked functions: respect `function-sections`)
 - #154935 (Add Sized supertrait for CoerceUnsized and DispatchFromDyn)
 - #139690 (`impl Default for RepeatN`)
 - #153511 (`std::any::TypeId`: remove misplaced "and" in `Unique<T>` example)
 - #154943 (Move recursion out of `MatchPairTree::for_pattern` helpers )
 - #155295 (Fix misleading "borrowed data escapes outside of function" diagnostic)
 - #155427 (ptr: update text in intro text to one in with_addr doc)
 - #155428 (Fix ICE in borrowck mutability suggestion with multi-byte ref sigil)
 - #155435 (rustdoc: Fix `redundant_explicit_links` incorrectly firing (or not firing) under certain scenarios)
 - #155450 (Remove unnecessary safety conditions related to unchecked uint arithmetic)
 - #155454 (docs: Fix typo in std/src/thready/scoped.rs)
 - #155467 (`std::error::Request`: clean up documentation)
@rust-bors rust-bors bot merged commit e3676b5 into rust-lang:main Apr 18, 2026
11 checks passed
@rustbot rustbot added this to the 1.97.0 milestone Apr 18, 2026
@lapla-cogito lapla-cogito deleted the issue_139089 branch April 18, 2026 08:15
rust-timer added a commit that referenced this pull request Apr 18, 2026
Rollup merge of #155428 - lapla-cogito:issue_139089, r=mejrs

Fix ICE in borrowck mutability suggestion with multi-byte ref sigil

Fixes #139089

Similarly to #155068, this is another instance where span arithmetic did not account for multi-byte characters. (Note that the ampersand in the test is full-width)

This change also results in correcting some inappropriate suggestions.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. 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: assertion failed: bpos.to_u32() >= mbc.pos.to_u32() + mbc.bytes as u32'

5 participants