Rust Borrow Checker

Picture of alex-potanin.md Alex Potanin

1 Jan 2026

Rust’s ownership- and borrowing-based type system enables strong guarantees such as memory safety and data-race freedom. However, these guarantees sometimes force programmers into patterns that can make code less clear or more verbose. This project aims to identify such cases in real Rust programs and classify them into recurring categories. One prominent example is the partial borrowing problem, where programmers want to borrow disjoint parts of a data structure independently. A potential solution, “view types” https://smallcultfollowing.com/babysteps/blog/2021/11/05/view-types/, has been proposed in the Rust community. The project will analyse a large corpus of Rust programs to find repeated patterns that correspond to partial borrowing or similar limitations of the borrow checker.

Beyond partial borrows, the study may uncover other code patterns or “code smells’’ that arise from limitations of the Rust type system. The project will likely involve adapting or extending an existing Rust analysis tool (e.g., qrates https://github.com/rust-corpus/qrates) to automatically process thousands of crates.

Please note that this project is a closer collaboration with Sasha Pak, our current PhD student working on the Rust borrow checker mechanisms.

Overall, this project consists of:

  • Identifying borrowing-related code smell patterns in Rust,
  • Classifying them into categories,
  • Measuring their presence and effects across a large Rust corpus, and
  • Relating these patterns to known limitations and proposed extensions of Rust’s type system.
arrow-left bars magnifying-glass xmark