File tree Expand file tree Collapse file tree 1 file changed +24
-1
lines changed
Expand file tree Collapse file tree 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:
286286https://doc.rust-lang.org/std/cell/
287287"## ,
288288
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+
289313E0389 : r##"
290314An attempt was made to mutate data using a non-mutable reference. This
291315commonly occurs when attempting to assign to a non-mutable reference of a
@@ -1113,6 +1137,5 @@ fn main() {
11131137
11141138register_diagnostics ! {
11151139 E0385 , // {} in an aliasable location
1116- E0388 , // {} in a static location
11171140 E0524 , // two closures require unique access to `..` at the same time
11181141}
You can’t perform that action at this time.
0 commit comments