Lune

PLDI2023Top-tier venue

Leveraging Rust Types for Program Synthesis

Jonás Fiala, Shachar Itzhaky, Peter Müller, Nadia Polikarpova, Ilya Sergey

Abstract

The Rust type system guarantees memory safety and data-race freedom. However, to satisfy Rust's type rules, many familiar implementation patterns must be adapted substantially. These necessary adaptations complicate programming and might hinder language adoption. In this paper, we demonstrate that, in contrast to manual programming, automatic synthesis is not complicated by Rust's type system, but rather benefits in two major ways. First, a Rust synthesizer can get away with significantly simpler specifications. While in more traditional imperative languages, synthesizers often require lengthy annotations in a complex logic to describe the shape of data structures, aliasing, and potential side effects, in Rust, all this information can be inferred from the types, letting the user focus on specifying functional properties using a slight extension of Rust expressions. Second, the Rust type system reduces the search space for synthesis, which improves performance.

In this work, we present the first approach to automatically synthesizing correct-by-construction programs in safe Rust. The key ingredient of our synthesis procedure is Synthetic Ownership Logic, a new program logic for deriving programs that are guaranteed to satisfy both a user-provided functional specification and, importantly, Rust's intricate type system. We implement this logic in a new tool called RusSOL. Our evaluation shows the effectiveness of RusSOL, both in terms of annotation burden and performance, in synthesizing provably correct solutions to common problems faced by new Rust developers.

Ask Lune

Know this paper in minutes, not an afternoon.

Lune can read every page of it and the top-tier papers that cite it, and gives you its claims, its evidence and its limits, each one cited to the paper it comes from. No skimming, no AI slop.

5 top-tier papers have cited it since. Know what they found before your reviewers do.

Questions to start from

Lune can draw on

the full paper · the top-tier papers that cite it · related work

Get the answer

Free to start. No credit card required.

Lineage

  • Flux: Liquid Types for Rust cites Stacked borrows: an aliasing model for Rust
  • Nola: Later-Free Ghost State for Verifying Termination in Iris cites Verus: Verifying Rust Programs using Linear Ghost Types
  • Nola: Later-Free Ghost State for Verifying Termination in Iris cites RustHornBelt: a semantic foundation for functional verification of Rust programs with unsafe code
  • Nola: Later-Free Ghost State for Verifying Termination in Iris cites Stacked borrows: an aliasing model for Rust
  • Verus: Verifying Rust Programs using Linear Ghost Types cites RustHornBelt: a semantic foundation for functional verification of Rust programs with unsafe code
  • Verus: Verifying Rust Programs using Linear Ghost Types cites Stacked borrows: an aliasing model for Rust
  • Crabtree: Rust API Test Synthesis Guided by Coverage and Type cites Flux: Liquid Types for Rust
  • Crabtree: Rust API Test Synthesis Guided by Coverage and Type cites Verus: Verifying Rust Programs using Linear Ghost Types
  • Crabtree: Rust API Test Synthesis Guided by Coverage and Type cites RustHornBelt: a semantic foundation for functional verification of Rust programs with unsafe code
  • Crabtree: Rust API Test Synthesis Guided by Coverage and Type cites RPG: Rust Library Fuzzing with Pool-based Fuzz Target Generation and Generic Support
  • Crabtree: Rust API Test Synthesis Guided by Coverage and Type cites Stacked borrows: an aliasing model for Rust
  • Crabtree: Rust API Test Synthesis Guided by Coverage and Type cites SyRust: automatic testing of Rust libraries with semantic-aware program synthesis
  • RPG: Rust Library Fuzzing with Pool-based Fuzz Target Generation and Generic Support cites RustHornBelt: a semantic foundation for functional verification of Rust programs with unsafe code
  • RPG: Rust Library Fuzzing with Pool-based Fuzz Target Generation and Generic Support cites Stacked borrows: an aliasing model for Rust
  • RPG: Rust Library Fuzzing with Pool-based Fuzz Target Generation and Generic Support cites SyRust: automatic testing of Rust libraries with semantic-aware program synthesis
Builds onCited byLeft to right by year; the more cited, the higher.

Cited by top-tier papers5

  1. Type-Constrained Code Generation with Language ModelsNiels Mündler, Jingxuan He, Hao Wang, Koushik Sen et al.PLDI 2025 · 10 citations
  2. RPG: Rust Library Fuzzing with Pool-based Fuzz Target Generation and Generic SupportZhiwu Xu, Bohao Wu, Cheng Wen, Bin Zhang et al.ICSE 2024 · 9 citations
  3. Crabtree: Rust API Test Synthesis Guided by Coverage and TypeYoshiki Takashima, Chanhee Cho, Ruben Martins, Limin Jia et al.OOPSLA 2024 · 3 citations
  4. Nola: Later-Free Ghost State for Verifying Termination in IrisYusuke Matsushita, Takeshi TsukadaPLDI 2025 · 2 citations
  5. The Search for Constrained Random GeneratorsHarrison Goldstein, Hila Peleg, Cassia Torczon, Daniel Sainati et al.PLDI 2026 · 1 citation

Builds on7

  1. Verus: Verifying Rust Programs using Linear Ghost TypesAndrea Lattuada, Travis Hance, Chanhee Cho, Matthias Brun et al.OOPSLA 2023 · 86 citations
  2. Stacked borrows: an aliasing model for RustRalf Jung, Hoang-Hai Dang, Jeehoon Kang, Derek DreyerPOPL 2020 · 67 citations
  3. RustHornBelt: a semantic foundation for functional verification of Rust programs with unsafe codeYusuke Matsushita, Xavier Denis, Jacques-Henri Jourdan, Derek DreyerPLDI 2022 · 44 citations
  4. SyRust: automatic testing of Rust libraries with semantic-aware program synthesisYoshiki Takashima, Ruben Martins, Limin Jia, Corina S. PasareanuPLDI 2021 · 32 citations
  5. Flux: Liquid Types for RustNico Lehmann, Adam T. Geller, Niki Vazou, Ranjit JhalaPLDI 2023 · 29 citations

Related papers

  1. Aliasing Limits on Translating C to Safe RustMehmet Emre, Peter Boyland, Aesha Parekh, Ryan Schroeder et al.OOPSLA 2023 · 32 citations
  2. How do programmers use unsafe rust?Vytautas Astrauskas, Christoph Matheja, Federico Poli, Peter Müller et al.OOPSLA 2020 · 78 citations
  3. RefinedRust: A Type System for High-Assurance Verification of Rust ProgramsLennard Gäher, Michael Sammler, Ralf Jung, Robbert Krebbers et al.PLDI 2024 · 29 citations
  4. Rust yDL: A Program Logic for RustDaniel Drodt, Reiner HähnleFM 2026
  5. Translating C to safer RustMehmet Emre, Ryan Schroeder, Kyle Dewey, Ben HardekopfOOPSLA 2021 · 60 citations
Dusk over the sea between two cliffs drawn in fine vertical lines