Skip to content
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

Closed
GuillaumeGomez opened this issue Apr 6, 2016 · 77 comments
Closed

Add error explanations for all error codes #32777

GuillaumeGomez opened this issue Apr 6, 2016 · 77 comments
Assignees
Labels
A-diagnostics Area: Messages for errors, warnings, and lints A-docs Area: documentation for any part of the project, including the compiler, standard library, and tools C-tracking-issue Category: A tracking issue for an RFC or an unstable feature. E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. E-help-wanted Call for participation: Help is requested to fix this issue. P-medium Medium priority T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

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

@GuillaumeGomez GuillaumeGomez added A-docs E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. labels Apr 6, 2016
@GuillaumeGomez GuillaumeGomez added E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. and removed E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. labels Apr 8, 2016
@marti1125
Copy link
Contributor

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

@GuillaumeGomez
Copy link
Member Author

@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 20, 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 28, 2016
@timothy-mcroy
Copy link

I'm working on E0501.

@timothy-mcroy
Copy link

I'll open a PR for E0502 tomorrow.

@cramertj
Copy link
Member

cramertj commented May 2, 2016

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

@GuillaumeGomez
Copy link
Member Author

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

@cristianoliveira
Copy link
Contributor

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

GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this issue Mar 22, 2017
…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 added the P-medium Medium priority label Mar 22, 2017
frewsxcv added a commit to frewsxcv/rust that referenced this issue Mar 22, 2017
…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
    }
    ```
@CaptainKraft
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
Copy link
Member

@GuillaumeGomez This issue are closed to contribution yet?

@GuillaumeGomez
Copy link
Member Author

@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
Copy link
Member

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

@GuillaumeGomez
Copy link
Member Author

I think it's really outdated.

@markmmm
Copy link

markmmm commented Feb 18, 2018

@GuillaumeGomez
Copy link
Member Author

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

@markmmm
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.

@XAMPPRocky XAMPPRocky added the C-tracking-issue Category: A tracking issue for an RFC or an unstable feature. label May 14, 2018
@Havvy
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
Copy link
Member Author

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

@GuillaumeGomez
Copy link
Member Author

GuillaumeGomez commented Jun 10, 2018

I'm fixing those codes...

EDIT: Done in #51475.

@twe4ked
Copy link

twe4ked commented Apr 23, 2019

Add extended information for E0594 in #60193.

@oli-obk
Copy link
Contributor

oli-obk commented May 24, 2019

@GuillaumeGomez there are new error codes that do not have boxes yet

@GuillaumeGomez
Copy link
Member Author

I think this issue is completely out of date since a moment... Should we open a new one instead?

@Manishearth
Copy link
Member

Manishearth commented May 24, 2019 via email

@GuillaumeGomez
Copy link
Member Author

Ok!

@GuillaumeGomez
Copy link
Member Author

Closing in favor of #61137.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints A-docs Area: documentation for any part of the project, including the compiler, standard library, and tools C-tracking-issue Category: A tracking issue for an RFC or an unstable feature. E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. E-help-wanted Call for participation: Help is requested to fix this issue. P-medium Medium priority T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests