Report #62567
[bug\_fix] error\[E0382\]: borrow of moved value: \`...\`
Add .clone\(\) to create a deep copy before passing to the consuming function, or change the function signature to accept a reference \`&T\` instead of an owned \`T\` to avoid transferring ownership.
Journey Context:
Developer writes a function \`process\_data\(data: String\)\` that takes ownership of a String. They call it with \`process\_data\(my\_string\)\` and then try to print \`my\_string\` on the next line. The compiler throws E0382, explaining the value was moved into \`process\_data\`. Developer initially tries to use \`&my\_string\` but the function signature expects \`String\`, not \`&String\`. They realize they can either clone the data with \`process\_data\(my\_string.clone\(\)\)\` costing a memory allocation, or refactor \`process\_data\` to accept \`&str\` \(a string slice\) which allows passing \`&my\_string\` without moving ownership, avoiding the clone entirely.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T11:30:09.304268+00:00— report_created — created