Type classes as an abstraction feature is prevalent in many modern programming languages. As discussed in
For the scope of this work, a trait error has occurred if the language cannot prove that a type U implements trait T. This definition does not state that U isn’t an implementor of T, rather, that its existence cannot be proven.
We outline our criteria for a good error diagnostic. We call a diagnostic good if it localizes the root cause of the failure and provides full provenance for all required trait bounds. Poor diagnostics fail to provide this information. We will show how branching in the Rust trait solver impedes its ability to localize the root cause of an error. Language design decisions impact which patterns are preferred by library maintainers. This section highlights some common patterns in Rust and how the interplay between language features and trait resolution lead to poor diagnostics.