High level overview of the algorithm steps of Rust's borrow checker?

This page summarizes the projects mentioned and recommended in the original post on /r/rust

Our great sponsors
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • WorkOS - The modern identity platform for B2B SaaS
  • SaaSHub - Software Alternatives and Reviews
  • polonius

    Defines the Rust borrow checker.

  • I have been starting to look through the polonius code, and have read as much as I can about how the borrow checker works, and I understand how it works at a high level. But I don't understand the algorithm it uses internally (the specific rustc algorithm, the polonius algorithm, or the theoretical/hypothetical pseudocode algorithm). It will take some time to grok polonius.

  • lobster

    The Lobster Programming Language

  • I really like the idea of ownership and ownership types / affine types, which it seems like the borrow checker implements (for garbage collection features and the general type theory benefits you get). Though I am no type theory expert, just been browsing around trying to figure out how the ideal compiler would work, finding things like lobster lang and kind lang along the way.

  • InfluxDB

    Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.

    InfluxDB logo
  • BorrowScript

    TypeScript with a Borrow Checker. Multi-threaded, Tiny binaries. No GC. Easy to write.

  • I asked how to implement a "borrow checker" in JavaScript in my initial attempts (I've learned a decent amount since), which led me to randomly finding BorrowScript that seems to have another implementation I think, so going to be taking a deeper look there for inspiration as well. But if one could explain the steps of the algorithm, and how it integrates/relates with the type inference process, that would be of great use. Not for learning how to use Rust, but to learn how this aspect of its compiler works.

  • BorrowScriptInterpreter

    Discontinued A compiler and toolchain for the Stream programming language [Moved to: https://github.com/Isaac-Leonard/Stream]

  • I asked how to implement a "borrow checker" in JavaScript in my initial attempts (I've learned a decent amount since), which led me to randomly finding BorrowScript that seems to have another implementation I think, so going to be taking a deeper look there for inspiration as well. But if one could explain the steps of the algorithm, and how it integrates/relates with the type inference process, that would be of great use. Not for learning how to use Rust, but to learn how this aspect of its compiler works.

  • Kind

    Discontinued A next-gen functional language [Moved to: https://github.com/Kindelia/Kind2] (by Kindelia)

  • I really like the idea of ownership and ownership types / affine types, which it seems like the borrow checker implements (for garbage collection features and the general type theory benefits you get). Though I am no type theory expert, just been browsing around trying to figure out how the ideal compiler would work, finding things like lobster lang and kind lang along the way.

  • WorkOS

    The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.

    WorkOS logo
NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts