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