fivemack icon

Untitled

fivemack | PRO | 03/28/23 10:24:15 AM UTC | 0 ⭐ | 288 👁️ | Never ⏰ | []
text |

870 B

|

None

|

0 👍

/

0 👎

                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