Skip to content

Commit 589c216

Browse files
committed
Fix grammar for range pattern not allowed in reference pattern.
1 parent 4033b60 commit 589c216

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

src/patterns.md

+12-4
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,15 @@
22

33
> **<sup>Syntax</sup>**\
44
> _Pattern_ :\
5+
> &nbsp;&nbsp; &nbsp;&nbsp; _PatternWithoutRange_\
6+
> &nbsp;&nbsp; | [_RangePattern_]
7+
>
8+
> _PatternWithoutRange_ :\
59
> &nbsp;&nbsp; &nbsp;&nbsp; [_LiteralPattern_]\
610
> &nbsp;&nbsp; | [_IdentifierPattern_]\
711
> &nbsp;&nbsp; | [_WildcardPattern_]\
812
> &nbsp;&nbsp; | [_RestPattern_]\
9-
> &nbsp;&nbsp; | [_RangePattern_]\
13+
> &nbsp;&nbsp; | [_ObsoleteRangePattern_]\
1014
> &nbsp;&nbsp; | [_ReferencePattern_]\
1115
> &nbsp;&nbsp; | [_StructPattern_]\
1216
> &nbsp;&nbsp; | [_TupleStructPattern_]\
@@ -378,8 +382,10 @@ match tuple {
378382

379383
> **<sup>Syntax</sup>**\
380384
> _RangePattern_ :\
381-
> &nbsp;&nbsp;&nbsp;&nbsp; _RangePatternBound_ `..=` _RangePatternBound_\
382-
> &nbsp;&nbsp; | _RangePatternBound_ `...` _RangePatternBound_
385+
> &nbsp;&nbsp; _RangePatternBound_ `..=` _RangePatternBound_
386+
>
387+
> _ObsoleteRangePattern_ :\
388+
> &nbsp;&nbsp; _RangePatternBound_ `...` _RangePatternBound_
383389
>
384390
> _RangePatternBound_ :\
385391
> &nbsp;&nbsp; &nbsp;&nbsp; [CHAR_LITERAL]\
@@ -486,7 +492,7 @@ ranges containing all Unicode Scalar Values: `'\u{0000}'..='\u{D7FF}'` and
486492

487493
> **<sup>Syntax</sup>**\
488494
> _ReferencePattern_ :\
489-
> &nbsp;&nbsp; (`&`|`&&`) `mut`<sup>?</sup> _Pattern_
495+
> &nbsp;&nbsp; (`&`|`&&`) `mut`<sup>?</sup> [_PatternWithoutRange_]
490496
491497
Reference patterns dereference the pointers that are being matched
492498
and, thus, borrow them.
@@ -725,9 +731,11 @@ refer to refutable constants or enum variants for enums with multiple variants.
725731
[_IdentifierPattern_]: #identifier-patterns
726732
[_LiteralPattern_]: #literal-patterns
727733
[_MacroInvocation_]: macros.md#macro-invocation
734+
[_ObsoleteRangePattern_]: #range-patterns
728735
[_PathInExpression_]: paths.md#paths-in-expressions
729736
[_PathPattern_]: #path-patterns
730737
[_Pattern_]: #patterns
738+
[_PatternWithoutRange_]: #patterns
731739
[_QualifiedPathInExpression_]: paths.md#qualified-paths
732740
[_RangePattern_]: #range-patterns
733741
[_ReferencePattern_]: #reference-patterns

0 commit comments

Comments
 (0)