Skip to content

Commit

Permalink
Merge #467
Browse files Browse the repository at this point in the history
467: Extract labelled blocks out of BlockExpression r=pietroalbini a=Veykril

Fixes #453

Co-authored-by: Lukas Wirth <[email protected]>
  • Loading branch information
bors-ferrocene[bot] and Veykril authored Nov 16, 2023
2 parents 496ef38 + 3c54b99 commit ff496a6
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 18 deletions.
44 changes: 36 additions & 8 deletions src/expressions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ Expressions
| LoopExpression
| MatchExpression
| UnsafeBlockExpression
| NamedBlockExpression
)

ExpressionWithoutBlock ::=
Expand Down Expand Up @@ -652,7 +653,7 @@ Block Expressions
.. syntax::

BlockExpression ::=
Label? $${$$
$${$$
InnerAttributeOrDoc*
StatementList
$$}$$
Expand All @@ -666,13 +667,6 @@ Block Expressions
A :t:`block expression` is an :t:`expression` that sequences :t:`[expression]s`
and :t:`[statement]s`.

:dp:`fls_gOxD5xdYLaQG`
A :t:`named block expression` is a :t:`block expression` with a :t:`label`.

:dp:`fls_osLgtbU8OfbD`
An :t:`anonymous block expression` is a :t:`block expression` without a
:t:`label`.

:dp:`fls_tn3hj7k2lliu`
A :t:`tail expression` is the last :t:`expression` within a :t:`block
expression`.
Expand Down Expand Up @@ -786,6 +780,40 @@ the :t:`[capture target]s` of the :t:`async block expression`.
42
}
.. _fls_0ybsR1hEo7wV:

Named Blocks
~~~~~~~~~~~~

.. rubric:: Syntax

.. syntax::

NamedBlockExpression ::=
Label BlockExpression

.. rubric:: Legality Rules

:dp:`fls_J8wJNfcSAYrS`
A :t:`named block expression` is a :t:`block expression` with a :t:`label`.

:dp:`fls_B4NBv2jfZLuy`
The :t:`type` of the :t:`named block expression` is the :t:`type` of its
:t:`block expression`.

:dp:`fls_YxvAUUYAPkaq`
The :t:`value` of the :t:`named block expression` is the :t:`value` of its
:t:`block expression`.

.. rubric:: Examples

.. code-block:: rust
'block: {
break 'block 1;
3
}
.. _fls_8wnyln2nmg4y:

Unsafe Blocks
Expand Down
10 changes: 0 additions & 10 deletions src/glossary.rst
Original file line number Diff line number Diff line change
Expand Up @@ -129,15 +129,6 @@ models existential quantifier ALL.
:dp:`fls_0fEw9Bx8xX8q`
See :s:`ConfigurationPredicateAll`.

.. _fls_eg1wsZzoiTzK:

anonymous block expression
^^^^^^^^^^^^^^^^^^^^^^^^^^

:dp:`fls_ZU8eI3kyzw3z`
An :dt:`anonymous block expression` is a :t:`block expression` without a
:t:`label`.

.. _fls_du8uevac5q7j:

anonymous loop expression
Expand Down Expand Up @@ -7652,4 +7643,3 @@ zero-variant enum type
:dp:`fls_84gqz3vwi5mj`
A :dt:`zero-variant enum type` is an :t:`enum type` without any
:t:`[enum variant]s`.

0 comments on commit ff496a6

Please sign in to comment.