Skip to content

Error is not the best with mistyping Struct instead of struct #97793

Description

@passcod

Given the following code: https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021&gist=0c755cbfa505e42fb58dd902968675e5

Struct Foo {
   hello: String,
}

The current output is:

error: expected one of `!`, `.`, `::`, `;`, `?`, `{`, `}`, or an operator, found `Foo`
 --> src/main.rs:2:8
  |
2 | Struct Foo {
  |        ^^^ expected one of 8 possible tokens

Identical on stable and nightly (per playground).

It would be friendler to show some help about the proper casing of struct.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

A-diagnosticsArea: Messages for errors, warnings, and lintsA-parserArea: The lexing & parsing of Rust source code to an ASTD-papercutDiagnostics: An error or lint that needs small tweaks.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