Skip to content

Clarify longest match behavior of the grammar #1814

Open
@msprotz

Description

@msprotz

https://doc.rust-lang.org/reference/expressions.html claims as binds tighter than than + or <

Indeed, with +: let b = 0 as u32 + 0 as u32 parses correctly,

However, with <: let b = 0 as u32 < 0 as u32 gives a syntax error.

I suspect this is due to a conflict in the grammar that looks ahead at the token < and sees the beginning of a type application (in types), but if I'm reading just https://doc.rust-lang.org/reference/expressions.html#r-expr.precedence there's not enough information for me to write a correct Rust syntax printer.

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