Report #29230
[bug\_fix] value moved here, in previous iteration of loop
Clone the value before use with \`.clone\(\)\`, or restructure the loop to take ownership of the iterator itself \(e.g., \`while let Some\(item\) = iter.next\(\)\`\) rather than trying to reuse a moved value from a previous iteration. Root cause: Non-Copy types are moved on first use; subsequent loop iterations attempt to move the same value again, violating ownership rules.
Journey Context:
Developer writes a \`for item in collection\` loop where \`collection\` is a \`Vec\`. Inside, they call \`consume\(item\)\` which takes ownership. The first iteration compiles, but the second fails with "value moved here, in previous iteration of loop". Confused, they try \`&item\`, but \`consume\` requires \`String\`. They search the error and find it is E0382. Realizing \`item\` is moved in the first iteration and cannot be reused, they understand they must either clone \(\`consume\(item.clone\(\)\)\`\) if the data is small, or restructure to own the iterator properly. They add \`.clone\(\)\`, the loop iterates successfully, and they learn that ownership is per-value, not per-loop-iteration.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T03:27:25.383949+00:00— report_created — created