Skip to content

Diagnostic strips leading underscore #121776

@joshlf

Description

@joshlf

I tried the following code on Rust 1.76.0:

enum _Foo {
    Bar
}

fn main() {
    let _ = Foo::Bar;
}

I got the following error:

error[E0433]: failed to resolve: use of undeclared type `Foo`
 --> src/main.rs:6:13
  |
6 |     let _ = Foo::Bar;
  |             ^^^ use of undeclared type `Foo`
  |
help: an enum with a similar name exists, consider changing it
  |
1 | enum Foo {
  |      ~~~

Note that the suggestion has stripped the leading _ character from the enum's name.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsA-resolveArea: Name/path resolution done by `rustc_resolve` specificallyA-suggestion-diagnosticsArea: Suggestions generated by the compiler applied by `cargo fix`D-confusingDiagnostics: Confusing error or lint that should be reworked.S-has-mcveStatus: A Minimal Complete and Verifiable Example has been found for this issue

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions