Skip to content

Commit 3055f43

Browse files
committed
1 parent 22cee9e commit 3055f43

File tree

4 files changed

+81
-9
lines changed

4 files changed

+81
-9
lines changed

src/changelog.rst

+4
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ Language changes in Rust 1.82.0
2828

2929
* `Patterns matching empty types can now be omitted in common cases <https://github.com/rust-lang/rust/pull/122792>`_
3030

31+
* New section: :ref:`fls_mcxF9y5u66sZ`
32+
33+
* Changed paragraphs: :p:`fls_9fjspnefoyvz`, :p:`fls_uq7ftuuq1sig`, :p:`fls_cfoy86mkmqa4`, :p:`fls_rnppz6y5z8pi`, :p:`fls_x0bmzl1315gq`, :p:`fls_MK83WE0iDqNf`
34+
3135
* `Enforce supertrait outlives obligations when using trait impls <https://github.com/rust-lang/rust/pull/124336>`_
3236

3337
* No change: the concrete type inference resolution is not part of the FLS

src/glossary.rst

+24
Original file line numberDiff line numberDiff line change
@@ -7685,6 +7685,30 @@ visibility modifier
76857685
A :dt:`visibility modifier` sets the :t:`visibility` of the :t:`name` of an
76867686
:t:`item`.
76877687

7688+
.. _fls_dLlUt8PrXAls:
7689+
7690+
visible emptiness
7691+
^^^^^^^^^^^^^^^^^
7692+
7693+
:dp:`fls_shXDYqnUy2Pb`
7694+
:dt:`Visible emptiness <visible emptiness>` is a property of :t:`[type]s` and :t:`[enum variant]s` that have no :t:`[value]s` that are fully observable.
7695+
7696+
.. _fls_EnT5zRuwviWM:
7697+
7698+
visible empty enum variant
7699+
^^^^^^^^^^^^^^^^^^^^^^^^^^
7700+
7701+
:dp:`fls_MQiPWNwdk95I`
7702+
A :dt:`visible empty enum variant` is an :t:`enum variant` subject to :t:`visible emptiness`.
7703+
7704+
.. _fls_HYWQ0lJS3TET:
7705+
7706+
visible empty type
7707+
^^^^^^^^^^^^^^^^^^
7708+
7709+
:dp:`fls_OLVD0u9w68Gl`
7710+
A :dt:`visible empty type` is a :t:`type` subject to :t:`visible emptiness`.
7711+
76887712
.. _fls_iplp3gvfbcpw:
76897713

76907714
weak keyword

src/patterns.rst

+6-9
Original file line numberDiff line numberDiff line change
@@ -90,12 +90,11 @@ Refutability
9090
match all possible values of a :t:`type`.
9191

9292
:dp:`fls_9fjspnefoyvz`
93-
An :t:`irrefutable pattern` is a :t:`pattern` that always matches the :t:`value`
94-
it is being matched against.
93+
An :t:`irrefutable pattern` is a :t:`pattern` that always matches any :t:`value` of its :t:`type`.
9594

9695
:dp:`fls_uq7ftuuq1sig`
9796
A :t:`refutable pattern` is a :t:`pattern` that has a possibility of not
98-
matching the :t:`value` it is being matched against.
97+
matching a :t:`value` of a its :t:`type`
9998

10099
:dp:`fls_mnbyt7jfYAZ9`
101100
A :t:`pattern` that is not an :t:`irrefutable pattern` is a
@@ -385,12 +384,10 @@ to an :t:`associated constant`.
385384
A :t:`path pattern` is an :t:`irrefutable pattern` when it refers to:
386385

387386
* :dp:`fls_cfoy86mkmqa4`
388-
A :t:`constant` whose :t:`type` is an :t:`irrefutable pattern`, or
387+
An :t:`irrefutable constant`,
389388

390389
* :dp:`fls_rnppz6y5z8pi`
391-
An :t:`enum variant` of an :t:`enum type` with a single :t:`enum variant`
392-
where the :t:`[type]s` of all :t:`[field]s` are :t:`[irrefutable pattern]s`,
393-
or
390+
An :t:`enum variant` of an :t:`enum type` with zero or more :t:`[visibly empty enum variant]s` and one non-:t:`visibly empty enum variant` where the :t:`[type]s` of all :t:`[field]s` are not subject to :t:`visible emptiness`, or
394391

395392
* :dp:`fls_ag6m4mvpturw`
396393
A :t:`struct` where the :t:`[type]s` of all :t:`[field]s` are
@@ -570,7 +567,7 @@ A :t:`reference pattern` is a :t:`pattern` that dereferences a :t:`pointer` that
570567
is being matched.
571568

572569
:dp:`fls_x0bmzl1315gq`
573-
A :t:`reference pattern` is an :t:`irrefutable pattern`.
570+
A :t:`reference pattern` is an :t:`irrefutable pattern` when its nested :t:`pattern` itself is an :t:`irrefutable pattern`.
574571

575572
:dp:`fls_fedo8zhgpla5`
576573
The :t:`type` of a :t:`reference pattern` is determined as follows:
@@ -756,7 +753,7 @@ A :t:`struct pattern` is an :t:`irrefutable pattern` if
756753
A :t:`struct type` or a :t:`union type`, or
757754

758755
* :dp:`fls_MK83WE0iDqNf`
759-
An :t:`enum variant` of an :t:`enum` with a single :t:`enum variant`.
756+
An :t:`enum variant` of an :t:`enum type` with zero or more :t:`[visibly empty enum variant]s` and one non-:t:`visibly empty enum variant` where the :t:`[type]s` of all :t:`[field]s` are not subject to :t:`visible emptiness`.
760757

761758
.. _fls_nruvg0es3kx7:
762759

src/types-and-traits.rst

+47
Original file line numberDiff line numberDiff line change
@@ -2204,6 +2204,53 @@ be modified through :t:`[immutable reference]s`.
22042204
A :t:`type` is subject to :t:`interior mutability` when it contains a
22052205
:std:`core::cell::UnsafeCell`.
22062206

2207+
.. _fls_mcxF9y5u66sZ:
2208+
2209+
Visible Emptiness
2210+
~~~~~~~~~~~~~~~~~
2211+
2212+
.. rubric:: Legality Rules
2213+
2214+
:dp:`fls_SD4yUEQ9hHa3`
2215+
:t:`Visible emptiness <visible emptiness>` is a property of :t:`[type]s` and :t:`[enum variant]s` that have no :t:`[value]s` that are fully observable.
2216+
2217+
:dp:`fls_GeoneCP5TYwf`
2218+
A :t:`visible empty type` is a :t:`type` subject to :t:`visible emptiness`.
2219+
2220+
:dp:`fls_A2W4v53ihTGx`
2221+
A :t:`visible empty enum variant` is an :t:`enum variant` subject to :t:`visible emptiness`.
2222+
2223+
:dp:`fls_AXOtKdSQR4AF`
2224+
A :t:`type` is subject to :t:`visible emptiness` as follows:
2225+
2226+
* :dp:`fls_ZfnYORORz40y`
2227+
The :t:`type` is the :t:`never type`.
2228+
2229+
* :dp:`fls_TE2GBnZX2YFW`
2230+
The :t:`type` is a :t:`zero-variant enum type`.
2231+
2232+
* :dp:`fls_GNFzLMH8RBUC`
2233+
The :t:`type` is an :t:`enum type` not subject to :t:`attribute` :c:`non_exhaustive` with all :t:`[enum variant]s` are subject to :t:`visible emptiness`.
2234+
2235+
* :dp:`fls_fSNrRsgzLd0E`
2236+
The :t:`type` is a :t:`struct type` not subject to :t:`attribute` :c:`non_exhaustive` with at least one :t:`visible <visibility>` :t:`field` whose :t:`type` is subject to :t:`visible emptiness`.
2237+
2238+
* :dp:`fls_R65LmGTvSlIm`
2239+
The :t:`type` is a :t:`tuple type` with at least one of the contained :t:`[type]s` is subject to :t:`visible emptiness`.
2240+
2241+
* :dp:`fls_yiPv3wKYkSRl`
2242+
The :t:`type` is an :t:`array type` with a non-zero :t:`size operand` and an :t:`element type` that is subject to :t:`visible emptiness`.
2243+
2244+
2245+
:dp:`fls_S9QL6yVF5LFI`
2246+
A :t:`enum variant` is subject to :t:`visible emptiness` as follows:
2247+
2248+
* :dp:`fls_xegU2TFXypcu`
2249+
The respective :t:`enum type` is not subject to :t:`attribute` :c:`non_exhaustive`.
2250+
2251+
* :dp:`fls_2CWUWbYT9KcT`
2252+
The :t:`type` of at least one of the :t:`enum variant`'s visible <visibility> :t:`[field]s` is subject to :t:`visible emptiness`.
2253+
22072254
.. _fls_lv7w7aalpwm5:
22082255

22092256
Type Inference

0 commit comments

Comments
 (0)