Here is a project (report) I worked on this semester for a program synthesis class I took. Admittedly, it is pretty limited (it doesn’t handle a whole bunch of stuff), but I thought I would share it anyway…
I’m not currently intending on pursuing this further, but I would still be interested in any feedback people have.
EDIT: fixed the link
Report: https://github.com/mark-i-m/rust/blob/paper/paper.pdf
Code (beware the hackyness): https://github.com/mark-i-m/rust/tree/synthesis
Abstract:
Rust is a new systems programming language that aims to allow low-level control and high performance, like C/C++, but with memory safety and data-race-freedom guaranteed statically. Rust accomplishes this using a compiler pass called the borrow checker. Unfortunately, the borrow checker’s compile errors are sometimes difficult to understand. Beginners and advanced users alike may not be sure how to resolve them. In our work, we propose a tool that uses the compiler’s analyses to mechanically produce suggestions for how to resolve lifetime-related errors. To evaluate the usefulness of our tool, we survey lifetime-related errors on Stack Overflow and the Rust Users Forum. We find that our tool is helpful for generating fixes for 2 out of the 30 examples surveyed. For only one example, our tool produced a misleading suggestion. We also identify common areas of problems from the surveyed issue, including over-restrictive constraints, subtle interactions with advanced type system features, and fundamental design flaws in user’s programs. We propose that these may be good areas to focus on improving compiler diagnostics.