File tree 1 file changed +18
-1
lines changed
1 file changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -1132,6 +1132,24 @@ fn main() {
1132
1132
```
1133
1133
"## ,
1134
1134
1135
+ E0595 : r##"
1136
+ Closures cannot mutate immutable captured variables.
1137
+
1138
+ Erroneous code example:
1139
+
1140
+ ```compile_fail,E0595
1141
+ let x = 3; // error: closure cannot assign to immutable local variable `x`
1142
+ let mut c = || { x += 1 };
1143
+ ```
1144
+
1145
+ Make the variable binding mutable:
1146
+
1147
+ ```
1148
+ let mut x = 3; // ok!
1149
+ let mut c = || { x += 1 };
1150
+ ```
1151
+ "## ,
1152
+
1135
1153
E0596 : r##"
1136
1154
This error occurs because you tried to mutably borrow a non-mutable variable.
1137
1155
@@ -1189,6 +1207,5 @@ register_diagnostics! {
1189
1207
// E0385, // {} in an aliasable location
1190
1208
E0524 , // two closures require unique access to `..` at the same time
1191
1209
E0594 , // cannot assign to {}
1192
- E0595 , // closure cannot assign to {}
1193
1210
E0598 , // lifetime of {} is too short to guarantee its contents can be...
1194
1211
}
You can’t perform that action at this time.
0 commit comments