From 916d467950333cdb892f863a98a63021a93e83af Mon Sep 17 00:00:00 2001 From: Lukas Wirth Date: Thu, 16 Nov 2023 12:30:23 +0100 Subject: [PATCH] Fix struct pattern irrefutability to require the deconstructee to be a struct or union --- src/patterns.rst | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/patterns.rst b/src/patterns.rst index 9b034a45..586d4680 100644 --- a/src/patterns.rst +++ b/src/patterns.rst @@ -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: