Skip to content

“help: place this code inside a block” is… pretty confusing #30037

@nagisa

Description

@nagisa
fn main() {
    let n = 1;
    if 5 == {
        println!("five");
    }
}

reports

<anon>:6:1: 6:2 error: expected `{`, found `}`
<anon>:6 }
         ^
<anon>:6:1: 6:2 help: place this code inside a block

The help message is pretty confusing. Which code it has in mind? There’s no code which you could place into a block to fix this error either, as far as I can see.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lints

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions