Skip to content

Parser behavior for extra commas on methods declaration is not consistent. #8788

Closed
@sebcrozet

Description

@sebcrozet

With this code, there is no error:

struct Toto;

impl Toto {
    fn doit(&self, ) // No parse error here!
    { }
}

fn main() {
}

But with this code there is an error:

struct Toto;

impl Toto {
    fn doit(_: &uint, ) // error: unexpected token: `)`
    { }
}

fn main() {
}

I don't know if this extra comma should be an error or not (in my opinion this should be an error). But the behavior should be the same in both cases anyway.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-grammarArea: The grammar of RustA-parserArea: The lexing & parsing of Rust source code to an AST

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions