Description
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 😄