Skip to content

Incorrect raw identifier variable name help suggestion #68962

Closed
@olegnn

Description

@olegnn

Incorrect hint for variable with a similar name defined using raw identifiers

fn main() {
    let r#final = 1;
    r#fina;
}

(Playground)

Errors:

   Compiling playground v0.0.1 (/playground)
error[E0425]: cannot find value `fina` in this scope
 --> src/main.rs:3:5
  |
3 |     r#fina;
  |     ^^^^^^ help: a local variable with a similar name exists: `final`

error: aborting due to previous error

For more information about this error, try `rustc --explain E0425`.
error: could not compile `playground`.

To learn more, run the command again with --verbose.

Should be help: a local variable with a similar name exists: r#final

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsC-enhancementCategory: An issue proposing an enhancement or a PR with one.D-invalid-suggestionDiagnostics: A structured suggestion resulting in incorrect code.E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions