File tree 1 file changed +24
-1
lines changed
1 file changed +24
-1
lines changed Original file line number Diff line number Diff line change @@ -286,6 +286,30 @@ You can read more about cell types in the API documentation:
286
286
https://doc.rust-lang.org/std/cell/
287
287
"## ,
288
288
289
+ E0388 : r##"
290
+ A mutable borrow was attempted in a static location.
291
+
292
+ Erroneous code example:
293
+
294
+ ```compile_fail,E0388
295
+ static X: i32 = 1;
296
+
297
+ static STATIC_REF: &'static mut i32 = &mut X;
298
+ // error: cannot borrow data mutably in a static location
299
+
300
+ const CONST_REF: &'static mut i32 = &mut X;
301
+ // error: cannot borrow data mutably in a static location
302
+ ```
303
+
304
+ To fix this error, you have to use constant borrow:
305
+
306
+ ```
307
+ static X: i32 = 1;
308
+
309
+ static STATIC_REF: &'static i32 = &X;
310
+ ```
311
+ "## ,
312
+
289
313
E0389 : r##"
290
314
An attempt was made to mutate data using a non-mutable reference. This
291
315
commonly occurs when attempting to assign to a non-mutable reference of a
@@ -1113,6 +1137,5 @@ fn main() {
1113
1137
1114
1138
register_diagnostics ! {
1115
1139
E0385 , // {} in an aliasable location
1116
- E0388 , // {} in a static location
1117
1140
E0524 , // two closures require unique access to `..` at the same time
1118
1141
}
You can’t perform that action at this time.
0 commit comments