Skip to content

Commit 5978835

Browse files
authored
Merge pull request #2259 from fmease/fix-obs-range-pat-grammars
Fix grammar rules pertaining to obsolete range patterns
2 parents 9fa9987 + a81f18f commit 5978835

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

src/patterns.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ r[patterns.syntax]
66
Pattern -> `|`? PatternNoTopAlt ( `|` PatternNoTopAlt )*
77
88
PatternNoTopAlt ->
9-
PatternWithoutRange
10-
| RangePattern
9+
PatternWithoutModernRange
10+
| ModernRangePattern
1111
12-
PatternWithoutRange ->
12+
PatternWithoutModernRange ->
1313
LiteralPattern
1414
| IdentifierPattern
1515
| WildcardPattern
@@ -22,8 +22,11 @@ PatternWithoutRange ->
2222
| SlicePattern
2323
| PathPattern
2424
| MacroInvocation
25+
| ObsoleteRangePattern[^obsolete-range-edition]
2526
```
2627

28+
[^obsolete-range-edition]: The [ObsoleteRangePattern] syntax is semantically invalid in the 2021 edition and beyond.
29+
2730
r[patterns.intro]
2831
Patterns are used to match values against structures and to, optionally, bind variables to values inside these structures. They are also used in variable declarations and parameters for functions and closures.
2932

@@ -464,13 +467,12 @@ r[patterns.range]
464467

465468
r[patterns.range.syntax]
466469
```grammar,patterns
467-
RangePattern ->
470+
ModernRangePattern ->
468471
RangeExclusivePattern
469472
| RangeInclusivePattern
470473
| RangeFromPattern
471474
| RangeToExclusivePattern
472475
| RangeToInclusivePattern
473-
| ObsoleteRangePattern[^obsolete-range-edition]
474476
475477
RangeExclusivePattern ->
476478
RangePatternBound `..` RangePatternBound
@@ -495,8 +497,6 @@ RangePatternBound ->
495497
| PathExpression
496498
```
497499

498-
[^obsolete-range-edition]: The [ObsoleteRangePattern] syntax has been removed in the 2021 edition.
499-
500500
r[patterns.range.intro]
501501
*Range patterns* match scalar values within the range defined by their bounds. They comprise a *sigil* (`..` or `..=`) and a bound on one or both sides.
502502

@@ -659,7 +659,7 @@ r[patterns.ref]
659659

660660
r[patterns.ref.syntax]
661661
```grammar,patterns
662-
ReferencePattern -> (`&`|`&&`) `mut`? PatternWithoutRange
662+
ReferencePattern -> (`&`|`&&`) `mut`? PatternWithoutModernRange
663663
```
664664

665665
r[patterns.ref.intro]

0 commit comments

Comments
 (0)