Skip to content

reference lexer and grammar incorrectly handle tuple field expressions #32776

Closed
@tromey

Description

@tromey

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-grammarArea: The grammar of RustC-bugCategory: This is a bug.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions