# Rust: error[E0382]: borrow of moved value: `x`

**Code:** `E0382` · **Category:** Rust · **Seen on:** Rust

A value was moved (ownership transferred) and then used again.

## Meaning

Types like String and Vec move when passed by value or assigned. After a move, the original variable can’t be used. Borrow (&x), clone when you really need two owners, or restructure ownership.

## Common causes

- Passing a String/Vec by value to a function and using it after
- Moving into a closure (move ||) or thread
- Using a value after a for loop consumed it (for x in vec)

## Quick fix

1. Pass a reference (&value) instead
2. .clone() if you need an independent copy
3. Iterate by reference (for x in &vec)

## Detailed fix by platform

### Rust

1. 

```rust
fn print_len(s: &String) { println!("{}", s.len()); }
let name = String::from("Ada");
print_len(&name);
println!("{name}");   // still usable
```


## How to diagnose

1. **Move** — Line with "value moved here"
2. **Type** — Implements Copy?

---
Source: [WhatIsMyError](https://whatismyerror.com/errors/rust/e0382-borrow-of-moved-value)
