Skip to content

Add error explanations for all error codes (tracking issue). #24407

Closed
@michaelsproul

Description

@michaelsproul

This is a metabug for rustc --explain error descriptions.

All the errors in need of descriptions are listed in this spreadsheet. If you'd like to help out, comment with the bunch of errors you'd like to tackle, and list yourself as assigned on the spreadsheet!

Choosing a few errors in the same file is probably a good way to start.

How to add an error explanation

Error explanations live in src/librustc*/diagnostics.rs. To add a new explanation you have to delete the error from the register_diagnostics! invocation and add it to the register_long_diagnostics! invocation, along with the explanation. The format for the explanation is 80 characters per line, with a newline at the very start and end of the string. Including code examples is encouraged, with full markdown formatting (single-tick for inline, triple for blocks). Copy the format of the existing errors and you should be good!

Once you've added an explanation you can test it out by compiling and running stage1 as follows:

$ make rustc-stage1
$ export PATH=x86_64-unknown-linux-gnu/stage1/bin:$PATH
$ export LD_LIBRARY_PATH=x86_64-unknown-linux-gnu/stage1/lib:$LD_LIBRARY_PATH
$ rustc --explain EXXXX

If you want to see how it renders as HTML you'll have to build the error index, which requires stage2:

$ make doc/error-index.html

You can add -j 4 to use 4 parallel make processes.

Once you're happy with the result, submit a pull request and we'll review it.

Progress

We're tracking progress with a shared spreadsheet. If you'd like to write an error message, put your name down for one of the unassigned errors.

Rust Error Diagnostic Spreadsheet (click me!)

As you complete error descriptions it would also be great if you could mark the errors as "merged" on the spreadsheet 😄

Metadata

Metadata

Assignees

No one assigned

    Labels

    E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.metabugIssues about issues themselves ("bugs about bugs")

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions