Skip to content

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

Closed
@alexreg

Description

@alexreg

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;
    |

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lints

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions