Skip to content

Commit

Permalink
Specify #127672 changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Veykril committed Dec 3, 2024
1 parent 41de15c commit 0e784c5
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 3 deletions.
6 changes: 6 additions & 0 deletions src/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,12 @@ Language changes in Rust 1.82.0

* `Stabilize opaque type precise capturing (RFC 3617) <https://github.com/rust-lang/rust/pull/127672>`_

* Changed syntax: :s:`ImplTraitTypeSpecification`, :s:`ImplTraitTypeSpecificationOneBound`

* New syntax: :s:`UseCaptures`, :s:`UseCapturesGenericArgs`, , :s:`UseCapturesGenericArg`

* New paragraphs: :p:`fls_69hqMjvNno9u`, :p:`fls_OnyR0Wsfk7KI`, :p:`fls_KgH6c5cC4S0G`, :p:`fls_iT9WCNfUZQnC`

* `Stabilize \`&raw const\` and \`&raw mut\` operators (RFC 2582) <https://github.com/rust-lang/rust/pull/127679>`_

* New section: :ref:`fls_vXGuvRWOLbEE`
Expand Down
11 changes: 11 additions & 0 deletions src/glossary.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7555,6 +7555,17 @@ unsuffixed integer
An :dt:`unsuffixed integer` is an :t:`integer literal` without an
:t:`integer suffix`.

.. _fls_Z8qvOkP4Zfj5:

use capture
^^^^^^^^^^^

:dp:`fls_eZyPXG27Zwcg`
An :dt:`use capture` is a :t:`generic parameter` referenced via keyword $$use$$ within an :t:`anonymous return type`.

:dp:`fls_Z8qvOkP4Zfj5`
See :s:`UseCaptures`.

.. _fls_fow1bnvduafi:

use import
Expand Down
28 changes: 25 additions & 3 deletions src/types-and-traits.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1113,10 +1113,20 @@ Impl Trait Types
.. syntax::

ImplTraitTypeSpecification ::=
$$impl$$ TypeBoundList
$$impl$$ UseCaptures? TypeBoundList

ImplTraitTypeSpecificationOneBound ::=
$$impl$$ TraitBound
$$impl$$ UseCaptures? TraitBound

UseCaptures ::=
$$<$$ UseCapturesGenericArgs? $$>$$

UseCapturesGenericArgs ::=
UseCapturesGenericArg ($$,$$ UseCapturesGenericArg)* $$,$$?

UseCapturesGenericArg ::=
Lifetime
| Identifier
.. rubric:: Legality Rules

Expand Down Expand Up @@ -1146,6 +1156,18 @@ of the :t:`return type`'s :t:`function` and its parent :t:`trait` or
:dp:`fls_ECjhEI7eCwAj`
An :t:`impl trait type` shall not contain :t:`[opt-out trait bound]s`.

:dp:`fls_69hqMjvNno9u`
An :t:`use capture` is a :t:`generic parameter` referenced via keyword ``use`` within an :t:`anonymous return type`.

:dp:`fls_OnyR0Wsfk7KI`
:t:`[use capture]s` shall only be used within :t:`[anonymous return type]s`.

:dp:`fls_KgH6c5cC4S0G`
An :t:`anonymous return type` that does not specify a list of :t:`[use capture]s` implicitly :t:`[use capture]s` all :t:`[type parameter]s` and :t:`[constant parameter]s` that are in :t:`scope`.

:dp:`fls_iT9WCNfUZQnC`
An :t:`anonymous return type` behaves as if it contained all its :t:`[use capture]s`.

.. rubric:: Examples

.. code-block:: rust
Expand Down Expand Up @@ -2309,7 +2331,7 @@ any resulting :t:`type` information via :t:`type unification`.
:dp:`fls_v5dWGuBKvQSJ`
When an :t:`associated type` ``<Type as Trait>::Assoc`` is referenced within a
:t:`type inference root` (either explicitly within the source code, or via the
inferece rules below), an :t:`obligation` requiring that ``Type`` implements
inference rules below), an :t:`obligation` requiring that ``Type`` implements
``Trait`` is introduced.

:dp:`fls_SZgixDCAx6PQ`
Expand Down

0 comments on commit 0e784c5

Please sign in to comment.