fork/rust

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

borsAuto merge of #67350 - Mark-Simulacrum:stable-next, r=Mark-Simulacrum73528e339aa

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