Skip to content

Create a helpful error message when typing "mut ref" instead of "ref mut" #43286

Closed
@locka99

Description

@locka99

I've gotten the order of mut and ref mixed up a few times like this:

let mut ref y = &x;

This generates a "error: expected identifier, found keyword ref" error which isn't too helpful for people used to languages that allows the order of keywords to be mixed e.g. static and const in C/C++.

The compiler should suggest "did you mean 'ref mut'?" for the above.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsA-parserArea: The lexing & parsing of Rust source code to an ASTC-enhancementCategory: An issue proposing an enhancement or a PR with one.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions