Skip to content

Include scope names in diagnostics #2399

Closed
@da-x

Description

@da-x

(reference implementation: rust-lang/rust#49898 )

So far, rustc has only printed about filenames and line numbers for warnings and errors. I think it is rather missed, compared to gcc and other compilers, that useful context information such as function
names and structs is not included.

We can improve the information that rustc prints for warnings and errors in this regard, by adding a new line to precede the warning or the error.

For example:

In function `test`:
warning: unused variable: `a`
In enum `MyEnum`:
warning: variant is never constructed: `ItemB`
  --> various-warnings.rs:8:5
   |
 8 |     ItemB,
   |     ^^

Metadata

Metadata

Assignees

No one assigned

    Labels

    T-compilerRelevant to the compiler team, which will review and decide on the RFC.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions