Skip to content

Recover from mutable variable declaration where mut is placed before let #100197

Closed

Description

@Rageking8

Given the following code:

fn main() {
    mut let x = 123;
}

The current output is:

   Compiling playground v0.0.1 (/playground)
error: expected expression, found keyword `mut`
 --> src/main.rs:2:5
  |
2 |     mut let x = 123;
  |     ^^^ expected expression

error: could not compile `playground` due to previous error

Ideally the output should suggest to move the mut to behind the let, since the current error message does not identify the problem accurately.

Activity

  1. added
    A-diagnosticsArea: Messages for errors, warnings, and lints
    T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.
    on Aug 6, 2022
  2. obeis commented on Aug 6, 2022

    @obeis
    Contributor

    @rustbot claim

  3. added 2 commits that reference this issue on Aug 14, 2022
    431f931
    13b8b6e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

A-diagnosticsArea: Messages for errors, warnings, and lintsT-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