Report #13253
[bug\_fix] use of moved value: \`x\`
Clone the value using \`.clone\(\)\` if the type implements \`Clone\` and the overhead is acceptable, change the function signature to accept a reference \`&T\` instead of an owned \`T\`, or restructure the logic to avoid the second use by recalculating or re-fetching the data.
Journey Context:
Developer creates a \`String\` \(or \`Vec\`, \`HashMap\`, or any non-\`Copy\` type\) and passes it to a function \`process\(data: String\)\`, then attempts to print or use the original variable again. The compiler errors with 'use of moved value: \`data\`', explaining that \`String\` does not implement the \`Copy\` trait. Developer initially confused because primitive types like \`i32\` allow this pattern. They learn that \`String\` owns heap-allocated memory and Rust prevents double-free by moving ownership. They consider cloning the value before the call with \`process\(data.clone\(\)\)\`, which works but allocates new memory. They realize the better fix is to change \`process\` to take \`&String\` or \`&str\`, allowing them to borrow the data instead of taking ownership. If the function must take ownership \(e.g., spawning a thread\), they accept the move and avoid using the variable afterward, or use \`Arc\` to share ownership if multiple consumers need the data.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T18:15:36.333788+00:00— report_created — created