重构与等价性在Rust中的研究:通过新型自动化等价性证明方法扩展REM工具链
Refactoring and Equivalence in Rust: Expanding the REM Toolchain with a Novel Approach to Automated Equivalence Proofs
AI总结:
REM2.0通过新型自动化等价性证明方法扩展Rust工具链,实现快速且功能丰富的提取函数重构并提供机器验证行为保持。
摘要:
重构工具在现代开发中至关重要,提取函数重构在日常工作中被广泛使用。然而,对于Rust来说,所有权、借用和高级类型特性使自动化提取函数重构变得具有挑战性。现有工具要么依赖于缓慢的编译器分析,只支持受限的语言片段,或者提供的保证仅限于"仍然可以编译"。本文提出了REM2.0,这是一个新的提取函数和验证工具链,用于Rust。REM2.0基于rust-analyzer作为持久守护进程运行,通过VSCode前端提供低延迟的重构功能。它增加了自动调整生命周期和签名的修复器,当提取暴露借用检查器问题时会自动调整,还提供可选的验证管道连接到CHARON和AENEAS,以生成支持的Rust子集的Coq等价性证明。架构在三个基准套件上进行了评估。在原始REM制品上,REM2.0实现了100%的兼容性,将守护进程的延迟从约1000毫秒降低到单数字毫秒。在40个以功能为重点的提取中,REM2.0处理了大多数涉及异步/等待、const fn、非局部控制流、泛型和更高排名的特质约束的示例。在二十个验证基准中,CHARON/AENEAS管道为当前子集内的案例构建了端到端的等价性证明。总体而言,结果表明,基于rust-analyzer的设计可以为真实的Rust程序提供快速且功能丰富的提取函数重构,而可选的验证提供了机器检查的行为保持。
英文摘要:
Refactoring tools are central to modern development, with extract-function refactorings used heavily in day-to-day work. For Rust, however, ownership, borrowing, and advanced type features make automated extract-function refactoring challenging. Existing tools either rely on slow compiler-based analysis, support only restricted language fragments, or provide little assurance beyond "it still compiles." This paper presents REM2.0, a new extract-function and verification toolchain for Rust. REM2.0 works atop rust-analyzer as a persistent daemon, providing low-latency refactorings with a VSCode front-end. It adds a repairer that automatically adjusts lifetimes and signatures when extraction exposes borrow-checker issues, and an optional verification pipeline connecting to CHARON and AENEAS to generate Coq equivalence proofs for a supported Rust subset. The architecture is evaluated on three benchmark suites. On the original REM artefact, REM2.0 achieves 100% compatibility while reducing latency from ~1000ms to single-digit milliseconds in the daemon. On 40 feature-focused extractions from 20 highly starred GitHub repositories, REM2.0 handles most examples involving async/await, const fn, non-local control flow, generics, and higher-ranked trait bounds. On twenty verification benchmarks, the CHARON/AENEAS pipeline constructs end-to-end equivalence proofs for cases within its current subset. Overall, results show that a rust-analyzer-based design can provide fast, feature-rich extract-function refactoring for real Rust programs, while opt-in verification delivers machine-checked behaviour preservation.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。