Report #10816
[bug\_fix] borrow of moved value: \`s\` \(E0382\)
Clone the value if both variables need to own the data \(\`let s2 = s.clone\(\);\`\), or restructure to use references \(\`&s\`\) instead of moving ownership. Root cause: Types like \`String\` and \`Vec\` do not implement the \`Copy\` trait; assignment moves ownership, invalidating the source variable to prevent double-free errors.
Journey Context:
A developer writes \`let name = String::from\("Alice"\); process\(name\); println\!\("\{\}", name\);\` where \`process\` takes \`String\`. The compiler stops with E0382, stating "value moved here" and "borrow of moved value". Confused, coming from a GC language, they think "I just passed it, why is it gone?" They search the error and find explanations about ownership. They try \`process\(&name\)\` to pass a reference, which works because it doesn't transfer ownership. Later, they encounter a case where they truly need two owned copies and discover \`name.clone\(\)\`, understanding the trade-off between copying and moving.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T11:44:37.424796+00:00— report_created — created