Skip to content

Rustc should explain that it can explain #15981

Closed
@alexcrichton

Description

@alexcrichton

For example

fn main() {
    match 1i {
        1 => {}
    }
}
$ rustc foo.rs
foo.rs:2:5: 4:6 error: non-exhaustive patterns: `_` not covered [E0004]                                             
foo.rs:2     match 1i {                                                                                             
foo.rs:3         1 => {}                                                                                            
foo.rs:4     }                                                                                                      

Without prior knowledge of the --explain flag the error code listed is a little confusing here. The compiler should print a message at the end saying "pass the error code to --explain" or something like that if one is available.

Additionally, the compiler should instruct how to help contribute to documentation of error codes when documentation is not available, for example:

$ rustc --explain E0004
error: no extended information for E0004

Instead, the compiler could suggest looking at the contributing guidelines and also instruction where one would contribute if they were interested.

cc @jakub-, @brson

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lints

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions