File tree 1 file changed +21
-1
lines changed
1 file changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -160,6 +160,27 @@ fn main(){
160
160
```
161
161
"## ,
162
162
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
+
163
184
E0387 : r##"
164
185
This error occurs when an attempt is made to mutate or mutably reference data
165
186
that a closure has captured immutably. Examples of this error are shown below:
@@ -219,7 +240,6 @@ https://doc.rust-lang.org/std/cell/
219
240
register_diagnostics ! {
220
241
E0383 , // partial reinitialization of uninitialized structure
221
242
E0385 , // {} in an aliasable location
222
- E0386 , // {} in an immutable container
223
243
E0388 , // {} in a static location
224
244
E0389 // {} in a `&` reference
225
245
}
You can’t perform that action at this time.
0 commit comments