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 up`if foo {}.bar()` parses successfully, but `if foo {} + bar` and `foo! {}.bar()` do not #21222
Comments
kmcallister
added
the
A-parser
label
Jan 16, 2015
This comment has been minimized.
This comment has been minimized.
|
Runnable:
uncommenting either gives
|
frewsxcv
referenced this issue
Mar 20, 2016
Open
Compiler fails on function with if-statement multiplied by float #32368
huonw
added
I-nominated
T-lang
labels
Mar 20, 2016
This comment has been minimized.
This comment has been minimized.
|
There is a distinction between Moreover, code like this is both legal now and reasonable: if foo { bar } else { baz }.debug_print();so I don't really think we ought to be changing this. That said, the fact that a macro invocation is treated as an item is somewhat inconsistent but probably for the best. I think we could make |
This comment has been minimized.
This comment has been minimized.
|
triage: P-medium |
rust-highfive
added
P-medium
and removed
I-nominated
labels
Mar 24, 2016
This comment has been minimized.
This comment has been minimized.
|
triage: P-low (patch welcome, don't plan to fix it in near term) |
rust-highfive
added
P-low
and removed
P-medium
labels
Mar 24, 2016
This comment has been minimized.
This comment has been minimized.
|
Just to be clear to future readers: a strong reason for why we treat the addition operator |
This comment has been minimized.
This comment has been minimized.
|
The first example is fixed (i.e., |
This comment has been minimized.
This comment has been minimized.
|
I'm personally happy with the current behavior, I think. |
This comment has been minimized.
This comment has been minimized.
|
I think I will close; I don't really see that there is anything to fix here. |
P1start commentedJan 16, 2015
It seems a tiny bit inconsistent that
if foo {}.bar()parses successfully, butif foo {} + bardoes not, given that.and+are both binary operators. The former isn’t ambiguous (whereas the latter would be if we got a unary+operator), but I still think that it’d be best to either be consistent with+and reject it, or at least adjust macro invocations with curly braces to accept.s afterwards as well.