Skip to content
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

reference lexer and grammar incorrectly handle tuple field expressions #32776

Closed
tromey opened this issue Apr 6, 2016 · 3 comments
Closed

reference lexer and grammar incorrectly handle tuple field expressions #32776

tromey opened this issue Apr 6, 2016 · 3 comments
Labels
A-grammar Area: The grammar of Rust C-bug Category: This is a bug.

Comments

@tromey
Copy link
Contributor

tromey commented Apr 6, 2016

The reference grammar in rust/src/grammar/lexer.l returns LIT_INTEGER for any sort of integer, including hex, octal, etc.

Then parser-lalr.y implements tuple field expressions as:

| expr '.' LIT_INTEGER                                { $$ = mk_node("ExprTupleIndex", 1, $1); }

However, rustc rejects hexadecimal here:

b7.rs:4:31: 4:34 error: invalid tuple or tuple struct index
b7.rs:4     println!("{}, {}", x.0, x.0x1);

My guess is that the reference lexer is incorrect here.

@tromey
Copy link
Contributor Author

tromey commented Apr 6, 2016

rustc also seems to reject decimal literals including underscores, so "x.1_" is invalid.

@steveklabnik steveklabnik added the A-grammar Area: The grammar of Rust label Apr 6, 2016
@alexcrichton
Copy link
Member

cc #15880

@Mark-Simulacrum Mark-Simulacrum added C-feature-request Category: A feature request, i.e: not implemented / a PR. C-bug Category: This is a bug. and removed C-feature-request Category: A feature request, i.e: not implemented / a PR. labels Jul 24, 2017
@steveklabnik
Copy link
Member

Triage: all of this is vestigial at this point, and the grammar WG is handling these kinds of issues. Closing.

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 C-bug Category: This is a bug.
Projects
None yet
Development

No branches or pull requests

4 participants