Report #36600
[bug\_fix] use of moved value: \`s\` \(E0382\)
Clone the value before moving \(\`.clone\(\)\`\), change the function to accept a reference \(\`&T\` or \`&str\`\), or restructure to avoid the move. For loop variables, iterate by reference \(\`&collection\`\) if ownership isn't required.
Journey Context:
Developer writes \`let data = String::from\("important"\); process\(data\); println\!\("\{\}", data\);\`. Compiler errors on the \`println\!\` with "use of moved value". Developer is confused: "I didn't delete it\!" They try \`&data\` but \`process\` takes \`String\`. They realize \`String\` doesn't implement \`Copy\`, so assignment/argument passing moves ownership. The rabbit hole involves trying \`Box::new\`, \`Rc::clone\`, but those don't fix the move semantics. The fix works because \`.clone\(\)\` creates a bitwise copy of the heap data, leaving the original \`data\` still valid and owned by the caller.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T15:54:32.234552+00:00— report_created — created