<p dir="auto">This is a metabug for <code class="notranslate">rustc --explain</code> error descriptions.</p>
<p dir="auto">All the errors in need of descriptions are listed in <a href="https://docs.google.com/spreadsheets/d/1Qt8Bs6qp4NLP2FYQ361CZ4U-3OsUWNCLQX3c_jGtvqM/edit?usp=sharing" rel="nofollow">this spreadsheet</a>. 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!</p>
<p dir="auto">Choosing a few errors in the same file is probably a good way to start.</p>
<h1 dir="auto">How to add an error explanation</h1>
<p dir="auto">Error explanations live in <code class="notranslate">src/librustc*/diagnostics.rs</code>. To add a new explanation you have to delete the error from the <code class="notranslate">register_diagnostics!</code> invocation and add it to the <code class="notranslate">register_long_diagnostics!</code> 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!</p>
<p dir="auto">Once you've added an explanation you can test it out by compiling and running stage1 as follows:</p>
<div class="highlight highlight-source-shell notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="$ 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"><pre class="notranslate">$ make rustc-stage1
$ <span class="pl-k">export</span> PATH=x86_64-unknown-linux-gnu/stage1/bin:<span class="pl-smi">$PATH</span>
$ <span class="pl-k">export</span> LD_LIBRARY_PATH=x86_64-unknown-linux-gnu/stage1/lib:<span class="pl-smi">$LD_LIBRARY_PATH</span>
$ rustc --explain EXXXX</pre></div>
<p dir="auto">If you want to see how it renders as HTML you'll have to build the error index, which requires stage2:</p>
<div class="highlight highlight-source-shell notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="$ make doc/error-index.html"><pre class="notranslate">$ make doc/error-index.html</pre></div>
<p dir="auto">You can add <code class="notranslate">-j 4</code> to use 4 parallel <code class="notranslate">make</code> processes.</p>
<p dir="auto">Once you're happy with the result, submit a pull request and we'll review it.</p>
<h1 dir="auto">Progress</h1>
<p dir="auto">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.</p>
<p dir="auto"><a href="https://docs.google.com/spreadsheets/d/1Qt8Bs6qp4NLP2FYQ361CZ4U-3OsUWNCLQX3c_jGtvqM/edit?usp=sharing" rel="nofollow">Rust Error Diagnostic Spreadsheet (click me!)</a></p>
<p dir="auto">As you complete error descriptions it would also be great if you could mark the errors as "merged" on the spreadsheet <g-emoji class="g-emoji" alias="smile" fallback-src="https://github.githubassets.com/images/icons/emoji/unicode/1f604.png">😄</g-emoji></p>
<p dir="auto">The following function compiles:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="fn foo&lt;A: Share, A&gt;(a: A) -&gt; A{ a }"><pre class="notranslate"><code class="notranslate">fn foo&lt;A: Share, A&gt;(a: A) -&gt; A{ a }
</code></pre></div>
<p dir="auto">When unused the compiler issues the standard unused code warning.</p>
<p dir="auto">As far as I can tell, there is no way to actually use the function without annotating the types for everything (<code class="notranslate">foo::&lt;&amp;str, uint&gt;(5u)</code>) because otherwise the compiler can't infer the type of the function.</p>