2018-05-25 05:36:58 -05:00
|
|
|
error[E0502]: cannot borrow `*collection` as mutable because it is also borrowed as immutable
|
|
|
|
--> $DIR/issue-42106.rs:13:5
|
2018-04-10 17:38:35 -05:00
|
|
|
|
|
2018-05-25 05:36:58 -05:00
|
|
|
LL | let _a = &collection;
|
|
|
|
| ----------- immutable borrow occurs here
|
|
|
|
LL | collection.swap(1, 2); //~ ERROR also borrowed as immutable
|
|
|
|
| ^^^^^^^^^^ mutable borrow occurs here
|
|
|
|
LL | _a.use_ref();
|
|
|
|
| -- borrow later used here
|
2018-04-10 17:38:35 -05:00
|
|
|
|
|
|
|
error: aborting due to previous error
|
|
|
|
|
2018-05-25 05:36:58 -05:00
|
|
|
For more information about this error, try `rustc --explain E0502`.
|