File tree Expand file tree Collapse file tree 1 file changed +21
-1
lines changed Expand file tree Collapse file tree 1 file changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -160,6 +160,27 @@ fn main(){
160160```
161161"## ,
162162
163+ E0386 : r##"
164+ This error occurs when an attempt is made to mutate the target of a mutable
165+ reference stored inside an immutable container.
166+
167+ For example, this can happen when storing a `&mut` inside an immutable `Box`:
168+
169+ ```
170+ let mut x: i64 = 1;
171+ let y: Box<_> = Box::new(&mut x);
172+ **y = 2; // error, cannot assign to data in an immutable container
173+ ```
174+
175+ This error can be fixed by making the container mutable:
176+
177+ ```
178+ let mut x: i64 = 1;
179+ let mut y: Box<_> = Box::new(&mut x);
180+ **y = 2;
181+ ```
182+ "## ,
183+
163184E0387 : r##"
164185This error occurs when an attempt is made to mutate or mutably reference data
165186that a closure has captured immutably. Examples of this error are shown below:
@@ -219,7 +240,6 @@ https://doc.rust-lang.org/std/cell/
219240register_diagnostics ! {
220241 E0383 , // partial reinitialization of uninitialized structure
221242 E0385 , // {} in an aliasable location
222- E0386 , // {} in an immutable container
223243 E0388 , // {} in a static location
224244 E0389 // {} in a `&` reference
225245}
You can’t perform that action at this time.
0 commit comments