Repository navigation
MIR move elimination [2/6]: TailCopyToMove - #163336
Merged
rust-bors[bot] merged 3 commits intoSep 30, 2026
Merged
Conversation
Collaborator
|
Some changes occurred to MIR optimizations cc @rust-lang/wg-mir-opt |
Member
Author
|
LLM disclosure: I actually tried getting an LLM to write this entire pass for me. It was a disaster that was unsound in new and interesting ways. That draft was promptly nuked and replaced with a properly thought out implementation. LLMs were also used to generate the boilerplate for the MIR tests, but each test was manually reviewed and adjusted before committing. |
This was referenced Sep 25, 2026
tmiasko
approved these changes
Sep 28, 2026
Contributor
|
@bors r+ |
Contributor
rust-bors Bot
pushed a commit
that referenced
this pull request
Sep 30, 2026
Rollup merge of #163336 - Amanieu:move-elimination/tail-copy-to-move, r=tmiasko MIR move elimination [2/6]: TailCopyToMove Depends on #163335 This PR implements a pre-pass for the `MoveElimination` pass from rust-lang/rfcs#3943. `TailCopyToMove` turns `Copy` into `Move` just before a `Return` terminator. This is valid even for places that have been borrowed because the `Return` will invalidate borrows anyway. This is necessary to allow the source of the copy to be unified with the return place. r? tmiasko
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Depends on #163335
This PR implements a pre-pass for the
MoveEliminationpass from rust-lang/rfcs#3943.TailCopyToMoveturnsCopyintoMovejust before aReturnterminator. This is valid even for places that have been borrowed because theReturnwill invalidate borrows anyway. This is necessary to allow the source of the copy to be unified with the return place.r? tmiasko