Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upParsing inconsistencies (lambda, proc, return) #28784
Comments
This comment has been minimized.
This comment has been minimized.
|
/cc @rust-lang/lang , can we disambiguate what's intended here? |
steveklabnik
added
the
A-lang
label
Oct 4, 2015
nikomatsakis
added
the
A-parser
label
Oct 6, 2015
This comment has been minimized.
This comment has been minimized.
|
I agree with @rprichard's take for the most part. I guess that triage: P-medium |
rust-highfive
added
the
P-medium
label
Oct 6, 2015
nikomatsakis
added
the
T-compiler
label
Oct 6, 2015
brson
added
P-low
E-easy
and removed
P-medium
labels
Jul 14, 2016
This comment has been minimized.
This comment has been minimized.
|
Probably a good beginner bug for someone familiar with parsing. |
This comment has been minimized.
This comment has been minimized.
|
Make the rustc parser behavie like parser-lalr, per the op. |
This comment has been minimized.
This comment has been minimized.
|
I'm reaaonably familiar with parsers and I'd like to take a crack at this bug. |
This comment has been minimized.
This comment has been minimized.
|
@neunenak You got it! |
This comment has been minimized.
This comment has been minimized.
|
@nikomatsakis @nrc @pnkfelix Can you confirm the right thing to do here is make libsyntax behave like the reference parser as described in the OP? |
This comment has been minimized.
This comment has been minimized.
|
It's probably worth addressing any inconsistencies between the parser the reference on an individual basis. I don't have enough faith in the reference to say it is always right. My opinions on the issues in the OP: I think
agree on the last two points - bugs in the reference. |
This comment has been minimized.
This comment has been minimized.
|
|
nikomatsakis
referenced this issue
Nov 4, 2016
Merged
Implement the `loop_break_value` feature. #37487
This comment has been minimized.
This comment has been minimized.
|
@neunenak Are you still interested in this? If not, I'd like to take a stab at it. |
This comment has been minimized.
This comment has been minimized.
|
I'm afraid I had more trouble with it than I thought, please go ahead and
take a stab.
…On Mon, Jan 23, 2017 at 11:54 PM, Taylor Cramer ***@***.***> wrote:
@neunenak <https://github.com/neunenak> Are you still interested in this?
If not, I'd like to take a stab at it.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#28784 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AATA-WBhZjRJrb3XXKr0Tq2LfLt9RJ7Xks5rVa4jgaJpZM4GG9HU>
.
|
This comment has been minimized.
This comment has been minimized.
|
Thanks! I took a look at the parser, and I think the issue with Edit: for context, the |
cramertj
referenced this issue
Jan 25, 2017
Closed
Fix parsing for casting an empty return expression #39303
This comment has been minimized.
This comment has been minimized.
|
I went ahead and opened #39303 fixing Moving forward, what's left to do for this issue? Are all the rest just parser-lalr fixes? I don't think the lambda issue can be fixed backward-compatibly, can it? (Since we'd be stopping something from parsing that used to parse.) Edit: wound up making a new PR handling the remaining |
This comment has been minimized.
This comment has been minimized.
|
@cramertj a good question. One of my long-standing "to do" items has been to pick up work on rustypop -- in particular adding a test harness -- as a replacement for parser-lalr. When I was porting the LALR grammar, I found a number of irregularities that struck me as wrong -- often holdovers from the early days of Rust -- as well as various things whose meaning were not obvious (e.g., precedence tricks). The LALRPOP port is free of those problems. Separately, I think we have put off reaching a firm decision on a lot of these questions. This needs some organization and I think no one has had the time. I would love to find someone who would be interested in collaborating with me on one or both aspects of this project. If you are interesting, please ping me on irc ( |
This comment has been minimized.
This comment has been minimized.
|
@nikomatsakis Email'd you. |
alexcrichton
added a commit
to alexcrichton/rust
that referenced
this issue
Jan 27, 2017
alexcrichton
added a commit
to alexcrichton/rust
that referenced
this issue
Jan 27, 2017
alexcrichton
added a commit
to alexcrichton/rust
that referenced
this issue
Jan 28, 2017
steveklabnik
added
T-lang
and removed
A-lang
labels
Mar 24, 2017
Mark-Simulacrum
added
the
C-bug
label
Jul 24, 2017
Manishearth
removed
the
hacktoberfest
label
Sep 28, 2017
This comment has been minimized.
This comment has been minimized.
|
This seems like an interesting fix. I'll take a look at it and see what I can figure out. -- Colin |
rprichard commentedOct 1, 2015
I found more inconsistencies between
rustcandparser-lalr.I also noticed that Rust allows return expressions and lambda expressions to end with a struct literal, even when they're in a nostruct context. This seems inconsistent to me.
Lambdas (the two parsers disagree):
Return expressions (the two parsers agree):
The
rustcandparser-lalrparsers disagree about whether a barereturnexpression can be cast:Finally, I also noticed these two differences, which seem much less interesting to me. The grammar is probably just out-of-date or buggy:
lambda sometimes requires braces:
procis obsolete: