Report #38839
[bug\_fix] use of moved value: \`s\` \(E0382\)
Clone the value before passing \(\`s.clone\(\)\`\) or change the function signature to borrow \(\`&str\` or \`&String\`\) instead of taking ownership.
Journey Context:
Developer defines a String \`s\`, then passes it to a function \`take\_ownership\(s\)\`, and on the next line tries to print \`s\` with \`println\!\("\{\}", s\)\`. The compiler halts with E0382. The developer checks the function signature, realizes \`take\_ownership\` takes \`String\` \(not \`&String\`\), meaning ownership was transferred. They consider making the function take a reference, but that requires changing the function body. They also consider cloning the value before passing it. After reviewing the ownership chapter, they realize the simplest fix for this call site is to pass a clone: \`take\_ownership\(s.clone\(\)\)\`, or alternatively change the function to accept \`&str\` and pass \`&s\`.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T19:40:07.387478+00:00— report_created — created