An Interactive Debugger for Rust Trait Errors DOI: 10.1145/3729302 Journal: PACMPL Volume: 9 PLDI 199 6 CCS: Software and its engineering Software testing and debugging CCS: Theory of computation Constraint and logic programming CCS: Information systems Search interfaces
Gavin Gray, Will Crichton, Shriram Krishnamurthi · 2025
Read An Interactive Debugger for Rust Trait Errors DOI: 10.1145/3729302 Journal: PACMPL Volume: 9 PLDI 199 6 CCS: Software and its engineering Software testing and debugging CCS: Theory of computation Constraint and logic programming CCS: Information systems Search interfaces by Gavin Gray, Will Crichton, Shriram Krishnamurthi (2025) in the Tower of Babel, a free online library of public-domain works preserved in clean, searchable text. No sign-up. The full text is served as a plain-text file at a predictable URL, where text is present: https://antarctic-labs.com/tower-of-babel/arxiv-2504-18704.txt.
Introduction
Rust's compiler errors for trait failures can read like riddles in a dead language, and Gavin Gray, Will Crichton, and Shriram Krishnamurthi build an interactive way out in a 2025 paper. Their tool, Argus, draws the type inference search as a tree the programmer can explore, instead of a verdict the compiler hands down.
Different views serve different debugging goals, and careful defaults keep the tree readable: short type names, and obligations sorted by how costly they look to fix. In a study with twenty-five programmers debugging realistic broken Rust code, Argus users located over twice as many faults and worked more than three times faster than those with standard errors. The authors argue diagnostic tools should be designed as interfaces, not messages.
Catalog record
| CREATOR | Gavin Gray, Will Crichton, Shriram Krishnamurthi |
|---|---|
| YEAR | 2025 |
| COLLECTION | PAPERS |
| FORMAT | TXT |
| FILE SIZE | 72 KB |
| VERSION | 1.0 |
| LICENSE | http://creativecommons.org/licenses/by/4.0/ |
| RIGHTS | CC BY |
| SOURCE | arXiv |
Source: https://arxiv.org/abs/2504-18704
Browse the full library · About the Tower of Babel
Full text
The opening of the work, from the library's hosted text:
An Interactive Debugger for Rust Trait Errors DOI: 10.1145/3729302 Journal: PACMPL Volume: 9 PLDI 199 6 CCS: Software and its engineering Software testing and debugging CCS: Theory of computation Constraint and logic programming CCS: Information systems Search interfaces Gavin Gray, Will Crichton, Shriram Krishnamurthi Abstract . Compiler diagnostics for type inference failures are notoriously bad, and type classes only make the problem worse. By introducing a complex search process during inference, type classes can lead to wholly inscrutable or useless errors. We describe a system, Argus , for interactively visualizing type class inferences to help programmers debug inference failures, applied specifically to Rust’s trait system. The core insight of Argus is to avoid the traditional model of compiler diagnostics as one-size-fits-all, instead providing the programmer with different views on the search tree corresponding to different debugging goals. Argus carefully uses defaults to improve debugging productivity, including interface design (e.g., not showing full paths of types by default) and heuristics (e.g., sorting obligations based on the expected complexity of fixing them). We evaluated Argus in a user study where N = 25 N=25 participants debugged type inference failures in realistic Rust programs, finding that participants using Argus correctly localized 2.2 × 2.2\times as many faults and localized 3.3 × 3.3\times faster compared to not using Argus . Figure 1 . A screenshot of the Argus trait debugger’s bottom-up view in VS Code applied to a Bevy program ( Section 2.3 ). Using an interactive graphical interface for the trait inference tree, Argus can include key information (the bound Timer : SystemParam ) elided by the Rust compiler diagnostic for the same program. † † cc-license: by 1. Introduction Type classes improve the brevity of bounded polymorphism by implicitly passing inferred type class instances to generic functions, as opposed to ML-style explicit passing of modules via functors. In other words, type classes shift the burden of finding instances from the programmer to the compiler. When a type class inference succeeds, the programmer does not need to expend any thought on the inference process, at least for systems which enforce coherence ( Bottu et al. 2019 ; Reynolds 1991 ) . But when a type class inference fails, the compiler is responsible for explaining the failure to the programmer. Back in the days when type classes were a simple tool for overloading ( Wadler and Blott 1989 ) , diagnostics posed no particular challenge. Say a function has a type like ToString a => a -> String , and you pass an int , and there happens to be no instance of ToString for int . Then the compiler just needs to say: “no instance found for ToString int ”. The challenge today is that type class systems are more powerful than before. Type classes in Haskell, Coq, Rust (traits), and Scala (implicits) have all been shown to encode Turing-complete computations. Rust even explicitly models type class inference (“trait solving”) as Prolog-esque logic programming ( cha 2024 ) . Library developers in these languages, especially Rust, increasingly lean on type classes to encode domain-specific correctness properties into the type system. While this approach helps developers catch more mistakes at compile-time, it can at times produce mystifying diagnostics. Given the severity of this problem, the Rust community has invested money into studying trait diagnostics ( Semmler 2022 ) as well as developed both library-specific ( Hellermann 2024 ) and library-agnostic ( Semmler 2023 ) utilities solely for improving trait diagnostics. The thesis of this work is that compiler diagnostics are fundamentally limited by their representation as static text. Moreover, this limitation is felt most acutely for information-rich situations such as type class inference. We therefore designed a system, Argus , to provide a richer interface for explaining type class inferences built on a modern UI framework. Argus is implemented as an IDE extension for Rust, although its core design is not particularly Rust-specific. After motivating our design principles with concrete examples ( Section 2 ), we describe our contributions: • A novel interface for visualizing trait inference, designed to specifically facilitate key sub-tasks in debugging inference failures ( Section 3.2 ). • A new heuristic, inertia , that ranks potential root causes of trait inference failure ( Section 3.3 ). • A user study that shows that participants using Argus could localize faults 3.3\times faster compared to using the Rust compiler’s diagnostics ( Section 5 ). 2. Motivating Examples Traits are a well-documented source of confusing compiler errors in the Rust community. A 2023 study ( Semmler 2022 ) commissioned by the Rust Foundation identified dozens of problematic error messages in widely-used libraries, resulting in a corpus of hard-to-debug programs. We analyzed the content of these error messages to form hypotheses about how to design better trait diagnostics. We chose three programs that represent the main failure modes of programs in this corpus. For illustration, the program in Section 2.2 was taken from an online Rust forum ( dis 2022 ) because it requires less boilerplate than programs in the corpus, but nonetheless contains an equivalent error. We start by walking through these concrete examples that illustrate the problems in Rust’s existing trait diagnostics. We then generalize these examples into design principles that form the basis of the Argus interface. All errors in this section were generated using Rust 1.82.0. 2.1. A Missing Table Join ⬇ 1 fn users_with_eq_post_id ( conn : & mut PgConnection ) -> Vec <( i32 , String >> { 2 users :: table // .inner_join(posts::table) 3 . filter ( users :: id . eq ( posts :: id )) 4 . select (( users :: id , posts :: id )) 5 . load ::<( i32 , String )>( conn ) 6 } (a) A program using the Diesel query builder library. The program does not join the table posts but tries to use the posts :: id column, which Diesel catches as a trait error. ⬇ error [ E0271 ]: type mismatch resolving ‘< table as AppearsInFromClause < table >>:: Count == Once ‘ | 5 | . load ::<( i32 , String )>( conn ); | ---- ^^^^ expected ‘ Once ‘, found ‘ Never ‘ | | | required by a bound introduced by this call | note : required for ‘ posts :: columns :: id ‘ to implement ‘ AppearsOnTable < users :: table >‘ | 18 | id -> Integer , | ^^ = note : associated types for the current ‘ impl ‘ cannot be restricted in ‘ where ‘ clauses = -NoValue- 2 redundant requirements hidden = note : required for ‘ diesel :: expression :: grouped :: Grouped < diesel :: expression :: operators :: Eq < users :: columns :: id , posts :: columns :: id >>‘ to implement ‘ AppearsOnTable < users :: table >‘ = note : required for ‘ query_builder :: where_clause :: WhereClause < diesel :: expression :: grouped :: Grouped < diesel :: expression :: operators :: Eq < users :: columns :: id , posts :: columns :: id >>>‘ to implement ‘ query_builder :: where_clause :: ValidWhereClause < FromClause < users :: table >>‘ = note : required for ‘ SelectStatement