paperbot · PL 论文追踪

全部论文 待读 收藏

P2 An Empirical Study of Bugs in the rustc Compiler

rustc 编译器中的缺陷实证研究
OOPSLA 9(OOPSLA2)2025匹配度 3/10 · 该论文是 rustc 编译器语义分析与 IR 处理阶段的缺陷实证研究和测试工具评估,属于 PL/编译器可靠性方向,但未涉及用户核心关注的 LLM/Agent、静态分析在 ML/Agentic 程序中的应用、浮点程序分析或贝叶斯程序分析。引用 2 inbox
Zixi Liu, Yang Feng, Yunbo Ni, Shaohua Li, Xizhe Yin, Qingkai Shi, Baowen Xu, Zhendong Su
crossref: 2026-09-10

AI 速览

一句话:对 rustc 语义分析与 IR 处理阶段 301 个缺陷进行系统实证研究,分类成因并评估现有测试工具。

Rust 的内存安全保证依赖 rustc 的 trait 求解、借用检查与优化等机制,但这些独特机制也带来传统编译器中少见的缺陷。本文系统研究 2022–2024 年间 rustc 语义分析与中间表示(IR)处理阶段的缺陷,人工审查 301 个有效 issue,按成因、症状、受影响编译阶段和测试用例特征分类,并评估现有 rustc 测试工具。研究发现:缺陷主要源于 Rust 类型系统与生命周期模型,HIR/MIR 模块因复杂检查器和优化而高发;触发测试常涉及不稳定特性、高级 trait 用法、生命周期标注、标准 API 和特定优化级别;现有工具难以检测非崩溃错误,rustc 测试仍需改进。

问题
rustc 的独特语言机制使其编译器缺陷不同于传统编译器,但此前缺乏大规模、细粒度的 rustc 缺陷研究,尤其语义分析与 IR 处理阶段。
方法
收集并人工审查 2022–2024 年 301 个有效 issue,按成因、症状、受影响编译阶段和测试用例特征分类,并评估现有 rustc 测试工具。
评估
通过分类统计与对现有测试工具效果的评估,揭示 HIR/MIR 高发、触发用例特征及非崩溃错误检测不足等问题。
原文摘要(Abstract)

Rust is gaining popularity for its well-known memory safety guarantees and high performance, distinguishing it from C/C++ and JVM-based languages. Its compiler, rustc , enforces these guarantees through specialized mechanisms such as trait solving, borrow checking, and specific optimizations. However, Rust’s unique language mechanisms introduce complexity to its compiler, resulting in bugs that are uncommon in traditional compilers. With Rust’s increasing adoption in safety-critical domains, understanding these language mechanisms and their impact on compiler bugs is essential for improving the reliability of both rustc and Rust programs. Such understanding could provide the foundation for developing more effective testing strategies tailored to rustc . Improving the quality of rustc testing is essential for enhancing compiler reliability, which in turn strengthens the safety and correctness of all Rust programs, as compiler bugs can silently propagate into every compiled program. Yet, we still lack a large-scale, detailed, and in-depth study of rustc bugs. To bridge this gap, this work presents a comprehensive and systematic study of rustc bugs, specifically those originating in semantic analysis and intermediate representation (IR) processing, which are stages that implement essential Rust language features such as ownership and lifetimes. Our analysis examines issues and fixes reported between 2022 and 2024, with a manual review of 301 valid issues. We categorize these bugs based on their causes, symptoms, affected compilation stages, and test case characteristics. Additionally, we evaluate existing rustc testing tools to assess their effectiveness and limitations. Our key findings include: (1) rustc bugs primarily arise from Rust’s type system and lifetime model, with frequent errors in the High-Level Intermediate Representation (HIR) and Mid-Level Intermediate Representation (MIR) modules due to complex checkers and optimizations; (2) bug-revealing test cases often involve unstable features, advanced trait usages, lifetime annotations, standard APIs, and specific optimization levels; (3) while both valid and invalid programs can trigger bugs, existing testing tools struggle to detect non-crash errors, underscoring the need for further advancements in rustc testing.

链接与引用

DOI 原文 · PDF(开放获取) ·

BibTeX
@article{paperbot2963,
  title = {An Empirical Study of Bugs in the rustc Compiler},
  author = {Zixi Liu and Yang Feng and Yunbo Ni and Shaohua Li and Xizhe Yin and Qingkai Shi and Baowen Xu and Zhendong Su},
  journal = {Proceedings of the ACM on Programming Languages},
  volume = {9},
  number = {OOPSLA2},
  year = {2025},
  doi = {10.1145/3763800}
}