Skip to content

Rust does not allow trailing commas in a fn signature #6506

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
Kimundi opened this issue May 15, 2013 · 5 comments
Closed

Rust does not allow trailing commas in a fn signature #6506

Kimundi opened this issue May 15, 2013 · 5 comments
Labels
A-grammar Area: The grammar of Rust A-parser Area: The lexing & parsing of Rust source code to an AST

Comments

@Kimundi
Copy link
Member

Kimundi commented May 15, 2013

I think this can be considered a bug, seeing how trailing commas generally are allowed at other places:

foo.rs:5:33: 5:34 error: unexpected token: `)`
foo.rs:5          fn foo(a: uint, b: uint,) -> uint { a + b }
                                          ^
@brson
Copy link
Contributor

brson commented Jul 9, 2013

Yeah, it would be consistent, maybe it could useful in macros, but ... ew.

@catamorphism
Copy link
Contributor

I agree with @brson 's "ew", and I would much rather declare that commas are always element separators, but I guess we should discuss. Nominating for milestone 1, well-defined.

@catamorphism
Copy link
Contributor

Accepted for well-defined

@nikomatsakis
Copy link
Contributor

I think it ought to be consistent. It looks ugly in that example but it is useful for macros and, if you put a and b on their own lines, for generating better diffs

@sanxiyn
Copy link
Member

sanxiyn commented Jan 3, 2014

Triage. This was discussed in the meeting, and the decision was to allow trailing commas.

@bors bors closed this as completed in de50c56 Jan 22, 2014
flip1995 pushed a commit to flip1995/rust that referenced this issue Jan 2, 2021
… r=Manishearth

Lint "&PathBuf instead of &Path" in PTR_ARG

fixes rust-lang#6502

changelog: lint "`&PathBuf` instead of `&Path`" in `PTR_ARG`
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

Successfully merging a pull request may close this issue.

5 participants