Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
sebcrozet opened this issue Aug 27, 2013 · 4 comments
Closed
Labels
A-grammar Area: The grammar of Rust A-parser Area: The lexing & parsing of Rust source code to an AST

Comments

@sebcrozet
Copy link
Contributor

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.

@huonw
Copy link
Member

huonw commented Sep 3, 2013

Very similar to #6506, although that issue doesn't cover the (&self, ) case.

@metajack
Copy link
Contributor

Triage bump; still a problem.

@ftxqxd
Copy link
Contributor

ftxqxd commented Sep 19, 2014

Fixed by #16646.

@alexcrichton
Copy link
Member

Thanks @P1start!

flip1995 pushed a commit to flip1995/rust that referenced this issue May 5, 2022
Rustup

r? `@ghost`

changelog: move trait_duplication_in_bounds and type_repetition_in_bounds to nursery temporarily. This could already be reverted before the release. Check the Clippy in the Rust repo beta branch when writing this changelog.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-grammar Area: The grammar of Rust A-parser Area: The lexing & parsing of Rust source code to an AST
Projects
None yet
Development

No branches or pull requests

5 participants