EUVIMEDEUVIMED entdecken
Open Access · CC BY 4.0

RustC 4 ++: Improving Rust Code-Comment Inconsistency Detection via Hybrid LLM and Static Analysis

Yichi Zhang, Yang Feng

ACM Transactions on Software Engineering and Methodology · 31.12.2026 · 35 (12) · 1-37

DOI: 10.1145/3800689 ↗

Kurz gefasst

Fachartikel in der Zeitschrift ACM Transactions on Software Engineering and Methodology, online erschienen am 18.11.2026. Verfasst von Yichi Zhang und 1 weiteren Autor:innen. Die Arbeit nennt 53 Literaturangaben. Der Volltext ist frei zugänglich (Open Access, CC BY 4.0). Gefördert von: National Natural Science Foundation of China.

AbstractBibliografische AngabenZitierenVerwandte Studien

Abstract (Originalsprache)

Maintaining consistency between source code and its associated comments is essential for software reliability, maintainability, and user experience, particularly in the Rust programming ecosystem, where comments serve as both developer guidance and an authoritative API contract. However, existing automated inconsistency detection approaches are largely tailored for object-oriented languages and fall short of addressing Rust’s unique features, such as explicit panic semantics, trait-based abstraction, and idiomatic use of option and finiteness constraints. In this article, we introduce RustC 4 ++, a novel hybrid framework that integrates large language model (LLM)-driven constraint extraction, static program analysis, and SMT-based bidirectional verification to detect and diagnose code-comment inconsistencies in Rust. RustC 4 ++ extends previous solutions by supporting a richer taxonomy of constraints, including interval, boundary, existence, option, and finiteness constraints, and pioneers a systematic method for propagating comment constraints across trait and implementation boundaries. Leveraging chain-of-thought prompt engineering, RustC 4 ++ robustly interprets natural language comments, maps it to formal specifications, and checks their alignment with code logic through precise static analysis and formal reasoning. We conduct extensive experiments on 17 diverse, real-world Rust projects, demonstrating that RustC 4 ++ substantially outperforms prior tools in both precision and recall, and is capable of uncovering subtle, actionable inconsistencies that have led to confirmed fixes in upstream repositories. By elevating comments to enforceable, verifiable contracts, RustC 4 ++ not only enhances code quality and comment reliability in the Rust ecosystem but also offers generalizable techniques and insights for automated code comment analysis in other modern programming languages.

Förderung

  • National Natural Science Foundation of China

Zitieren

APA

Zhang, Y., & Feng, Y. (2026). RustC 4 ++: Improving Rust Code-Comment Inconsistency Detection via Hybrid LLM and Static Analysis. ACM Transactions on Software Engineering and Methodology, 35(12), 1-37. https://doi.org/10.1145/3800689

Vancouver

Zhang Y, Feng Y. RustC 4 ++: Improving Rust Code-Comment Inconsistency Detection via Hybrid LLM and Static Analysis. ACM Transactions on Software Engineering and Methodology. 2026;35(12):1-37. doi:10.1145/3800689

BibTeX
@article{Zhang2026,
  author = {Zhang, Yichi and Feng, Yang},
  title = {RustC 4 ++: Improving Rust Code-Comment Inconsistency Detection via Hybrid LLM and Static Analysis},
  journal = {ACM Transactions on Software Engineering and Methodology},
  year = {2026},
  volume = {35},
  number = {12},
  pages = {1--37},
  doi = {10.1145/3800689}
}
Kostenlos starten →