Uh oh!
There was an error while loading. Please reload this page.
Add error for ... in expressions - #45773
Conversation
rust-highfive
commented
Nov 5, 2017
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @nikomatsakis (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see the contribution instructions for more information. |
petrochenkov
commented
Nov 5, 2017
I'm sad every time I have to @bors r+ this |
bors
commented
Nov 5, 2017
📌 Commit 0419a3b has been approved by |
There was a problem hiding this comment.
My main concern is that in order to show the error we need to parse the expression, so here I'm parsing Token::DotDotDot as AssocOp::DotDotEq, and in src/libsyntax/parse/parser.rs I check for Token::DotDotDot and AssocOp::DotDotEq to show the error. An alternative would be returning None here but then the expression would be incomplete (adding the generic "expected one of" error).
There was a problem hiding this comment.
I'm parsing
Token::DotDotDotasAssocOp::DotDotEq
That's exactly what is needed for good error recovery.
bors
commented
Nov 6, 2017
⌛ Testing commit 0419a3b697be90d36efed6d91bee5c371e29f0a6 with merge c48637001106cd9eb78d037fb77aa7602d28f83c... |
bors
commented
Nov 6, 2017
💔 Test failed - status-travis |
kennytm
commented
Nov 6, 2017
Several run-pass/range_inclusive.rsrun-pass/range_inclusive_gate.rs |
Badel2
commented
Nov 6, 2017
I'm confused. The error says that line 20 of range_inclusive.rs is rust/src/test/run-pass/range_inclusive.rs Line 20 in 54bbd56 |
petrochenkov
commented
Nov 6, 2017
@Badel2 Could you also add a test checking that if |
Badel2
commented
Nov 6, 2017
I have added a parse-fail test, but I can't find the pretty-printing code. The closest I got is the code for ranges in patterns, but I can't find the one for expressions. rust/src/librustc/hir/print.rs Line 1821 in 19402f1 |
petrochenkov
commented
Nov 6, 2017
@Badel2 rust/src/libsyntax/print/pprust.rs Line 2207 in 19402f1 |
Badel2
commented
Nov 6, 2017
@petrochenkov Thanks! I hope it's fixed now. |
petrochenkov
commented
Nov 6, 2017
@bors r+ |
bors
commented
Nov 6, 2017
📌 Commit c0addf6 has been approved by |
Badel2
commented
Nov 6, 2017
That's strange, in my machine I run |
petrochenkov
commented
Nov 6, 2017
I see why only the first error is detected, the test is missing , but it should fail locally as well. ( |
Badel2
commented
Nov 6, 2017
@petrochenkov Same result, it fails on travis but it works on my machine. I haven't run |
There was a problem hiding this comment.
It looks like this debug_assert may be firing on CI.
IIRC, these kinds of asserts are enabled on PR merge, but disabled by default for local builds.
There was a problem hiding this comment.
Ok, for some reason I thought the code would stop executing after the err.emit(). Now it all makes sense. Thank you very much!
petrochenkov
commented
Nov 7, 2017
@bors r+ |
bors
commented
Nov 7, 2017
📌 Commit b81a7b3 has been approved by |
bors
commented
Nov 10, 2017
bors
commented
Nov 10, 2017
☀️ Test successful - status-appveyor, status-travis |
Follow-up to #44709
Tracking issue: #28237
...in expressions was a warning, now it's an error..or..=instead, and explains the difference...to..=r? petrochenkov