Skip to content

'as', '<' and '*' can cause a parsing error #32852

Closed
@keeperofdakeys

Description

@keeperofdakeys

The following code snippet is causing an error that might be avoidable (I suspect a parsing error, but I don't know how the grammar is actually defined, so this is just a guess). The error is "bare raw pointers are no longer allowed".

fn main() { let a = &4u64; println!("{}", 43 as u64 < *a);

I suspect that the *a is being interpreted as the start of a type generic, when it's actually dereferencing a value. Adding brances '( ... )' fixes the issue, as well as reordering the statement into a '>'. The problem occurs on both stable and nightly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions