ISSTA2023

RustSmith: Random Differential Compiler Testing for Rust

Mayank Sharma, Pingshi Yu, Alastair F. Donaldson

25 citations

Abstract

We present RustSmith, the rst Rust randomised program generator for end-to-end testing of Rust compilers. RustSmith generates programs that conform to the advanced type system of Rust, respecting rules related to borrowing and lifetimes, and that are guaranteed to yield a well-de ned result. This makes RustSmith suitable for di erential testing between compilers or across optimisation levels. By applying RustSmith to a series of versions of the o cial Rust compiler, rustc, we show that it can detect insidious historical bugs that evaded detection for some time. We have also used RustSmith to nd previously-unknown bugs in an alternative Rust compiler implementation, mrustc. In a controlled experiment, we assess statement and mutation coverage achieved by RustSmith vs. the rustc optimisation test suite. CCS CONCEPTS • Software and its engineering → Compilers; Maintaining software; Software testing and debugging.