[Paper Review] Oxide: The Essence of Rust
This paper introduces Oxide, a formally-specified, surface-level programming language that captures the core type system of Rust’s borrow checker. By modeling lifetimes as regions—sets of memory locations—Oxide enables a control-flow-based substructural typing system that automatically computes aliasing constraints, providing the first self-contained, sound, and machine-checked formal semantics for core Rust’s ownership model, including non-lexical lifetimes, without relying on separation logic or low-level IRs.
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.
Motivation & Objective
- To provide a formal, high-level semantics for Rust’s ownership and borrowing model that is accessible to researchers.
- To overcome the limitations of prior formalizations, such as those based on low-level IRs or complex logical frameworks like Iris.
- To model non-lexical lifetimes in a way that is compatible with static type checking and control-flow analysis.
- To develop a type system that is both expressive and usable, capturing the essence of Rust’s safety guarantees without relying on unsafe code or complex verification logic.
- To establish a foundation for future research on Rust’s type system by providing a tested, self-contained formal model.
Proposed method
- Oxide is a surface-level language with syntax close to Rust’s syntax, featuring fully annotated types and no type inference.
- Lifetimes are reinterpreted as regions—sets of memory locations—that approximate the origins of references.
- A novel control-flow-based substructural typing judgment computes region assignments and enforces aliasing constraints at compile time.
- The type system uses a region-based alias management mechanism that tracks mutable and shared references through a loan-based model.
- Soundness is proven via standard progress and preservation theorems, using conventional formal methods rather than separation logic or proof assistants.
- The system supports key Rust features such as non-lexical lifetimes, tuple destructuring, and drop semantics, all within a single, unified type system.
Experimental results
Research questions
- RQ1How can Rust’s ownership and borrowing model be formally captured in a high-level, surface-level language without relying on low-level IRs or complex logical frameworks?
- RQ2Can lifetimes be reinterpreted as regions to enable automatic, control-flow-based reasoning about memory safety and aliasing?
- RQ3Is it possible to build a sound, self-contained formal semantics for core Rust’s borrow checker using only standard type system techniques?
- RQ4How does the region-based approach handle non-lexical lifetimes and the dynamic behavior of references in safe code?
- RQ5Can this formal model serve as a foundation for future research on Rust’s type system, including language extensions and verification?
Key findings
- Oxide is the first formal type system for core Rust that provides a tested, self-contained semantics using only standard type system techniques and not relying on separation logic or proof assistants.
- The region-based interpretation of lifetimes enables automatic, control-flow-driven analysis of reference origins and lifetimes, supporting non-lexical lifetimes in a sound and intuitive way.
- The system proves type safety via progress and preservation, establishing that well-typed programs either evaluate to values or abort, without diverging.
- The formalization supports key Rust features such as tuple destructuring, reference binding, and drop semantics, all within a single, consistent type system.
- The model enables researchers to reason about safe Rust code at the source level, avoiding the complexity of low-level representations like MIR or unsafe code verification.
- The approach provides a foundation for future research on Rust’s type system, including language design, verification, and static analysis.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.