-
-
Notifications
You must be signed in to change notification settings - Fork 14.2k
Closed as not planned
Closed as not planned
Copy link
Labels
A-grammarArea: The grammar of RustArea: The grammar of RustC-bugCategory: This is a bug.Category: This is a bug.P-mediumMedium priorityMedium priorityT-langRelevant to the language teamRelevant to the language team
Description
It's not clear to me whether this code is valid syntax. It looks wrong, so maybe it ought to be rejected. rustc rejects it, but parser-lalr accepts it:
struct S { f: i32 }
fn main() {
let s = S { f: 42 };
s as S.f;
}It looks like it should parse as s as (S.f), and that wouldn't parse. parser-lalr parses it as (s as S).f
test.rs:4:11: 4:12 error: expected one of `!`, `(`, `::`, `;`, `<`, `}`, or an operator, found `.`
test.rs:4 s as S.f;
^
(To test the LALR grammar, build the check-grammar target, then run grammar/parser-lalr -v.)
Metadata
Metadata
Assignees
Labels
A-grammarArea: The grammar of RustArea: The grammar of RustC-bugCategory: This is a bug.Category: This is a bug.P-mediumMedium priorityMedium priorityT-langRelevant to the language teamRelevant to the language team