I'm helping in adding async support in oxide-auth
and facing a borrow checker issue.
To make it async compatible, the maintainer chosed to use state machines that can be driven in a sync or async manner. One was missing and I tried to write.
How come this file compile: https://github.com/Geobert/oxide-auth/blob/async-authorization/oxide-auth/src/code_grant/resource.rs
But not mine: https://github.com/Geobert/oxide-auth/blob/async-authorization/oxide-auth/src/code_grant/authorization.rs
error[E0499]: cannot borrow `authorization` as mutable more than once at a time
--> oxide-auth\src\code_grant\authorization.rs:330:27
|
330 | requested = match authorization.advance(input) {
| ^^^^^^^^^^^^^ mutable borrow starts here in previous iteration of loop
both advance()
take &mut self
and both are used in a loop
.
I'm utterly puzzled