Description
Today's compiler team meeting seemed to expose rough consensus that error codes as they stand today are not helping end-users fix code, or helping us develop the compiler.
This is because error codes do not meaningfully identify an error to an experienced user, so one cannot derive meaning from them without grepping the compiler codebase (and, sometimes, --explain
can help). However, in many cases, a single error code is emitted for multiple similar errors (from a user perspective) but internally the causes of those errors may be quite different. It is also true that many of the complicated Rust errors that users ask for help with are not ones that can be readily explained in the abstract -- looking and helping with specific code is necessary.
It is then our impression that removing the error codes, as detailed below, is a reasonable step to take.
This issue proposes that we deprecate the --explain
flag to the compiler and silence emission of error codes in compiler messages. That is, we would no longer emit error[EXXX]: ...
instead just emitting error: ...
, and no longer print For more information about this error, try "rustc --explain E0282".
. We would also stop publishing new versions of the error index.
We would not delete the infrastructure in the compiler that supports this functionality, though, i.e., error code definitions, explanations, error emission would still take E3303
or a similar error as it does today. Furthermore, if -Zui-testing
is passed, the error codes would be essentially emitted just as before. This means that reverting the deprecation/removal would be fairly easy. (Notably, we currently rely on these error codes in tidy to check that they're still being emitted by the compiler. Arguably, that's not immediately helpful, but we don't want to break that functionality for no reason if we decide to later revert).
If there are no significant complaints from end users, we may consider removing the functionality completely (i.e., no longer keeping the error code registry and explanations around at all) at a later point in time, but this explicitly does not propose making such a step. It has been noted during discussion of this on Discord that the future of error emission may involve something like #61132 which would somewhat supersede numeric error codes. @eddyb also points out that if we don't go that far, we can at least try to get wins by replacing numeric error codes with alphabetic identifiers, such as error[BorrowCk.UseAfterMove]: ...
to allow grouping errors by type and/or potentially emitting no more than one of a particular category of error.
I am filing this issue here, rather than as (for example) a compiler team meeting proposal, because I would like to get some feedback and discussion in an async context, and perhaps even come to a consensus on this plan, without using up a full Friday slot.
cc @rust-lang/wg-diagnostics @GuillaumeGomez