]> git.lizzy.rs Git - rust.git/blob - src/test/ui/nll/issue-62007-assign-const-index.stderr
Auto merge of #103600 - compiler-errors:early-binder-nits, r=spastorino
[rust.git] / src / test / ui / nll / issue-62007-assign-const-index.stderr
1 error[E0499]: cannot borrow `list[_].value` as mutable more than once at a time
2   --> $DIR/issue-62007-assign-const-index.rs:23:21
3    |
4 LL | fn to_refs<T>(mut list: [&mut List<T>; 2]) -> Vec<&mut T> {
5    |                          - let's call the lifetime of this reference `'1`
6 ...
7 LL |         result.push(&mut list[0].value);
8    |                     ^^^^^^^^^^^^^^^^^^ `list[_].value` was mutably borrowed here in the previous iteration of the loop
9 ...
10 LL |             return result;
11    |                    ------ returning this value requires that `list[_].value` is borrowed for `'1`
12
13 error[E0499]: cannot borrow `list[_].next` as mutable more than once at a time
14   --> $DIR/issue-62007-assign-const-index.rs:24:26
15    |
16 LL | fn to_refs<T>(mut list: [&mut List<T>; 2]) -> Vec<&mut T> {
17    |                          - let's call the lifetime of this reference `'1`
18 ...
19 LL |         if let Some(n) = list[0].next.as_mut() {
20    |                          ^^^^^^^^^^^^^^^^^^^^^
21    |                          |
22    |                          `list[_].next` was mutably borrowed here in the previous iteration of the loop
23    |                          argument requires that `list[_].next` is borrowed for `'1`
24
25 error: aborting due to 2 previous errors
26
27 For more information about this error, try `rustc --explain E0499`.