Skip to content

Commit b0b2952

Browse files
committed
Improve interior mutability example for E0386.
1 parent 75c6428 commit b0b2952

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/librustc_borrowck/diagnostics.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,8 @@ It can also be fixed by using a type with interior mutability, such as `Cell` or
184184
`RefCell`:
185185
186186
```
187-
let y: Cell<_> = Cell::new(1);
187+
let x: i64 = 1;
188+
let y: Box<Cell<_>> = Box::new(Cell::new(x));
188189
y.set(2);
189190
```
190191
"##,

0 commit comments

Comments
 (0)