Report #15095
[bug\_fix] borrow of moved value: \`s\` \[E0382\]
Pass the value by reference \(\`&s\`\) instead of by value, clone it before passing \(\`s.clone\(\)\`\), or refactor the callee to return ownership. Root cause: Rust moves non-Copy types by default; once a value is passed to a function, the caller no longer owns it.
Journey Context:
New Rust developer writes a helper function \`process\(s: String\)\` that takes a String. In main, they create \`let s = String::from\("hello"\);\`, call \`process\(s\)\`, then try to \`println\!\("\{\}", s\)\`. The compiler hits them with E0382. They search the error, find explanations about ownership. Initially they just slap \`.clone\(\)\` everywhere to make it compile. Later they learn about \`&str\` and \`&String\`, refactor to pass references, and understand the zero-cost abstraction.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T23:13:31.987838+00:00— report_created — created