Commit bc4573a
committed
Fix grammar for
The compiler, in parsing, accepts many more kinds of literals in the
bound of a range pattern than what we had documented, and as with
`PatternWithoutRange`, the parser allows each of these literals to be
prefixed with `-`. E.g.
```rust
#[cfg(any())]
match () {
..-true | ..-false => (),
..-'x' => (),
..-b'x' => (),
..-"x" => (),
..-r"x" => (),
..-br"x" => (),
..-c"x" => (),
..-cr"x" => (),
..-1 => (),
..-1.1 => (),
}
```
Let's fix this by adjusting the `RangePatternBound` production to use
`LiteralPattern`. In a separate PR, we've adjusted `LiteralPattern`
to allow for a minus sign ahead of all literal expressions.
To help the reader, let's also add a note that highlights that what we
discuss later as being allowed semantically is more restrictive than
what we allow in parsing (and therefore in the grammar).RangePatternBound regarding literals1 parent 048d75a commit bc4573a
1 file changed
+6
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
497 | 497 | | |
498 | 498 | | |
499 | 499 | | |
500 | | - | |
501 | | - | |
502 | | - | |
503 | | - | |
| 500 | + | |
504 | 501 | | |
505 | 502 | | |
506 | 503 | | |
| |||
553 | 550 | | |
554 | 551 | | |
555 | 552 | | |
556 | | - | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
557 | 558 | | |
558 | 559 | | |
559 | 560 | | |
| |||
0 commit comments