一句话:提出首个基于约束求解的正确且精确的 C 到 Rust 接口翻译方法,生成满足借用检查的最简 Rust 声明。
将系统软件从 C 自动翻译到 Rust 颇具吸引力却十分困难,因为必须进行全程序推理以满足 Rust 的所有权与借用规则。接口翻译是其中的关键使能步骤:为 C 程序的顶层声明(结构体与函数签名)生成 Rust 声明,从而支持模块化和增量式的代码翻译。本文提出 &inator,首次实现正确、精确的 C 到 Rust 接口翻译。&inator 采用一种新颖的基于约束的表述来刻画语义等价与类型正确性(包括借用检查规则),并据此求解 Rust 接口。所得接口是正确的(即存在保持语义的 safe Rust 实现)且精确的(即使用最简单、代价最低的类型)。实验表明,&inator 能为真实 C 程序生成正确且精确的 Rust 接口;但对某些 C 特性的支持以及面向大型程序的可扩展性仍有待未来工作。
Automatically translating system software from C to Rust is an appealing but challenging problem, as it requires whole-program reasoning to satisfy Rust’s ownership and borrowing discipline. A key enabling step in whole-program translation is interface translation , which produces Rust declarations for the C program’s top-level declarations (i.e., structs and function signatures), enabling modular and incremental code translation. This paper introduces correct, precise C-to-Rust interface translation, called &inator . &inator employs a novel constraint-based formulation of semantic equivalence and type correctness including borrow-checking rules to produce a Rust interface that is correct (i.e., the interface admits a semantics-preserving implementation in safe Rust) and precise (i.e., it uses the simplest, least costly types). Our results show &inator produces correct, precise Rust interfaces for real C programs, but support for certain C features and scaling to large programs are challenges left for future work. This work advances the state of the art by being the first correct, precise approach to C-to-Rust interface translation.
DOI 原文 · arXiv · PDF(开放获取) · DBLP
@article{ChenCB26,
title = {&inator: Correct, Precise C-to-Rust Interface Translation},
author = {Victor Chen and Ayden Coughlin and Michael D. Bond},
journal = {Proceedings of the ACM on Programming Languages},
volume = {10},
number = {PLDI},
year = {2026},
doi = {10.1145/3808270}
}