Skip to content

Errors with the same span should only print the erroneous span once #4569

Closed
@bstrie

Description

@bstrie

The following program:

fn main() {
    foo::bar::baz();
}

produces the following output:

blah.rs:2:4: 2:17 error: unresolved name
blah.rs:2     foo::bar::baz();
              ^~~~~~~~~~~~~
blah.rs:2:4: 2:17 error: use of undeclared module `foo::bar`
blah.rs:2     foo::bar::baz();
              ^~~~~~~~~~~~~
blah.rs:2:4: 2:17 error: unresolved name: foo::bar::baz
blah.rs:2     foo::bar::baz();
              ^~~~~~~~~~~~~
error: aborting due to 3 previous errors

How noisy! All three errors have the exact same span, so rustc should be smart enough to only print the span once, like so:

blah.rs:2:4: 2:17 error: unresolved name
                  error: use of undeclared module `foo::bar`
                  error: unresolved name: foo::bar::baz
blah.rs:2     foo::bar::baz();
              ^~~~~~~~~~~~~
error: aborting due to 3 previous errors

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsA-resolveArea: Name/path resolution done by `rustc_resolve` specifically

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions