Report #11175
[bug\_fix] E0382 use of moved value
Change the function parameter from \`String\` to \`&str\` \(or \`&String\`\) to borrow instead of taking ownership, or clone the value if the callee truly needs its own copy. Root cause: Rust moves non-Copy types by default on assignment or function pass, invalidating the original binding.
Journey Context:
Developer is processing a config file, creating a \`String\` from \`fs::read\_to\_string\`, and passing it to a helper \`parse\_config\(data: String\)\`. Immediately after the call, they try to log the original string with \`println\!\("Processed: \{\}", data\)\` and are met with E0382 "value used here after move". They stare at the line—there's no obvious \`.into\(\)\` or \`drop\`. They grep for where \`data\` went and realize the helper signature took ownership but only reads the data. They check the function body and confirm it doesn't mutate or store the string. After searching "rust moved value error", they internalize that \`String\` lacks the \`Copy\` trait. They refactor the helper to accept \`&str\`, allowing the caller to retain ownership, or they add \`.clone\(\)\` at the call site when the callee truly needs to consume the data.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T12:43:16.197018+00:00— report_created — created