You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
rprichard opened this issue
Sep 11, 2015
· 5 comments
Labels
A-grammarArea: The grammar of RustC-bugCategory: This is a bug.P-mediumMedium priorityT-langRelevant to the language team, which will review and decide on the PR/issue.
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:
structS{f:i32}fnmain(){let s = S{f:42};
s asS.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.)
The text was updated successfully, but these errors were encountered:
rustc 1.16.0 (30cf806ef 2017-03-10)
error: expected one of `!`, `(`, `::`, `;`, `<`, or `}`, found `.`
--> <anon>:4:11
|
4 | s as S.f;
| ^
error[E0308]: mismatched types
--> <anon>:4:5
|
4 | s as S.f;
| ^^^^^^ expected (), found struct `S`
|
= note: expected type `()`
found type `S`
error: aborting due to previous error
brson
added
the
T-lang
Relevant to the language team, which will review and decide on the PR/issue.
label
Mar 23, 2017
A-grammarArea: The grammar of RustC-bugCategory: This is a bug.P-mediumMedium priorityT-langRelevant to the language team, which will review and decide on the PR/issue.
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, butparser-lalr
accepts it: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
(To test the LALR grammar, build the check-grammar target, then run grammar/parser-lalr -v.)
The text was updated successfully, but these errors were encountered: