Add details about types with interior mutability to E0386.

Types with interior mutability like `Cell` and `RefCell` can be used to
skirt the restriction on mutating mutable values inside an immutable
container.
This commit is contained in:
Nathan Kleyn 2015-08-13 09:25:56 +01:00
parent 55752a4bde
commit 75c6428e1b

View File

@ -179,6 +179,14 @@ fn main(){
let mut y: Box<_> = Box::new(&mut x);
**y = 2;
```
It can also be fixed by using a type with interior mutability, such as `Cell` or
`RefCell`:
```
let y: Cell<_> = Cell::new(1);
y.set(2);
```
"##,
E0387: r##"