Error code E0386
Note: this error code is no longer emitted by the compiler.
This error occurs when an attempt is made to mutate the target of a mutable reference stored inside an immutable container.
For example, this can happen when storing a &mut
inside an immutable Box
:
This error can be fixed by making the container mutable:
It can also be fixed by using a type with interior mutability, such as Cell
or RefCell
: