Skip to content

Commit 3a5fb6a

Browse files
authored
Merge pull request #1825 from rust-lang/TC/fix-range-pattern-bound
Fix grammar for `RangePatternBound` regarding literals
2 parents bf89144 + 4b4ae59 commit 3a5fb6a

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/patterns.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -485,10 +485,7 @@ ObsoleteRangePattern ->
485485
RangePatternBound `...` RangePatternBound
486486
487487
RangePatternBound ->
488-
CHAR_LITERAL
489-
| BYTE_LITERAL
490-
| `-`? INTEGER_LITERAL
491-
| `-`? FLOAT_LITERAL
488+
LiteralPattern
492489
| PathExpression
493490
```
494491

@@ -541,7 +538,11 @@ A bound is written as one of:
541538

542539
* A character, byte, integer, or float literal.
543540
* A `-` followed by an integer or float literal.
544-
* A [path]
541+
* A [path].
542+
543+
> [!NOTE]
544+
>
545+
> We syntactically accept more than this for a *[RangePatternBound]*. We later reject the other things semantically.
545546
546547
r[patterns.range.constraint-bound-path]
547548
If a bound is written as a path, after macro resolution, the path must resolve to a constant item of the type `char`, an integer type, or a float type.

0 commit comments

Comments
 (0)