You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/ownership-and-deconstruction.rst
+19-30Lines changed: 19 additions & 30 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -754,37 +754,26 @@ proceeds as follows:
754
754
let c = PrintOnDrop("2");
755
755
756
756
:dp:`fls_THzA0QFdMMJB`
757
-
When an :t:`or pattern` is used, the drop order of :t:`[Binding]s` is
758
-
determined by the first :t:`pattern-without-alternation`, regardless of which
759
-
alternative matches at runtime.
757
+
When an :t:`or pattern` is used, the drop order of :t:`[binding]s` is determined by the first :t:`pattern-without-alternation`, regardless of which matches at runtime.
758
+
759
+
:dp:`fls_dhfIPP4yR3Tt`
760
+
In the following example, the drop order is ``b``, ``a`` for both calls.
761
+
Dropping proceeds as follows:
762
+
763
+
#. :dp:`fls_zxFM7EoE2Xq8`
764
+
The first :t:`pattern-without-alternation` ``Ok([a, b])`` declares ``a`` before ``b``.
765
+
766
+
#. :dp:`fls_zxFM7EoE2Xq8`
767
+
When the first call matches ``Ok([a, b])``, the :t:`[binding]s` are dropped in reverse declaration order: ``b`` then ``a``.
768
+
769
+
#. :dp:`fls_gNWXh61ZXXt8`
770
+
When the second call matches ``Err([b, a])``, the drop order remains ``b`` then ``a``, determined by the first :t:`pattern-without-alternation`.
0 commit comments