Report #14497
[bug\_fix] use of moved value: \`x\` — attempting to use a value after transferring ownership to a function or binding
Change the function signature to accept a reference \`&str\` instead of an owned \`String\`, or explicitly clone the value if shared ownership is required. The root cause is that \`String\` does not implement \`Copy\`, so passing it to a function moves ownership, invalidating the original binding.
Journey Context:
You are parsing a configuration file in a CLI tool, calling \`process\_config\(text\)\` where \`text\` is a \`String\` read from disk. After the call, you attempt to log the original \`text\` for debugging, but the compiler halts with "use of moved value". You initially suspect a compiler bug because you "didn't delete the variable." After reading the error spans, you realize \`process\_config\` took ownership. You try cloning inside the function, which works but feels inefficient. You then refactor the signature to take \`&str\`, allowing the function to borrow the data without taking ownership, eliminating the move entirely and satisfying the borrow checker without runtime overhead.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T21:44:38.589532+00:00— report_created — created