Skip to content

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

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

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

View all comments

Fixes #103362.

This PR adds a MIR validation check for Move arguments passed to Call and TailCall terminators.
A moved argument should be either a local or the contents of the Box. Other places can deinitialize memory that codegen does not track correctly. The check is only enabled with -Zvalidate-mir, using the same phase restriction as the existing Copy check.
Added a regression test covering the invalid case.

@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
@rabindra789
rabindra789 force-pushed the fix/mir-verifier-move-call-args branch from 6cf4605 to 1154159 Compare August 7, 2026 06:08
@rabindra789
rabindra789 marked this pull request as ready for review August 7, 2026 06:17
@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 Aug 7, 2026
@oli-obk

oli-obk commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

r? @WaffleLapkin

@rustbot

rustbot commented Aug 7, 2026

Copy link
Copy Markdown
Collaborator

WaffleLapkin is not on the review rotation at the moment.
They may take a while to respond.

@theemathas

This comment was marked as resolved.

@rabindra789

This comment was marked as resolved.

@theemathas

This comment was marked as resolved.

@WaffleLapkin WaffleLapkin left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@rust-bors

rust-bors Bot commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 1154159 has been approved by WaffleLapkin

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 Aug 26, 2026
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Aug 26, 2026
…call-args, r=WaffleLapkin

mir: validate `Move` call arguments are locals or box derefs

Fixes rust-lang#103362.

This PR adds a MIR validation check for `Move` arguments passed to `Call` and `TailCall` terminators.
A moved argument should be either a local or the contents of the `Box`. Other places can deinitialize memory that codegen does not track correctly. The check is only enabled with `-Zvalidate-mir`, using the same phase restriction as the existing `Copy` check.
Added a regression test covering the invalid case.
rust-bors Bot pushed a commit that referenced this pull request Aug 26, 2026
…uwer

Rollup of 4 pull requests

Successful merges:

 - #160651 (mir: validate `Move` call arguments are locals or box derefs)
 - #161736 (Tidy: show todo reason when lint fails (and fix the lint's tidy allow statement which was weird and broken...))
 - #161052 (Add regression test for generic inference)
 - #161818 (Fix long type on diagnostics for conditionally implemented traits)
@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Aug 26, 2026
…r=WaffleLapkin

mir: validate `Move` call arguments are locals or box derefs

Fixes #103362.

This PR adds a MIR validation check for `Move` arguments passed to `Call` and `TailCall` terminators.
A moved argument should be either a local or the contents of the `Box`. Other places can deinitialize memory that codegen does not track correctly. The check is only enabled with `-Zvalidate-mir`, using the same phase restriction as the existing `Copy` check.
Added a regression test covering the invalid case.
@rust-bors rust-bors Bot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Aug 26, 2026
@rustbot

rustbot commented Aug 27, 2026

Copy link
Copy Markdown
Collaborator

This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

@rustbot rustbot removed has-merge-commits PR has merge commits, merge with caution. S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Aug 27, 2026
@rabindra789

Copy link
Copy Markdown
Contributor Author

@rustbot review

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Aug 31, 2026
@WaffleLapkin

Copy link
Copy Markdown
Member

@bors try jobs=x86_64-gnu-tools

@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Sep 4, 2026
…r=<try>

mir: validate `Move` call arguments are locals or box derefs


try-job: x86_64-gnu-tools
@rust-bors

rust-bors Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

☀️ Try build successful (CI)
Build commit: a8661e7 (a8661e725bbbea354f1a138aa033aeb4fdc17490)
Base parent: 0ed41eb (0ed41eb4142dda2df61eb1145a312c1a9d62eb56)

@WaffleLapkin WaffleLapkin left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@bors r+

looks like the rollup failure was unrelated to this PR... fun.

View changes since this review

@rust-bors

rust-bors Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 98f4067 has been approved by WaffleLapkin

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 Sep 8, 2026
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Sep 8, 2026
…call-args, r=WaffleLapkin

mir: validate `Move` call arguments are locals or box derefs

Fixes rust-lang#103362.

This PR adds a MIR validation check for `Move` arguments passed to `Call` and `TailCall` terminators.
A moved argument should be either a local or the contents of the `Box`. Other places can deinitialize memory that codegen does not track correctly. The check is only enabled with `-Zvalidate-mir`, using the same phase restriction as the existing `Copy` check.
Added a regression test covering the invalid case.
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Sep 8, 2026
…call-args, r=WaffleLapkin

mir: validate `Move` call arguments are locals or box derefs

Fixes rust-lang#103362.

This PR adds a MIR validation check for `Move` arguments passed to `Call` and `TailCall` terminators.
A moved argument should be either a local or the contents of the `Box`. Other places can deinitialize memory that codegen does not track correctly. The check is only enabled with `-Zvalidate-mir`, using the same phase restriction as the existing `Copy` check.
Added a regression test covering the invalid case.
rust-bors Bot pushed a commit that referenced this pull request Sep 8, 2026
…uwer

Rollup of 8 pull requests

Successful merges:

 - #160505 (delegation: supporting inherent impls)
 - #160651 (mir: validate `Move` call arguments are locals or box derefs)
 - #161806 (Add tests and docs for `#[derive(GenericTypeVisitable)]`)
 - #161912 (run `extern "tail"` with `byval` argument test)
 - #162435 (windows-gnu: document libgcc requirement)
 - #162439 (Update books)
 - #162459 (docs(time): replace "method" with "function")
 - #162465 (Fix my duplicate thanks entry)
rust-bors Bot pushed a commit that referenced this pull request Sep 8, 2026
…uwer

Rollup of 8 pull requests

Successful merges:

 - #160505 (delegation: supporting inherent impls)
 - #160651 (mir: validate `Move` call arguments are locals or box derefs)
 - #161806 (Add tests and docs for `#[derive(GenericTypeVisitable)]`)
 - #161912 (run `extern "tail"` with `byval` argument test)
 - #162435 (windows-gnu: document libgcc requirement)
 - #162439 (Update books)
 - #162459 (docs(time): replace "method" with "function")
 - #162465 (Fix my duplicate thanks entry)
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Sep 8, 2026
…call-args, r=WaffleLapkin

mir: validate `Move` call arguments are locals or box derefs

Fixes rust-lang#103362.

This PR adds a MIR validation check for `Move` arguments passed to `Call` and `TailCall` terminators.
A moved argument should be either a local or the contents of the `Box`. Other places can deinitialize memory that codegen does not track correctly. The check is only enabled with `-Zvalidate-mir`, using the same phase restriction as the existing `Copy` check.
Added a regression test covering the invalid case.
rust-bors Bot pushed a commit that referenced this pull request Sep 8, 2026
…uwer

Rollup of 10 pull requests

Successful merges:

 - #162470 (Subtree sync for rustc_codegen_cranelift)
 - #160505 (delegation: supporting inherent impls)
 - #160651 (mir: validate `Move` call arguments are locals or box derefs)
 - #161806 (Add tests and docs for `#[derive(GenericTypeVisitable)]`)
 - #161912 (run `extern "tail"` with `byval` argument test)
 - #162435 (windows-gnu: document libgcc requirement)
 - #162439 (Update books)
 - #162451 (Add regression test for item-local diagnostic attribute lint levels)
 - #162459 (docs(time): replace "method" with "function")
 - #162465 (Fix my duplicate thanks entry)
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Sep 8, 2026
…call-args, r=WaffleLapkin

mir: validate `Move` call arguments are locals or box derefs

Fixes rust-lang#103362.

This PR adds a MIR validation check for `Move` arguments passed to `Call` and `TailCall` terminators.
A moved argument should be either a local or the contents of the `Box`. Other places can deinitialize memory that codegen does not track correctly. The check is only enabled with `-Zvalidate-mir`, using the same phase restriction as the existing `Copy` check.
Added a regression test covering the invalid case.
rust-bors Bot pushed a commit that referenced this pull request Sep 8, 2026
…uwer

Rollup of 9 pull requests

Successful merges:

 - #160505 (delegation: supporting inherent impls)
 - #160651 (mir: validate `Move` call arguments are locals or box derefs)
 - #161806 (Add tests and docs for `#[derive(GenericTypeVisitable)]`)
 - #161912 (run `extern "tail"` with `byval` argument test)
 - #162435 (windows-gnu: document libgcc requirement)
 - #162439 (Update books)
 - #162451 (Add regression test for item-local diagnostic attribute lint levels)
 - #162459 (docs(time): replace "method" with "function")
 - #162465 (Fix my duplicate thanks entry)
@rust-bors rust-bors Bot 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-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Sep 8, 2026
@rust-bors

rust-bors Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

The bors config at rust-bors.toml is invalid in this PR. Parse error:

TOML parse error at line 87, column 5
   |
87 |     "arm64ami" = "latest-gha-runner-ami-arm64"
   |     ^
missing comma between key-value pairs, expected `,`

rust-bors Bot pushed a commit that referenced this pull request Sep 8, 2026
…uwer

Rollup of 9 pull requests

Successful merges:

 - #160505 (delegation: supporting inherent impls)
 - #160651 (mir: validate `Move` call arguments are locals or box derefs)
 - #161806 (Add tests and docs for `#[derive(GenericTypeVisitable)]`)
 - #161912 (run `extern "tail"` with `byval` argument test)
 - #162435 (windows-gnu: document libgcc requirement)
 - #162439 (Update books)
 - #162451 (Add regression test for item-local diagnostic attribute lint levels)
 - #162459 (docs(time): replace "method" with "function")
 - #162465 (Fix my duplicate thanks entry)
@theemathas

Copy link
Copy Markdown
Contributor

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

6 participants