Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix struct pattern irrefutability to require the deconstructee to be a struct or union or single variant enum #469

Merged
merged 1 commit into from
Nov 16, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions src/patterns.rst
Original file line number Diff line number Diff line change
Expand Up @@ -725,8 +725,19 @@ A :t:`struct pattern` is interpreted based on the :t:`deconstructee`. It is a
static error if a :t:`struct pattern` cannot be interpreted.

:dp:`fls_r8rat3qmc4hy`
A :t:`struct pattern` is an :t:`irrefutable pattern` when all of its
:t:`[subpattern]s` are :t:`[irrefutable pattern]s`.
A :t:`struct pattern` is an :t:`irrefutable pattern` if

* :dp:`fls_hUX723DmLg2a`
All of its :t:`[subpattern]s` are :t:`[irrefutable pattern]s`, and

* :dp:`fls_p4OplpUvS04l`
The :t:`deconstructree` is either:

* :dp:`fls_pre3YwAv01FE`
A :t:`struct type` or a :t:`union type`, or

* :dp:`fls_MK83WE0iDqNf`
An :t:`enum variant` of an :t:`enum` with a single :t:`enum variant`.

.. _fls_nruvg0es3kx7:

Expand Down