Skip to content
This repository has been archived by the owner on Apr 8, 2024. It is now read-only.

Should generic argument order be part of the syntax? #40

Open
ehuss opened this issue Jun 28, 2019 · 1 comment
Open

Should generic argument order be part of the syntax? #40

ehuss opened this issue Jun 28, 2019 · 1 comment
Labels
grammar Issues with the definition of the rust grammar I-nominated-lang Nominated for language team discussion restrictions Issues related to the permissiveness of the grammar

Comments

@ehuss
Copy link
Contributor

ehuss commented Jun 28, 2019

In 1.34, via rust-lang/rust#58191, the restriction that lifetimes appear before types in generic arguments was removed from libsyntax. However, type bindings are still required to be after types and lifetimes.

Should this order constraint be part of the syntax? The current lyg grammar (and libsyntax) encodes this restriction. But after discussing this on Discord, I was wondering why relax one constraint but not the other?

Example:

fn test<W, I: Trait<Item=(), W> >() {}

See parse_generic_args which I think implies this should not be restricted.

@ehuss ehuss added the grammar Issues with the definition of the rust grammar label Jun 28, 2019
@eddyb eddyb added restrictions Issues related to the permissiveness of the grammar and removed restrictions Issues related to the permissiveness of the grammar labels Jul 1, 2019
@Centril
Copy link
Contributor

Centril commented Jul 10, 2019

I believe this is a bug on rustc's end since we never signed off on this parser change. (it may very well be that it should not matter syntactically, just semantically...). On the other hand, we (the language team) could also decide that this is fine and leave it be. I'll bring it up on a T-Lang meeting to see what we want to do.

@Centril Centril added the I-nominated-lang Nominated for language team discussion label Jul 10, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
grammar Issues with the definition of the rust grammar I-nominated-lang Nominated for language team discussion restrictions Issues related to the permissiveness of the grammar
Projects
None yet
Development

No branches or pull requests

3 participants