Rust claims to advance industrial programming by bridging the gap between low-level systems programming and high-level application programming. At the heart of the argument that this enables programmers to build more reliable and efficient software is the borrow checker - a novel approach to ownership that aims to balance type system expressivity with usability. And yet, to date there is no core type system that captures Rust's notion of ownership and borrowing, and hence no foundation for research on Rust to build upon. In this work, we set out to capture the essence of this model of ownership by developing a type systems account of Rust's borrow checker. We present Oxide, a formalized programming language close to source-level Rust (but with fully-annotated types). This presentation takes a new view of lifetimes as an approximation of the provenances of references, and our type system is able to automatically compute this information through a substructural typing judgment. We provide the first syntactic proof of type safety for borrow checking using progress and preservation. Oxide is a simpler formulation of borrow checking - including recent features such as non-lexical lifetimes - that we hope researchers will be able to use as the basis for work on Rust.
翻译:要求通过缩小低层次系统编程和高层次应用编程之间的差距来推进工业编程。 使程序设计者能够建立更可靠、更高效的软件的论点的核心是借入检查器—— 一种旨在平衡系统表达性和可用性的新颖的所有权方法。 然而,迄今为止,还没有一种核心类型系统能够捕捉鲁斯特的所有权和借款概念,因此也没有关于鲁斯特的研究基础。 在这项工作中,我们开始通过开发一个 Rust 借取检查器的型系统账户来捕捉这种所有权模式的精髓。 我们介绍了一种正式的编程语言Oxide,一种与源层Rust 相近的正式编程语言(但带有充分注释的类型 ) 。 这个演示对生命期的新看法是参照源的近似值, 而我们的类型系统能够通过亚结构化的打字判断来自动校准这些信息。 我们提供了第一个关于使用进步和保存来借取类型安全性的合成证据。 Oxide 是一个简单的借取检查公式, 包括最近一些非弹性的特征, 我们希望研究人员能够使用Rus的基础。