arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2604.17261cs.PL
收藏

&inator: 正确、精确的 C 到 Rust 接口翻译

&inator: Correct, Precise C-to-Rust Interface Translation

The Ohio State University(俄亥俄州立大学)

Victor Chen, Ayden Coughlin, Michael D. Bond

AI总结:

本文提出 &inator,一种正确且精确的 C 到 Rust 接口翻译方法,通过约束基于语义等价性和类型正确性生成正确且高效的 Rust 接口。

摘要:

自动将系统软件从 C 语言翻译成 Rust 语言是一个有吸引力但具有挑战性的问题,因为它需要整个程序推理以满足 Rust 的所有权和借用纪律。整个程序翻译中的关键步骤是接口翻译,它为 C 程序的顶层声明(即结构体和函数签名)生成 Rust 声明,从而实现模块化和逐步的代码翻译。本文介绍了正确、精确的 C 到 Rust 接口翻译,称为 &inator。&inator 采用了一种新的基于约束的语义等价性和类型正确性公式化方法,包括借用检查规则,以生成一个正确(即接口允许在安全 Rust 中保持语义的实现)且精确(即使用最简单的、成本最低的类型)的 Rust 接口。我们的结果表明,&inator 为真实的 C 程序生成了正确且精确的 Rust 接口,但对某些 C 特性支持和扩展到大型程序仍存在挑战。这项工作通过成为首个正确且精确的 C 到 Rust 接口翻译方法而推动了该领域的进展。

英文摘要:

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.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑