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

Extract labelled blocks out of BlockExpression #467

Merged
merged 1 commit into from
Nov 16, 2023
Merged
Show file tree
Hide file tree
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
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`.