fork/rust

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

borsAuto merge of #72883 - Mark-Simulacrum:stable-next, r=Mark-Simulacrum49cae55760d

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