sword_smith icon

Borrow checker problems

sword_smith | PRO | 02/23/23 05:15:48 PM UTC | 0 ⭐ | 667 👁️ | Never ⏰ | [borrow checker]
text |

1.41 KB

|

None

|

0 👍

/

0 👎

Current compiler error:
 ```
error[E0507]: cannot move out of a shared reference
    --> triton-vm/src/table/constraint_circuit.rs:1037:19
     |
1037 |             match &node.circuit.as_ref().borrow_mut().expression {
     |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1038 |                 BinaryOperation(_, mut lhs, mut rhs) => {
     |                                    -------  ------- ...and here
     |                                    |
     |                                    data moved here
     |
     = note: move occurs because these variables have types that don't implement the `Copy` trait
  ```
 If I remove the ampersand:
```
error[E0507]: cannot move out of dereference of `RefMut<'_, constraint_circuit::ConstraintCircuit<II>>`
    --> triton-vm/src/table/constraint_circuit.rs:1037:19
     |
1037 |             match node.circuit.as_ref().borrow_mut().expression {
     |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider borrowing here: `&node.circuit.as_ref().borrow_mut().expression`
1038 |                 BinaryOperation(_, mut lhs, mut rhs) => {
     |                                    -------  ------- ...and here
     |                                    |
     |                                    data moved here
     |
     = note: move occurs because these variables have types that don't implement the `Copy` trait
```
  

Comments