rust/tests/ui/suggestions/suggest-slice-swap.stderr

18 lines
613 B
Plaintext

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 | arr.swap(1, 0);
| ~~~~~~~~~~~~~~
error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0499`.