Content area
Ensuring the quality and safety of Rust code is increasingly critical as the language is adopted for system-level and security-sensitive applications. The unique features of Rust, such as its ownership and borrowing system, present both opportunities and challenges for automated code quality improvement. This work addresses these challenges by leveraging LLMs in three key areas: automatic unit test generation, detection of unsafe operations in binaries, and identification of logically unsafe operations that escape compiler checks.
The research introduces a comprehensive framework that integrates semantic-aware static analysis with advanced machine learning techniques tailored for Rust’s complex type system. The first component, RUG, employs a bottom-up context construction strategy and coverage-guided fuzzing to generate high-quality unit tests, achieving coverage rates comparable to human developers. The second component, RUBY, applies machine learning to identify unsafe operations directly in Rust binaries, enabling security analysis even when source code is unavailable. The third component, COIN, uses LLM-based classification and proof-of-concept generation to uncover logically unsafe operations, revealing vulnerabilities that are not detected by the compiler.
Extensive evaluation across thousands of real-world Rust projects demonstrates the effectiveness of these approaches, with significant improvements in code coverage, precision, and recall over existing tools. The results highlight the potential of LLMs, when combined with domain-specific program analysis, to address the unique challenges of Rust and advance the state of automated code quality assurance.