From 01a7946a0b9711440dbc263f8164bdfe66249464 Mon Sep 17 00:00:00 2001 From: Lukas Wirth Date: Mon, 9 Sep 2024 10:48:43 +0200 Subject: [PATCH] Document Stabilize `exclusive_range_pattern` feature --- src/changelog.rst | 9 ++++++++- src/patterns.rst | 28 +++++++++++++++++++++++----- 2 files changed, 31 insertions(+), 6 deletions(-) diff --git a/src/changelog.rst b/src/changelog.rst index 4fc06999..6327b484 100644 --- a/src/changelog.rst +++ b/src/changelog.rst @@ -34,7 +34,14 @@ Language changes in Rust 1.80.0 * No change: this previous restriction is not specified in the FLS * `Stabilize `exclusive_range_pattern` feature `_ -* `Guarantee layout and ABI of `Result` in some scenarios `_ + + * Changed syntax: :s:`RangePattern` + + * New syntax: :s:`ExclusiveRangePattern` + + * Changed paragraph: :p:`fls_8Q6NfRx4j5V7` + + * New paragraphs: :p:`fls_3PyquOKjA7SI`, :p:`fls_8bdOqkO1NuJW`, :p:`fls_EDL1Pi56KQ2H` Language changes in Rust 1.79.0 ------------------------------- diff --git a/src/patterns.rst b/src/patterns.rst index c4317bf6..4c8fe97c 100644 --- a/src/patterns.rst +++ b/src/patterns.rst @@ -433,6 +433,7 @@ Range Patterns RangePattern ::= HalfOpenRangePattern | InclusiveRangePattern + | ExclusiveRangePattern | ObsoleteRangePattern HalfOpenRangePattern ::= @@ -441,6 +442,9 @@ Range Patterns InclusiveRangePattern ::= RangePatternLowBound $$..=$$ RangePatternHighBound + ExclusiveRangePattern ::= + RangePatternLowBound $$..$$ RangePatternHighBound + ObsoleteRangePattern ::= RangePatternLowBound $$...$$ RangePatternHighBound @@ -471,6 +475,10 @@ A :t:`half-open range pattern` is a :t:`range pattern` with only a An :t:`inclusive range pattern` is a :t:`range pattern` with both a :t:`range pattern low bound` and a :t:`range pattern high bound`. +:dp:`fls_3PyquOKjA7SI` +An :t:`exclusive range pattern` is a :t:`range pattern` with both a +:t:`range pattern low bound` and a :t:`range pattern high bound`. + :dp:`fls_akf9x5r6e0ta` An :t:`obsolete range pattern` is a :t:`range pattern` that uses obsolete syntax to express an :t:`inclusive range pattern`. @@ -494,6 +502,10 @@ when the context is a :t:`slice pattern`. The :t:`range pattern low bound` of an :t:`inclusive range pattern` shall be less than or equal to its :t:`range pattern high bound`. +:dp:`fls_8bdOqkO1NuJW` +The :t:`range pattern low bound` of an :t:`exclusive range pattern` shall be +less than to its :t:`range pattern high bound`. + :dp:`fls_s2b5n4snc4d7` An :t:`obsolete range pattern` is equivalent to an :t:`inclusive range pattern`. @@ -508,11 +520,11 @@ The :t:`[type]s` of the :t:`range pattern low bound` and the :dp:`fls_3js1645tgh31` The :t:`type` of a :t:`range pattern` is determined as follows: -* :dp:`fls_wfqrbwrogjnq` - If the :t:`range pattern` is expressed as an :t:`inclusive range pattern` or - an :t:`obsolete range pattern`, then the :t:`type` is the :t:`unified type` of - the :t:`[type]s` of the :t:`range pattern low bound` and the - :t:`range pattern high bound`. +* :dp:`fls_8Q6NfRx4j5V7` + If the :t:`range pattern` is expressed as an :t:`inclusive range pattern`, an + :t:`exclusive range pattern`, or an :t:`obsolete range pattern`, then the + :t:`type` is the :t:`unified type` of the :t:`[type]s` of the + :t:`range pattern low bound` and the :t:`range pattern high bound`. * :dp:`fls_rgr7t33s0m7m` Otherwise the :t:`type` is the :t:`type` of the :t:`range pattern low bound`. @@ -1423,6 +1435,12 @@ Range Pattern Matching the inclusive range from the :t:`range pattern low bound` to the :t:`range pattern high bound`, then matching succeeds. +#. :dp:`fls_EDL1Pi56KQ2H` + If the :t:`range pattern` is expressed as an :t:`exclusive range pattern` + and the context :t:`value` is in the exclusive range from the + :t:`range pattern low bound` to the :t:`range pattern high bound`, then + matching succeeds. + #. :dp:`fls_n4t3xah1pk7i` Otherwise matching fails.