I’m doing a bunch of experimentation to thoroughly understand the borrow checker and move semantics… In doing so, I came across what appears to me to be a strange situation in this code.
In the code,
borrower1() mutably borrows
our_player and directly after,
borrower2() immutably borrows
our_player. Isn’t this illegal? It’s my understand that the mutable borrow does not end until the
} at the end of
main(). Am I incorrect here? Also, I could have sworn that when there is a mutable borrow, there may be no other borrows, read or write, on the same data.