File tree 1 file changed +22
-1
lines changed
1 file changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -73,14 +73,35 @@ fn main() {
73
73
74
74
To fix this, ensure that any declared variables are initialized before being
75
75
used.
76
+ "## ,
77
+
78
+ E0384 : r##"
79
+ This error occurs when an attempt is made to reassign an immutable variable.
80
+ For example:
81
+
82
+ ```
83
+ fn main(){
84
+ let x = 3;
85
+ x = 5; // error, reassignment of immutable variable
86
+ }
87
+ ```
88
+
89
+ By default, variables in Rust are immutable. To fix this error, add the keyword
90
+ `mut` after the keyword `let` when declaring the variable. For example:
91
+
92
+ ```
93
+ fn main(){
94
+ let mut x = 3;
95
+ x = 5;
96
+ }
97
+ ```
76
98
"##
77
99
78
100
}
79
101
80
102
register_diagnostics ! {
81
103
E0382 , // use of partially/collaterally moved value
82
104
E0383 , // partial reinitialization of uninitialized structure
83
- E0384 , // reassignment of immutable variable
84
105
E0385 , // {} in an aliasable location
85
106
E0386 , // {} in an immutable container
86
107
E0387 , // {} in a captured outer variable in an `Fn` closure
You can’t perform that action at this time.
0 commit comments