I have blogged a few times before about Stacked Borrows, my proposed aliasing model for Rust. But I am a researcher, and what researchers (are expected to) do is write papers—so that’s what we did for Stacked Borrows as well. After a lot of work, I can now finally present to you our paper Stacked Borrows: An Aliasing Model for Rust (thanks to open access, the paper is available under the CC-BY 4.0 license).
If you have already read my blog posts, the paper does not say much you have not seen already. However, the paper is the most coherent and most complete introduction to Stacked Borrows so far. So if you were always confused by some aspect of Stacked Borrows, or if you have not read the previous blog posts, the paper is a great way to learn about Stacked Borrows.
If there is nothing new, you may wonder what took us so long, then, and why we needed 4 people for that? The answer is that my coauthor Hai, with some help from Jeehoon and me, took on the Herculean task of formalizing Stacked Borrows in Coq and then formally verifying that some key optimizations are actually sound under that model. Those proofs turned out to be more complex to carry out than we expected, but now I am sure that what I claimed about Stacked Borrows in previous posts is actually correct. (In fact we were not able to complete the proof in time for the conference submission deadline, but lucky enough the reviewers were convinced enough by the informal description and the evaluation with Miri that they still accepted the paper.)
Let me also use this opportunity to thank Mozilla and the Rust community for their help with this project. This work would not have been possible without Mozilla hiring me for two internships, without all the great feedback that you all gave me in response to my blog posts, and without all the support that I got in implementing Stacked Borrows, testing the standard library and a growing number of external crates in Miri, and fixing Stacked Borrows errors as they came up. Thank you all so much for working with me on this, this has been (and will hopefully continue to be) great fun. :-)