Skip to content

Flaw/inconsistency between block expression description and rustc. #762

Closed as not planned
@crlf0710

Description

@crlf0710

Currently this compiles:

fn foo() -> i32 {
    {3}
}

According to https://doc.rust-lang.org/nightly/reference/expressions/block-expr.html , the {3} part cannot be parsed as tail expression, since it's not ExpressionWithoutBlock. If it is parsed as Statement, then there should be a compile error, because its type is not () and the semicolon could not be not eliminated.

@Centril

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-grammarArea: Syntax and parsing

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions