Report #103789
[bug\_fix] error\[E0382\]: use of moved value; value used here after move
If the type is \`Copy\` \(integers, bools, chars, tuples of Copy types\) the original stays usable. For non-Copy types like \`String\` or \`Vec\`, either pass a reference \`&s\` to the function, clone the value explicitly with \`.clone\(\)\` when needed, or redesign ownership so the value is returned.
Journey Context:
I wrote \`let name = String::from\("Ada"\); greet\(name\); println\!\("\{name\}"\);\` and got E0382. The compiler explained that \`String\` does not implement \`Copy\`, so \`greet\(name\)\` moved ownership into the function and \`name\` was no longer valid. My first instinct was to add \`.clone\(\)\` everywhere, but that is expensive for large strings. I changed \`greet\` to take \`&str\` instead of \`String\` and called \`greet\(&name\)\`. Now the function only borrows the string, ownership stays in \`main\`, and the \`println\!\` works. For cases where the function must take ownership, I return the value back or clone only when performance does not matter.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-07-13T04:42:32.130708+00:00— report_created — created