Resources for implementing Rust's borrow checker

I'd like to implement Rust's borrow checker, but I haven't found great documentation to get started. The rustc borrow checking code is complicated and I'm worried that formalisms such as Oxide and FR will lead me astray. Any recommendations? TIA

Rust had a couple — first a simple scope-based borrow checker, then "NLL" (non-lexical lifetimes) borrow checker, and the third not-yet-ready attempt is Polonius.

It's a problem that is simple in simple cases, and gets infinitely complex at edge cases. So I won't be surprised if there aren't any easy guides for it, because for Rust itself it was a multi-year journey.

2 Likes

You basically should read rustc source code, but as you said it is complicated. rustc-dev-guide has a chapter on the borrow checker that should help you orient around the source code.

2 Likes

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.