Tree Borrows

A new aliasing model for Rust

Neven Villani

Mar. 2023

This document replaces the pre-2023-10-20 version that did not yet include the updates from the two latest PRs in Miri For completeness you can still find the unedited version here. If you don’t know Tree Borrows yet, you’re in the right place. If you are familiar with Tree Borrows and want to know only what changed and why, you may consult the diff.

Tree Borrows is a proposed alternative to Stacked Borrows that fulfills the same role: to analyse the execution of Rust code at runtime and define the precise requirements of the aliasing constraints. When these aliasing constraints are violated, the code is declared Undefined Behavior (UB). This enables optimizations that would otherwise be unsound in the presence of unsafe code.

The current version of Tree Borrows is implemented in the Miri interpreter. Compared to another description, this document is more example-oriented.

Table of contents

See also some References. Suggest modifications to this document by opening a pull request.