Skip to content

mir: validate Move call arguments are locals or box derefs - #160651

Draft
rabindra789 wants to merge 1 commit into
rust-lang:mainfrom
rabindra789:fix/mir-verifier-move-call-args
Draft

mir: validate Move call arguments are locals or box derefs#160651
rabindra789 wants to merge 1 commit into
rust-lang:mainfrom
rabindra789:fix/mir-verifier-move-call-args

Conversation

@rabindra789

@rabindra789 rabindra789 commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Fixes #103362.

When a Call or TailCall argument is Operand::Move(place), the callee receives the place by reference. Such moves are only valid for plain locals or the contents of a box (a single Deref of a box-typed local).

Add a verifier check under -Zvalidate-mir, using the same phase gate as the existing Operand::Copy validation. This avoids affecting the unconditional validation after the final optimization phase.

The regression test uses custom MIR to verify that invalid move arguments are rejected. Rustc-generated MIR is unaffected because move arguments are materialized into temporaries before calls.

@rustbot

rustbot commented Aug 6, 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 Aug 6, 2026
@rustbot

rustbot commented Aug 6, 2026

Copy link
Copy Markdown
Collaborator

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 75 candidates
  • Random selection from 18 candidates

@rabindra789
rabindra789 marked this pull request as draft August 6, 2026 18:27
@rustbot rustbot 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 Aug 6, 2026
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.

Check that arguments are only moving locals or box contents in the mir verifier

3 participants