Skip to content

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

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

Closed
bstrie opened this issue Jan 21, 2013 · 2 comments
Closed

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

bstrie opened this issue Jan 21, 2013 · 2 comments
Labels
A-diagnostics Area: Messages for errors, warnings, and lints A-resolve Area: Name/path resolution done by `rustc_resolve` specifically

Comments

@bstrie
Copy link
Contributor

bstrie commented Jan 21, 2013

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
@recrack
Copy link
Contributor

recrack commented Jan 24, 2013

I'm working on it.

bors added a commit that referenced this issue Apr 23, 2013
This reverts commit 6030e39.

This reorders error messages in ways that aren't intended. A more satisfying solution will require an interface that allows diagnostics to be grouped together, so that messages that logically belong together aren't reordered.

#4569
@brson
Copy link
Contributor

brson commented Apr 23, 2013

@recrack I reverted this change because it reorders related messages in undesirable ways. There are a number of places in the compiler that emit related diagnostics in sequence and their order needs to be preserved. One thing we could do is add transactions that group any emitted diagnostics together. The order of each transaction would be preserved.

@bors bors closed this as completed in b329f2f Apr 27, 2013
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-resolve Area: Name/path resolution done by `rustc_resolve` specifically
Projects
None yet
Development

No branches or pull requests

3 participants