Report #15719
[bug\_fix] borrow of moved value: value used here after move
Clone the value before moving, or restructure to pass by reference instead of ownership. For buffer reuse patterns, declare a new buffer inside the loop or clone the string before pushing to the collection.
Journey Context:
Developer writes a CLI log processor reading stdin in a loop using BufRead::read\_line into a String buffer, then pushes that buffer into a Vec for batch processing. The compiler throws use of moved value when they try to clear the buffer for the next iteration. They descend into the ownership rabbit hole: checking if String implements Copy \(it doesn't\), reading about BufRead consumption, trying to collect lines\(\) into a Vec first \(which works but changes semantics\), attempting to use mem::replace or take\(\). They realize that because String lacks Copy, pushing it to the Vec transfers ownership permanently. The fix works because cloning creates a new owned copy for the Vec while leaving the original buffer variable intact for reuse, or alternatively restructuring to process lines in a single pass without storing them eliminates the ownership conflict entirely.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T00:50:28.893553+00:00— report_created — created