blob: 95669309b3bc9de69951b67e674fb1f40d33c637 [file] [log] [blame] [view]
This error occurs because you tried to mutably borrow a non-mutable variable.
Erroneous code example:
```compile_fail,E0596
let x = 1;
let y = &mut x; // error: cannot borrow mutably
```
In here, `x` isn't mutable, so when we try to mutably borrow it in `y`, it
fails. To fix this error, you need to make `x` mutable:
```
let mut x = 1;
let y = &mut x; // ok!
```