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

Should there be more path kinds? #56

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

Should there be more path kinds? #56

ehuss opened this issue Jun 28, 2019 · 1 comment
Labels
ambiguity Potential sources of ambiguity grammar Issues with the definition of the rust grammar restrictions Issues related to the permissiveness of the grammar

Comments

@ehuss
Copy link
Contributor

ehuss commented Jun 28, 2019

Currently the grammar has two path kinds: "Path" and "QPath".

However, I feel like there should be two more kinds. Here's what I see:

"Simple" paths, or "mod"-style paths.

See https://doc.rust-lang.org/nightly/reference/paths.html#simple-paths

Where Invalid example
use paths use a<b>
visibility paths pub (in a<b>)
macro call a<b>!{}
attributes #[a<b>]

"Expression" paths

See https://doc.rust-lang.org/nightly/reference/paths.html#paths-in-expressions

In patterns and a variety of expressions, this path form doesn't allow generic arguments without ::.

Expressions: let x = a<b>;

Patterns if let x = ..a<b> {}

@ehuss ehuss added the grammar Issues with the definition of the rust grammar label Jun 28, 2019
@eddyb
Copy link
Member

eddyb commented Jul 1, 2019

IMO this sort of distinction is mostly/only important when ambiguity is involved.
Which I believe only applies for paths within expressions/patterns (including macro invocations).

@eddyb eddyb added restrictions Issues related to the permissiveness of the grammar ambiguity Potential sources of ambiguity and removed restrictions Issues related to the permissiveness of the grammar labels Jul 1, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
ambiguity Potential sources of ambiguity grammar Issues with the definition of the rust grammar restrictions Issues related to the permissiveness of the grammar
Projects
None yet
Development

No branches or pull requests

2 participants