Skip to content

improve wording of "possible candidate is found in another module" with enums #49031

Open
@comex

Description

@comex

When compiling:

enum E { Foo }
fn main() {
    println!("{}", Foo);
}

rustc currently produces:

error[E0425]: cannot find value `Foo` in this scope
 --> src/main.rs:3:20
  |
3 |     println!("{}", Foo);
  |                    ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
  |
1 | use E::Foo;
  |

This is a great error message except for one thing: the enum E is not really a "module" (even if it behaves like one for scoping purposes), so saying the candidate is "in another module" can be confusing. It would be better to modify the wording in this case.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsA-frontendArea: Compiler frontend (errors, parsing and HIR)C-enhancementCategory: An issue proposing an enhancement or a PR with one.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.WG-diagnosticsWorking group: Diagnostics

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions