From a81f18fa527e2e48dc1646c4fa14b0287d37eac8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Le=C3=B3n=20Orell=20Valerian=20Liehr?= Date: Tue, 5 May 2026 13:23:14 +0200 Subject: [PATCH] Fix grammar rules pertaining to obsolete range patterns --- src/patterns.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/patterns.md b/src/patterns.md index 845f22c3db..e7a8e9c4b8 100644 --- a/src/patterns.md +++ b/src/patterns.md @@ -6,10 +6,10 @@ r[patterns.syntax] Pattern -> `|`? PatternNoTopAlt ( `|` PatternNoTopAlt )* PatternNoTopAlt -> - PatternWithoutRange - | RangePattern + PatternWithoutModernRange + | ModernRangePattern -PatternWithoutRange -> +PatternWithoutModernRange -> LiteralPattern | IdentifierPattern | WildcardPattern @@ -22,8 +22,11 @@ PatternWithoutRange -> | SlicePattern | PathPattern | MacroInvocation + | ObsoleteRangePattern[^obsolete-range-edition] ``` +[^obsolete-range-edition]: The [ObsoleteRangePattern] syntax is semantically invalid in the 2021 edition and beyond. + r[patterns.intro] 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. @@ -464,13 +467,12 @@ r[patterns.range] r[patterns.range.syntax] ```grammar,patterns -RangePattern -> +ModernRangePattern -> RangeExclusivePattern | RangeInclusivePattern | RangeFromPattern | RangeToExclusivePattern | RangeToInclusivePattern - | ObsoleteRangePattern[^obsolete-range-edition] RangeExclusivePattern -> RangePatternBound `..` RangePatternBound @@ -495,8 +497,6 @@ RangePatternBound -> | PathExpression ``` -[^obsolete-range-edition]: The [ObsoleteRangePattern] syntax has been removed in the 2021 edition. - r[patterns.range.intro] *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. @@ -659,7 +659,7 @@ r[patterns.ref] r[patterns.ref.syntax] ```grammar,patterns -ReferencePattern -> (`&`|`&&`) `mut`? PatternWithoutRange +ReferencePattern -> (`&`|`&&`) `mut`? PatternWithoutModernRange ``` r[patterns.ref.intro]