Fix some grammar inconsistencies for the '..' range notation.
Grammar changes:
* allow 'for _ in 1..i {}' (fixes #20241)
* allow 'for _ in 1.. {}' as infinite loop
* prevent use of range notation in contexts where only operators of high
precedence are expected (fixes #20811)
Parser code cleanup:
* remove RESTRICTION_NO_DOTS
* make AS_PREC const and follow naming convention
* make min_prec inclusive
This commit is contained in:
parent
b7930d93d9
commit
db013f9f45
6 changed files with 80 additions and 23 deletions
|
|
@ -3135,18 +3135,17 @@ The precedence of Rust binary operators is ordered as follows, going from
|
|||
strong to weak:
|
||||
|
||||
```{.text .precedence}
|
||||
* / %
|
||||
as
|
||||
* / %
|
||||
+ -
|
||||
<< >>
|
||||
&
|
||||
^
|
||||
|
|
||||
< > <= >=
|
||||
== !=
|
||||
== != < > <= >=
|
||||
&&
|
||||
||
|
||||
=
|
||||
= ..
|
||||
```
|
||||
|
||||
Operators at the same precedence level are evaluated left-to-right. [Unary
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue