Skip to content

Commit

Permalink
Document Stabilize exclusive_range_pattern feature
Browse files Browse the repository at this point in the history
  • Loading branch information
Veykril committed Sep 9, 2024
1 parent 412c1b2 commit 01a7946
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 6 deletions.
9 changes: 8 additions & 1 deletion src/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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 <https://github.com/rust-lang/rust/pull/124459/>`_
* `Guarantee layout and ABI of `Result` in some scenarios <https://github.com/rust-lang/rust/pull/124870>`_

* 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
-------------------------------
Expand Down
28 changes: 23 additions & 5 deletions src/patterns.rst
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,7 @@ Range Patterns
RangePattern ::=
HalfOpenRangePattern
| InclusiveRangePattern
| ExclusiveRangePattern
| ObsoleteRangePattern
HalfOpenRangePattern ::=
Expand All @@ -441,6 +442,9 @@ Range Patterns
InclusiveRangePattern ::=
RangePatternLowBound $$..=$$ RangePatternHighBound

ExclusiveRangePattern ::=
RangePatternLowBound $$..$$ RangePatternHighBound

ObsoleteRangePattern ::=
RangePatternLowBound $$...$$ RangePatternHighBound

Expand Down Expand Up @@ -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`.
Expand All @@ -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`.

Expand All @@ -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`.
Expand Down Expand Up @@ -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.

Expand Down

0 comments on commit 01a7946

Please sign in to comment.