mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-26 16:54:01 +00:00
18 lines
613 B
Plaintext
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`.
|