I would like to understand how Rust implements ownership and borrowing in its compiler. I would appreciate any reference to the relevant folders in the implementation and explanations/papers describing what these folders implement.
To clarify, I already read about the semantics of ownership and borrowing rules. However, I'm interested in the techniques used to implement the corresponding checks.
Update:
I see there is an RFC quoted at the implementation at BorrowCheck/mod.rs. A link to that RFC would also be helpful.
It's also worthwhile to read these blog posts by Niko Matsakis (lead of the lang and compiler team). The relevant posts are all under the headline "NLL" in this list (unfortunately his blog doesn't let you link to just the category):
Some of the posts (those that refer to polonius) are about a new method of implementation that rustc will probably use someday in the future, but currently doesn't.
@rjraya Sorry, I know this is a bit late, but I would recommend reading the rustc dev guide chapter and then source code you linked. The code makes more sense if you read the chapter first (at least, it did to me)