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

Bad "possible candidate is found in another module" suggestion #55951

Closed
alexreg opened this issue Nov 14, 2018 · 2 comments
Closed

Bad "possible candidate is found in another module" suggestion #55951

alexreg opened this issue Nov 14, 2018 · 2 comments
Labels
A-diagnostics Area: Messages for errors, warnings, and lints

Comments

@alexreg
Copy link
Contributor

alexreg commented Nov 14, 2018

I encountered this when doing some work on the compiler. I started using the Binder type in code, then compiled, and correctly received an error that the type isn't in scope. However, the "possible candidate is found in another module" help message suggests a path that is private, rather than the public re-export at ty::Binder. I think the candidate search algorithm ignores the visibility of the type, and stops searching too early.

error[E0412]: cannot find type `Binder` in this scope
   --> librustc/traits/util.rs:121:29
    |
121 |     -> impl Iterator<Item = Binder<ty::Predicate<'tcx>>> + 'gcx
    |                             ^^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
11  | use ty::sty::Binder;
    |
@euclio
Copy link
Contributor

euclio commented Nov 14, 2018

cc #21934

@csmoe csmoe added the A-diagnostics Area: Messages for errors, warnings, and lints label Nov 15, 2018
@dtolnay
Copy link
Member

dtolnay commented Oct 21, 2019

Closing as a duplicate of #21934.

@dtolnay dtolnay closed this as completed Oct 21, 2019
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
Projects
None yet
Development

No branches or pull requests

4 participants