blob: 95b547aad5de96cb77a58cb9c2ff6470ca9a1edd (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
error[E0499]: cannot borrow `arr[_]` as mutable more than once at a time
--> $DIR/suggest-slice-swap.rs:5:33
|
LL | std::mem::swap(&mut arr[0], &mut arr[1]);
| -------------- ----------- ^^^^^^^^^^^ second mutable borrow occurs here
| | |
| | first mutable borrow occurs here
| first borrow later used by call
|
help: use `.swap()` to swap elements at the specified indices instead
|
LL - std::mem::swap(&mut arr[0], &mut arr[1]);
LL + arr.swap(1, 0);
|
error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0499`.
|