1 error[E0502]: cannot borrow `*ptr` as immutable because it is also borrowed as mutable
2 --> $DIR/borrowck-closures-use-after-free.rs:32:8
4 LL | let mut test = |foo: &Foo| {
5 | ----------- mutable borrow occurs here
6 LL | ptr = box Foo { x: ptr.x + 1 };
7 | --- first borrow occurs due to use of `ptr` in closure
9 LL | test(&*ptr); //~ ERROR cannot borrow `*ptr`
10 | ---- ^^^^^ immutable borrow occurs here
12 | mutable borrow later used by call
14 error: aborting due to previous error
16 For more information about this error, try `rustc --explain E0502`.