Skip to content

Keep known_panics_lint values across single-predecessor assert edges - #164998

Open
yashaggarwal85d wants to merge 2 commits into
rust-lang:mainfrom
yashaggarwal85d:fix-known-panics-lint-across-assert
Open

yashaggarwal85d wants to merge 2 commits into
rust-lang:mainfrom
yashaggarwal85d:fix-known-panics-lint-across-assert

Conversation

@yashaggarwal85d

@yashaggarwal85d yashaggarwal85d commented Oct 26, 2026 •

Copy link
Copy Markdown

KnownPanicsLint drops values of locals that are assigned more than once at the end of each block.
With overflow checks on, x >>= n puts an assert before the shift, so the shift ends up in the next
block and the lint loses x right there. This keeps visiting into the assert/goto target when it has
only one predecessor, and clears those locals once that chain ends.

Same applies to /= and %= (div-by-zero assert), which were missed even with -O.

Fixes #164191

@rustbot

rustbot commented Oct 26, 2026

Copy link
Copy Markdown
Collaborator

Some changes occurred to MIR optimizations

cc @rust-lang/wg-mir-opt

@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 Oct 26, 2026
@rustbot

rustbot commented Oct 26, 2026

Copy link
Copy Markdown
Collaborator

r? @JonathanBrouwer

rustbot has assigned @JonathanBrouwer.
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, mir, mir-opt
  • compiler, mir, mir-opt expanded to 77 candidates
  • Random selection from 19 candidates

@oli-obk

This comment was marked as resolved.

@oli-obk oli-obk closed this Oct 28, 2026
@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Oct 28, 2026
@oli-obk

oli-obk commented Oct 29, 2026

Copy link
Copy Markdown
Contributor

Reopening after a conversation with the author

@oli-obk oli-obk reopened this Oct 29, 2026
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Oct 29, 2026
@JonathanBrouwer

JonathanBrouwer commented Oct 30, 2026 •

Copy link
Copy Markdown
Member

@rustbot reroll
Not familiar enough with this code to feel comfortable reviewing

@rustbot rustbot assigned oli-obk and unassigned JonathanBrouwer Oct 30, 2026

This branch has not been deployed

No deployments
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.

arithmetic_overflow is missed after x >>= n when overflow checks are on

4 participants