Skip to content

MIR move elimination [6/6]: Miri support - #163340

Draft
Amanieu wants to merge 16 commits into
rust-lang:mainfrom
Amanieu:move-elimination/miri
Draft

Amanieu wants to merge 16 commits into
rust-lang:mainfrom
Amanieu:move-elimination/miri

Conversation

@Amanieu

@Amanieu Amanieu commented Sep 25, 2026 •

Copy link
Copy Markdown
Member

Depends on #163335 and #163359

This PR implements the new MIR semantics from rust-lang/rfcs#3943 in Miri.

Notable changes:

  • Added a LocalValue::LiveUnallocated state to represent a local that is StorageLive but hasn't been eliminated yet.
  • eval_place_for_write will automatically allocate a local if needed.
  • Since evaluation of later operands can invalidate earlier operands (due to moves freeing the allocation), eval_operand returns a "snapshot" copy of the operand at the time it was evaluated. This uses a temporary allocation that is freed at the end of the current machine step.
  • Move operands with a bare local are evaluated by move_out_local: it snapshots the value and then frees the original allocation, switching the local to LiveUnallocated.
  • Calls now follow the evaluation order and behavior specified in the RFC. Tail calls follow the normal operand evaluation order.
  • Added EvaluatedRvalue which allows all rvalue operands to be evaluated and snapshotted (if needed) before the destination place of an assignment is evaluated.

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-clippy Relevant to the Clippy team. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Sep 25, 2026
@Amanieu

Amanieu commented Sep 25, 2026

Copy link
Copy Markdown
Member Author

LLM disclosure: the initial miri support for the new semantics was LLM generated, but I've been iterating on it for a few months now and there is little of that original draft left. LLMs were also used to generate the boilerplate for the Miri pass/fail tests, but each test was manually reviewed and adjusted before committing.

@rust-log-analyzer

This comment has been minimized.

@Amanieu Amanieu added the llm-assisted An LLM-assisted PR as defined by the LLM policy. Requires ahead-of-time consent by assignee. label Sep 25, 2026
@Amanieu
Amanieu force-pushed the move-elimination/miri branch from f01190d to 262618f Compare September 26, 2026 01:05
@rust-log-analyzer

This comment has been minimized.

@Amanieu
Amanieu force-pushed the move-elimination/miri branch from 262618f to 4b56c27 Compare September 26, 2026 05:16
@rustbot rustbot added the A-run-make Area: port run-make Makefiles to rmake.rs label Sep 26, 2026
@rust-log-analyzer

This comment was marked as outdated.

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

A-run-make Area: port run-make Makefiles to rmake.rs llm-assisted An LLM-assisted PR as defined by the LLM policy. Requires ahead-of-time consent by assignee. S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-clippy Relevant to the Clippy team. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants