]> git.proxmox.com Git - rustc.git/blob - src/librustc_error_codes/error_codes/E0384.md
New upstream version 1.47.0+dfsg1
[rustc.git] / src / librustc_error_codes / error_codes / E0384.md
1 An immutable variable was reassigned.
2
3 Erroneous code example:
4
5 ```compile_fail,E0384
6 fn main() {
7 let x = 3;
8 x = 5; // error, reassignment of immutable variable
9 }
10 ```
11
12 By default, variables in Rust are immutable. To fix this error, add the keyword
13 `mut` after the keyword `let` when declaring the variable. For example:
14
15 ```
16 fn main() {
17 let mut x = 3;
18 x = 5;
19 }
20 ```