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

Potential error in error (warning) message #23224

Closed
homebru opened this issue Mar 9, 2015 · 1 comment · Fixed by #32439
Closed

Potential error in error (warning) message #23224

homebru opened this issue Mar 9, 2015 · 1 comment · Fixed by #32439
Labels
A-diagnostics Area: Messages for errors, warnings, and lints A-resolve Area: Name resolution

Comments

@homebru
Copy link

homebru commented Mar 9, 2015

I am too new at rust to know if this is really an issue or not.

I was trying to get the sample "guess" program to work. At one point I got this warning:

warning: pattern binding Less is named the same as one of the variants of the type core::cmp::Ordering [E0170]

So I change my namespace to use 'core' and I got this error:

error: failed to resolve. Use of undeclared type or module core::cmp::Ordering

In the end, the solution was to use "std::cmp::Ordering::Less" - so the bug(?) is the warning message steering me to the wrong namespace.

@ghost
Copy link

ghost commented Mar 9, 2015

This is a general problem with paths in error messages and somewhat related to #13065.

What we should be doing is for each resolved definition of an item, find the publicly accessible path to that item. Such a path will always exist due to the restriction on exposing private types. This may or may not be a non-trivial change to resolve, though.

@kmcallister kmcallister added A-diagnostics Area: Messages for errors, warnings, and lints A-resolve Area: Name resolution labels Mar 10, 2015
bors added a commit that referenced this issue Mar 31, 2016
diagnostics: make paths to external items more visible

This PR changes the reported path for an external item so that it is visible from at least one local module (i.e. it does not use any inaccessible external modules) if possible. If the external item's crate was declared with an `extern crate`, the path is guarenteed to use the `extern crate`.

Fixes #23224, fixes #23355, fixes #26635, fixes #27165.

r? @nrc
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 resolution
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants