Rust: Why the first borrow later used here?

You hit a known limitation of the current borrow checker. It compiles with the next-gen checker (Polonius).

See more detail in this similar thread. Applying @steffahn's workaround in that thread works for your code as well.

1 Like