fork/rust

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

borsAuto merge of #71365 - Mark-Simulacrum:stable-next, r=Mark-Simulacrum4fb7144ed15

1.43.0
906 B27 linesraw
1error[E0502]: cannot borrow `p` as mutable because it is also borrowed as immutable
2  --> $DIR/borrowck-assign-comp-idx.rs:12:5
3   |
4LL |     let q: &isize = &p[0];
5   |                      - immutable borrow occurs here
6LL | 
7LL |     p[0] = 5;
8   |     ^ mutable borrow occurs here
9LL | 
10LL |     println!("{}", *q);
11   |                    -- immutable borrow later used here
12
13error[E0502]: cannot borrow `p` as mutable because it is also borrowed as immutable
14  --> $DIR/borrowck-assign-comp-idx.rs:27:9
15   |
16LL |     borrow(
17   |     ------ immutable borrow later used by call
18LL |         &p,
19   |         -- immutable borrow occurs here
20LL |         || p[0] = 5);
21   |         ^^ - second borrow occurs due to use of `p` in closure
22   |         |
23   |         mutable borrow occurs here
24
25error: aborting due to 2 previous errors
26
27For more information about this error, try `rustc --explain E0502`.