Oct. 11th, Thursday - 10:00 - 10:30

The first six years in the development of Polonius, an improved borrow checker

When the current borrow checker, non-lexical lifetimes (NLL), was developed, one of the patterns the Rust developers wanted to add support for had to be abandoned: Case 3, in which a reference is conditionally returned early from a function. This case is particularly tricky to support as it requires a high-resolution analysis of the conditional flow references beyond the means of the current borrow checker. Therefore, current Rust does not support this code pattern (and others like it), even though it is provably safe.

Since 2018, work has been ongoing to extend the borrow checker to support this case in the Polonius project. An early prototype implemented in Datalog is available in nightly Rust under an experimental flag. However, its performance and scaling properties make it insufficient for stabilisation. The working group is aiming to ship a prototype of Polonius with acceptable performance characteristics for the Rust 2024 edition, this time without Datalog.

This talk presents a history of the work on Polonius, explains how it differs from the current borrow checker, and describes the path to stabilisation and beyond.

Speaker

Amanda Stjerna

Amanda is a PhD student in Web security at Uppsala university for increasingly broad definitions of "Web" and "security". She was exposed to Rust during her undergraduate shortly after the group project on making a garbage collector in C where she met her wife. Rust's type-system driven memory management was an easy sell after the experience. She has been working on Polonius on and off since writing her master's thesis on it and is currently working near full time alongside Rémy Rakic and Niko Matsakis in the Polonius Working Group on finishing a prototype on schedule.

Amanda lives with her wife, a high-energy herding dog and an even higher-energy toddler on the outskirts of Uppsala, Sweden. In her spare time she sleeps or does the dishes.

Amanda Stjerna