arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2309.05137cs.PLcs.HC
收藏

将 Trait 错误作为逻辑程序进行调试

Debugging Trait Errors as Logic Programs

Gavin Gray, Will Crichton

AI总结:

针对 Rust 中 trait 约束规模增大导致编译器诊断失效的问题,提出一种 trait 调试器,通过从 trait 求解器提取并交互式可视化证明树,帮助开发者在任意领域和规模下诊断 trait 错误。

摘要:

Rust 使用 trait 来定义共享行为的单元。Trait 约束构建了一个隐式的一阶遗传 Harrop 子句集合,该集合由 trait 系统中强大的逻辑编程引擎执行。但这种强大能力是有代价的:Rust 库中 trait 的数量正在增加,这给 trait 系统帮助程序员诊断错误带来了日益沉重的负担。当 trait 约束的规模超过一定限度时,编译器诊断就会跌落复杂性悬崖的边缘,导致产生无用的错误信息。Crate 维护者已经创建了一些临时解决方案来诊断常见的特定领域错误,但普遍性地诊断 trait 错误的问题仍然悬而未决。我们提出了一种 trait 调试器,作为让开发者获得在任何领域和任何规模下诊断 trait 错误所需信息的手段。我们提出的工具将从 trait 求解器中提取证明树,并以交互方式可视化这些证明树,从而促进对 trait 错误的调试。

英文摘要:

Rust uses traits to define units of shared behavior. Trait constraints build up an implicit set of first-order hereditary Harrop clauses which is executed by a powerful logic programming engine in the trait system. But that power comes at a cost: the number of traits in Rust libraries is increasing, which puts a growing burden on the trait system to help programmers diagnose errors. Beyond a certain size of trait constraints, compiler diagnostics fall off the edge of a complexity cliff, leading to useless error messages. Crate maintainers have created ad-hoc solutions to diagnose common domain-specific errors, but the problem of diagnosing trait errors in general is still open. We propose a trait debugger as a means of getting developers the information necessary to diagnose trait errors in any domain and at any scale. Our proposed tool will extract proof trees from the trait solver, and it will interactively visualize these proof trees to facilitate debugging of trait errors.

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

↑