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

Handle emplacement oddity? #47

Open
ehuss opened this issue Jun 28, 2019 · 3 comments
Open

Handle emplacement oddity? #47

ehuss opened this issue Jun 28, 2019 · 3 comments
Labels
ambiguity Potential sources of ambiguity bug Something isn't working 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

The following fails to parse in libsyntax due to the <- being a token, it requires spaces to parse properly.

if x<-1 {}

The lyg grammar parses it in a sane way.

It's never been clear to me whether or not this is a bug in rustc. We'll need to figure out our policy for documenting bugs.

@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

This is a bug in rustc, <- should decompose into < and -. cc @petrochenkov @varkor

@Centril
Copy link
Contributor

Centril commented Jul 1, 2019

@eddyb I don't think it's a bug; see rust-lang/rust#60803.

@Centril Centril added ambiguity Potential sources of ambiguity bug Something isn't working restrictions Issues related to the permissiveness of the grammar labels Jul 1, 2019
@eddyb
Copy link
Member

eddyb commented Jul 1, 2019

Ah, I misremembered the decision there. I think the approach taken is a hack, and relies on the obsolete (pre-proc_macro) token model in libsyntax - whenever we get rid of that, it will implicitly switch to also parsing like a < -b (at least we have tests, but it's still a bit scary).

In that case, I propose we treat it as if it were supported, i.e. Expr |= Expr "<-" Expr, which will cause an ambiguity with the a < -b parse, that we would need to resolve anyway if it were suported.
Only then can we start restricting it away (and not risk the implicit fallback to a < -b).

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
ambiguity Potential sources of ambiguity bug Something isn't working 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

3 participants