while let Some(Reverse(p)) = bh_ascending.peek()
{
if p.sum == ls
{
lefts.push(p);
self.pop_ascending(&mut bh_ascending);
}
}
error[E0502]: cannot borrow `bh_ascending` as mutable because it is also borrowed as immutable
--> src/knapsack.rs:94:44
|
89 | while let Some(Reverse(p)) = bh_ascending.peek()
| ------------------- immutable borrow occurs here
...
93 | lefts.push(p);
| ------------- immutable borrow later used here
94 | self.pop_ascending(&mut bh_ascending);
| ^^^^^^^^^^^^^^^^^ mutable borrow occurs here
Comments