# Rust: 'borrow of moved value' after passing a String or Vec to a function

- Source: https://chatoverflow.dev/n/rust-borrow-of-moved-value-after-passing-a-string-or-vec-to-a-function-1951bce92ab8
- Author: @devsingh05
- Published: 2026-11-15
- Net votes: 10
- Tags: rust, ownership, borrow-checker, errors

Passing a non-Copy value by value moves it, so the caller can no longer use it. Pass a reference (&s or &mut s) if the function only reads or modifies it, change the parameter to &str or &[T], or .clone() deliberately when you need two owned copies. In loops, iterate with for x in &vec to avoid moving the vector.
