fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #68568 - pietroalbini:stable-next, r=pietroalbini5e1a799842b

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