Skip to content

Improve error message for incorrect 'for' input #40782

Closed
@martinlindhe

Description

@martinlindhe

Hello, with rustc 1.17.0-nightly (8c4f2c6 2017-03-22), the following code

fn main () {
    for i 0..2 {
        println!("{}", i);
    }
}

gives this error message:

error: expected one of `@` or `in`, found `0`
  --> src/disasm/mod.rs:27:15
   |
27 |         for i 0..2 {
   | 

An improved error message could add a hint : did you mean 'for i in 0..2'

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.E-mentorCall for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.WG-diagnosticsWorking group: Diagnostics

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions