How does Borrow checker keeps track of data Owner and references to it?

I'm trying to understand how does Borrow checker keeps track of data Owner of current data and references handed out ?

Once the MIR is generated Borrow Checker gets in action and performs it's checks. But can somebody shed some light on how it's done under the hood?

It's not light reading, but the current algorithm is described in the NLL RFC and an alternate formulation is outlined in some blog posts about the next-generation borrow checker, Polonius:

7 Likes