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]