New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add error explanations for all error codes #32777

Open
GuillaumeGomez opened this Issue Apr 6, 2016 · 71 comments

Comments

@GuillaumeGomez
Copy link
Member

GuillaumeGomez commented Apr 6, 2016

This is a reopening of #24407 issue. So I took back what was already there and updated it:

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:

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.

Please refer to this RFC when you'll write your error explanation (it can also helps you to start if don't know how to write it).

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

$ ./x.py test src/test/ui -- 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

You can add --jobs 4 to use 4 parallel make processes:

$ ./x.py build --stage 1 --jobs4

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

Progress

  • E0090
  • E0103
  • E0104
  • E0167
  • E0174
  • E0182
  • E0183
  • E0196
  • E0203
  • E0208
  • E0212
  • E0224
  • E0226
  • E0227
  • E0228
  • E0230
  • E0231
  • E0238
  • E0242
  • E0245
  • E0254
  • E0278
  • E0279
  • E0280
  • E0284
  • E0298
  • E0299
  • E0311
  • E0312
  • E0313
  • E0314
  • E0315
  • E0316
  • E0320
  • E0328
  • E0374
  • E0375
  • E0376
  • E0377
  • E0385
  • E0388
  • E0389
  • E0393
  • E0399
  • E0402
  • E0406
  • E0408
  • E0409
  • E0410
  • E0414
  • E0418
  • E0420
  • E0421
  • E0427
  • E0429
  • E0434
  • E0436
  • E0453
  • E0455
  • E0456
  • E0457
  • E0460
  • E0461
  • E0462
  • E0464
  • E0465
  • E0466
  • E0467
  • E0468
  • E0469
  • E0470
  • E0471
  • E0472
  • E0473
  • E0474
  • E0475
  • E0476
  • E0477
  • E0478
  • E0479
  • E0480
  • E0481
  • E0482
  • E0483
  • E0484
  • E0485
  • E0486
  • E0487
  • E0488
  • E0489
  • E0490
  • E0491
  • E0495
  • E0498
  • E0500
  • E0501
  • E0502
  • E0503
  • E0504
  • E0505
  • E0506
  • E0507
  • E0508
  • E0509
  • E0513
  • E0514
  • E0519
  • E0520
  • E0521
  • E0523

cc @steveklabnik

@marti1125

This comment has been minimized.

Copy link
Contributor

marti1125 commented Apr 11, 2016

I would like to take this =D How to I can start?

wesleywiser added a commit to wesleywiser/rust that referenced this issue Apr 12, 2016

@GuillaumeGomez GuillaumeGomez self-assigned this Apr 12, 2016

@GuillaumeGomez

This comment has been minimized.

Copy link
Member Author

GuillaumeGomez commented Apr 12, 2016

@marti1125: I guess the first step is to find one of the listed error codes into the rust source code (github search makes it easy) and then try to get the error with rust code. From there, just follow the description of this issue and if you need help, you can always ask (here or on IRC on #rust-docs chan).

wesleywiser added a commit to wesleywiser/rust that referenced this issue Apr 19, 2016

wesleywiser added a commit to wesleywiser/rust that referenced this issue Apr 20, 2016

wesleywiser added a commit to wesleywiser/rust that referenced this issue Apr 20, 2016

bors added a commit that referenced this issue Apr 22, 2016

bors added a commit that referenced this issue Apr 24, 2016

bors added a commit that referenced this issue Apr 26, 2016

timothy-mcroy pushed a commit to timothy-mcroy/rust that referenced this issue Apr 26, 2016

timothy-mcroy pushed a commit to timothy-mcroy/rust that referenced this issue Apr 28, 2016

@timothy-mcroy

This comment has been minimized.

Copy link
Contributor

timothy-mcroy commented Apr 29, 2016

I'm working on E0501.

@timothy-mcroy

This comment has been minimized.

Copy link
Contributor

timothy-mcroy commented May 2, 2016

I'll open a PR for E0502 tomorrow.

@cramertj

This comment has been minimized.

Copy link
Member

cramertj commented May 2, 2016

I'll open a PR for E0509 today or tomorrow.

@GuillaumeGomez

This comment has been minimized.

Copy link
Member Author

GuillaumeGomez commented May 2, 2016

@timothy-mcroy, @cramertj: Thanks to both of you! :D

@cristianoliveira

This comment has been minimized.

Copy link
Contributor

cristianoliveira commented May 3, 2016

Hey guys. I'll take the E0507. Tomorrow I'm going to work on it (Now is almost 1 am here in Brazil :P)

@savage13

This comment has been minimized.

Copy link

savage13 commented Feb 5, 2017

Is this updated list of the unexplained error codes useful ?

@sjmackenzie

This comment has been minimized.

Copy link

sjmackenzie commented Feb 5, 2017

well done chaps! It's great!

@GuillaumeGomez

This comment has been minimized.

Copy link
Member Author

GuillaumeGomez commented Feb 5, 2017

Nice! A lot of them won't get explanations though since they refer to "internal" errors (I did add an explanation for them but it got refused for this reason).

@liquidnight2

This comment has been minimized.

Copy link

liquidnight2 commented Feb 19, 2017

[E0495]

$ rustc --version
rustc 1.15.0 (10893a9 2017-01-19)

error[E0495]: cannot infer an appropriate lifetime for autoref due to conflicting requirements

https://doc.rust-lang.org/error-index.html#E0495
Stable rustc --> stable docs. Where do I find more details ?

@GuillaumeGomez : There is already a large discussion about it, see here:
#36183

I tried to reproduce the error, could not do it.

@GuillaumeGomez

This comment has been minimized.

Copy link
Member Author

GuillaumeGomez commented Feb 19, 2017

@liquidnight2: It doesn't have a long error explanation yet. Can you give the code that throws this error please? I'll try to write the long error explanation from it.

SamWhited added a commit to SamWhited/rust that referenced this issue Mar 22, 2017

GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this issue Mar 22, 2017

Rollup merge of rust-lang#40723 - SamWhited:e0090_error_explanation, …
…r=estebank

E0090: Add explanation for error message

See rust-lang#32777

    $ rustc --explain E0090
    The wrong number of lifetimes were supplied. For example:

    ```
    fn foo<'a: 'b, 'b: 'a>() {}

    fn main() {
        foo::<'static>(); // error, expected 2 lifetime parameters
    }
    ```

frewsxcv added a commit to frewsxcv/rust that referenced this issue Mar 22, 2017

Rollup merge of rust-lang#40723 - SamWhited:e0090_error_explanation, …
…r=estebank

E0090: Add explanation for error message

See rust-lang#32777

    $ rustc --explain E0090
    The wrong number of lifetimes were supplied. For example:

    ```
    fn foo<'a: 'b, 'b: 'a>() {}

    fn main() {
        foo::<'static>(); // error, expected 2 lifetime parameters
    }
    ```

@steveklabnik steveklabnik removed the A-docs label Mar 24, 2017

@CaptainKraft

This comment has been minimized.

Copy link

CaptainKraft commented Apr 9, 2017

In the instructions, it says:

Please refer to this RFC when you'll write your error explanation (it can also helps you to start if don't know how to write it).

and that link to the RFC above leads to rust-lang/rfcs#1567.

Perhaps the link should point to the document explaining the RFC instead of the pull request?

It took me a bit of digging to figure out where that document was.

Edit: A link to the spreadsheet in this thread would be nice for newcomers as well.

@marioidival

This comment has been minimized.

Copy link
Contributor

marioidival commented Jul 27, 2017

@GuillaumeGomez This issue are closed to contribution yet?

@GuillaumeGomez

This comment has been minimized.

Copy link
Member Author

GuillaumeGomez commented Jul 27, 2017

@marioidival: If you find any error code not having a long error explanation; then it's not. Either add it yourself or open a new issue please.

@marioidival

This comment has been minimized.

Copy link
Contributor

marioidival commented Jul 27, 2017

@GuillaumeGomez The progress show us that much is still missing.

@GuillaumeGomez

This comment has been minimized.

Copy link
Member Author

GuillaumeGomez commented Jul 27, 2017

I think it's really outdated.

@markmmm

This comment has been minimized.

@GuillaumeGomez

This comment has been minimized.

Copy link
Member Author

GuillaumeGomez commented Feb 18, 2018

I updated the list. I also checked the removed ones.

@markmmm

This comment has been minimized.

Copy link

markmmm commented May 13, 2018

Comments after each link are those extracted from either diagnostics.rs or from where the error was raised. My thought is that those would help people identify errors that they may be familiar with and it might help get then resolved :)
Links are github search links.

The following are commented out

  • E0103 //
  • E0104 //
  • E0167 //
  • E0182 // merged into E0229
  • E0196 // cannot determine a type for this closure
  • E0238 // renthesized parameters may only be used with a trait
  • E0242 //
  • E0245 // not a trait
  • E0298 //
  • E0299 // mismatched types between arms
  • E0385 // {} in an aliasable location
  • E0402 // cannot use an outer type parameter in this context
  • E0406 // merged into 420
  • E0418 // merged into 532
  • E0420 // merged into 532
  • E0471 // constant evaluation error (in pattern)

I couldn't find any reference in git for these (using github search)

Listed in src/librustc/diagnostics.rs but not raised anywhere.

These are the remaining items from the list

Issue 'Raised' in file comment
E0183 src/librustc_typeck/diagnostics.rs
E0203 src/librustc_typeck/diagnostics.rs type parameter has more than one relaxed default bound, and only one is supported
E0208 src/librustc_typeck/diagnostics.rs
E0212 src/librustc_typeck/diagnostics.rs cannot extract an associated type from a higher-ranked trait bound
E0224 src/librustc_typeck/diagnostics.rs at least one non-builtin train is required for an object type
E0226 src/librustc_passes/ast_validation.rs only a single explicit lifetime bound is permitted
E0227 src/librustc_typeck/diagnostics.rs ambiguous lifetime bound, explicit lifetime bound required
E0228 src/librustc_typeck/astconv.rs the lifetime bound for this object type cannot be deduced from context; please supply an explicit bound
E0279 src/librustc/traits/error_reporting.rs requirement is not satisfied
E0280 src/librustc/traits/error_reporting.rs requirement is not satisfied
E0284 src/librustc/traits/error_reporting.rs type annotations required: cannot resolve {}
E0311 src/librustc/infer/error_reporting/mod.rs "{} may not live long enough", labeled_user_string
E0313 src/librustc/infer/error_reporting/mod.rs lifetime of borrowed pointer outlives lifetime of captured variable
E0314 src/librustc/infer/error_reporting/note.rs closure outlives stack frame
E0315 src/librustc/infer/error_reporting/note.rs cannot invoke closure outside of its lifetime
E0316 src/librustc/middle/resolve_lifetime.rs nested quantification of lifetimes
E0320 src/librustc/traits/query/dropck_outlives.rs recursive overflow during dropck
E0377 src/librustc_typeck/coherence/builtin.rs the trait CoerceUnsized may only be implemented for a coercion
E0456 src/librustc_metadata/creader.rs plugin {} is not available for triple {} (only found {})", name, config::host_triple(), self.sess.opts.target_triple
E0457 src/librustc_metadata/creader.rs plugin {} only found in rlib format, but must be available in dylib format"
E0460 src/librustc_metadata/locator.rs found possibly newer version of crate .. OR found possibly newer version of crate .. which {} depends on
E0461 src/librustc_metadata/locator.rs couldn't find crate {} with expected target triple {}{}" OR couldn't find crate {} with expected target triple {} which {} depends on
E0462 src/librustc_metadata/locator.rs "found staticlib {} instead of rlib or dylib{}
E0464 src/librustc_metadata/locator.rs multiple matching crates for {}
E0465 src/librustc_metadata/locator.rs multiple {} candidates for {} found", flavor, self.crate_name
E0472 src/librustc_passes/ast_validation.rs "asm! is unsupported on this target"
E0473 src/librustc/infer/error_reporting/note.rs dereference of reference outside its lifetime
E0474 src/librustc/infer/error_reporting/note.rs captured variable .. does not outlive the enclosing closure
E0475 src/librustc/infer/error_reporting/note.rs index of slice outside its lifetime
E0476 src/librustc/infer/error_reporting/note.rs lifetime of the source pointer does not outlive lifetime bound...
E0477 src/librustc/infer/error_reporting/note.rs the type .. does not fulfill the required lifetime...
E0479 src/librustc/infer/error_reporting/note.rs the type {} (provided as the value of a type parameter) is not valid at this point
E0480 src/librustc/infer/error_reporting/note.rs lifetime of method receiver does not outlive the method call
E0481 src/librustc/infer/error_reporting/note.rs lifetime of function argument does not outlive the function call
E0482 src/librustc/infer/error_reporting/note.rs lifetime of return value does not outlive the function call
E0483 src/librustc/infer/error_reporting/note.rs lifetime of operand does not outlive the operation
E0484 src/librustc/infer/error_reporting/note.rs reference is not valid at the time of borrow
E0485 src/librustc/infer/error_reporting/note.rs automatically reference is not valid at the time of borrow
E0486 src/librustc/infer/error_reporting/note.rs type of expression contains references that are not valid during the expression: {}
E0487 src/librustc/infer/error_reporting/note.rs unsafe use of destructor: destructor might be called while references are dead
E0488 src/librustc/infer/error_reporting/note.rs lifetime of variable does not enclose its declaration
E0489 src/librustc/infer/error_reporting/note.rs type/lifetime parameter not in scope here
E0490 src/librustc/infer/error_reporting/note.rs a value of type {} is borrowed for too long
E0495 src/librustc/infer/error_reporting/mod.rs cannot infer an appropriate lifetime due to conflicting requirements
E0498 src/librustc_plugin/load.rs malformed plugin attribute
E0514 src/librustc_metadata/locator.rs metadata version mismatch
E0523 src/librustc_metadata/creader.rs found two different crates with name {} that are not distinguished by differing -C metadata. This will result in symbol conflicts between the two.
@Havvy

This comment has been minimized.

Copy link
Contributor

Havvy commented Jun 10, 2018

The following are not listed at all, but are missing:

  • 0523, 0524, 0526, 0531, 0533, 0538-0551, 0553, 0555, 0556, 0561. 0563, 0564, 0566-0568, 0573-0578, 0584, 0592, 0594, 0598, 0613, 0623, 0625, 0627-0632, 0634-0637, 0640-0642, 0645, 0648-0657, 0660-0688, 0693, 0694, 0696-0907 (???? at this last range)
@GuillaumeGomez

This comment has been minimized.

Copy link
Member Author

GuillaumeGomez commented Jun 10, 2018

There is a 907????????

@GuillaumeGomez

This comment has been minimized.

Copy link
Member Author

GuillaumeGomez commented Jun 10, 2018

I'm fixing those codes...

EDIT: Done in #51475.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment