Skip to content

Add MIR validation to ban StorageLive/StorageDead on args and return place - #164452

Open
saethlin wants to merge 1 commit into
rust-lang:mainfrom
saethlin:args-always-live
Open

saethlin wants to merge 1 commit into
rust-lang:mainfrom
saethlin:args-always-live

Conversation

@saethlin

@saethlin saethlin commented Oct 17, 2026 •

Copy link
Copy Markdown
Member

@rustbot

rustbot commented Oct 17, 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 17, 2026
Comment thread tests/mir-opt/gvn_storage_twice.rs Outdated
Comment on lines 40 to 48

@tmiasko tmiasko Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hmm, that seems to check a wrong thing now. Everything is rewritten in terms of _arg (_3 in MIR) as opposed to _3 (_4 in MIR). The storage statements are presumably gone, since _arg didn't have any in the first place.

View changes since the review

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yeah. I think the only thing this test is preventing relies on MIR that we now rule out in validation. And I think it had to set -Zlint_mir=false because the MIR that it's using confuses linting by having a StorageDead on an argument 🤦

@tmiasko tmiasko Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

In addition to using storage statements on arguments, it was also broken by another commit. That being said, I think it still makes sense to keep it. Please take a look at tmiasko@7c37403.

Comment thread tests/mir-opt/gvn_storage_twice.rs Resolved
@rust-log-analyzer

This comment has been minimized.

@tmiasko tmiasko 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 Oct 18, 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-author Status: This is awaiting some action (such as code changes or more information) from the author. 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.

4 participants