Skip to content

error: expected one of { or an operator, found } #36611

Closed
@glandium

Description

@glandium

I did a stupid typo in a program, where I typed in twice in a for statement:

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

The compiler pointed the error on the closing brace, which, in the real code, with much more things happening in the loop (plus nested loops) was completely unhelpful.

error: expected one of `{` or an operator, found `}`
 --> <anon>:5:1
  |
5 | }
  | ^

error: aborting due to previous error

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.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