Issue #1138: A drain / for mut element match handed to a mut parameter gives partially moved

Open and answer this issue on GitHub.

ready · opened 2026-11-01 · updated 2026-11-01 · 0 comments

Found by the r3c move of type_rules (#125), docs/briefs/r3c-type-rules-direct.md.report.md; the case is on branch wip/r3c-type-rules-chunk2.

Matching an element of a for mut loop (or of a drain) and handing the matched value, or a part of it, to a mut parameter lowers to Rust that rustc refuses with use of partially moved value. 5a18a962 made a part handed to a mut parameter lent; the match on the element still moves.

To build:

Back to Open Issues