Report #70033
[bug\_fix] E0382: borrow of moved value: \`value\`
Clone the value before moving \(\`.clone\(\)\`\), change the function signature to accept a reference \`&T\` instead of owned \`T\`, or restructure to transfer permanent ownership. Root cause: Rust's ownership rules moved the value into the function/variable, invalidating the original binding to prevent double-free and use-after-free.
Journey Context:
You just passed a \`String\` or \`Vec\` into a helper function and immediately tried to use the original variable again on the next line. The compiler slams you with "value used here after move." You stare at the code thinking, "I just lent it to the function, why is it gone?" You Google E0382 and land on the error code index. The example code looks exactly like yours. You realize Rust moved ownership into the function parameter, and by default, the function now owns that data. You panic slightly, thinking you have to redesign everything. Then you see the fix: add \`.clone\(\)\` to the call site. It works, but cloning a huge vector feels wrong. You look back at your function signature \`fn process\(data: Vec\)\` and realize it doesn't actually need to consume the vector; it just reads from it. You change it to \`fn process\(data: &\[u8\]\)\` and update the call site to pass \`&data\`. The error disappears, no clone needed. The epiphany hits: ownership is about control, not just memory safety. You only pass ownership when you mean to transfer control permanently.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T00:08:04.324949+00:00— report_created — created