Skip to content

Commit

Permalink
Merge #430
Browse files Browse the repository at this point in the history
430: Fix dangling links in ownership-and-destruction chapter r=tshepang a=Veykril



Co-authored-by: Lukas Wirth <[email protected]>
  • Loading branch information
bors-ferrocene[bot] and Veykril authored Aug 4, 2023
2 parents bd2964d + 2cbf960 commit 96c347c
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 15 deletions.
10 changes: 10 additions & 0 deletions src/glossary.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3770,6 +3770,16 @@ A :dt:`lifetime parameter` is a :t:`generic parameter` for a :t:`lifetime`.
:dp:`fls_z1wl2uiwip98`
See :s:`LifetimeParameter`.

.. _fls_joDjnHu1L9Lp:

lifetime variable
^^^^^^^^^^^^^^^^^

:dp:`fls_ucZnCBWxXl6n`
A :dt:`lifetime variable` is a placeholder used during :t:`type inference` to
stand in for an undetermined :t:`lifetime` of a :t:`type`.


.. _fls_8qputmx0i7ku:

line
Expand Down
30 changes: 15 additions & 15 deletions src/ownership-and-deconstruction.rst
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ Immutably :t:`borrowing` a :t:`value` proceeds as follows:

#. :dp:`fls_8q5ly4x104ai`
An :t:`immutable borrow` of :t:`type` ``&'a T`` is created, where
:t:`lifetime` ``'a`` is replaced by a :t:`lifetime inference variable`, and
:t:`lifetime` ``'a`` is replaced by a :t:`lifetime variable`, and
``T`` is replaced by the borrowed :t:`type`.

#. :dp:`fls_yhchu2bpil4m`
Expand All @@ -220,18 +220,19 @@ Immutably :t:`borrowing` a :t:`value` proceeds as follows:
The :t:`immutable borrow` is checked against other :t:`[borrow]s` and
:t:`by move` passing within the enclosing :t:`item`.

:dp:`fls_g4aefz28pl04`
Uniquely immutably :t:`borrowing` a :t:`value` proceeds as follows:
#. :dp:`fls_Z2n7EJiLY5CT`
An :t:`immutable reference` to the borrowed :t:`value` is produced.

#. :dp:`fls_dpe3ubsd67ra`
**???**
#. :dp:`fls_ibi9mqGeHNLp`
The :t:`immutable borrow` is released immediately after the last usage of its
related :t:`immutable reference`.

:dp:`fls_f9we73i8vwq3`
Mutably :t:`borrowing` a :t:`value` proceeds as follows:

#. :dp:`fls_w5bjgaov8w60`
A :t:`mutable borrow` of :t:`type` ``&'a mut T`` is created, where
:t:`lifetime` ``'a`` is replaced by a :t:`lifetime inference variable`, and
:t:`lifetime` ``'a`` is replaced by a :t:`lifetime variable`, and
``T`` is replaced by the borrowed :t:`type`.

#. :dp:`fls_gbqizu6gu6kk`
Expand All @@ -241,21 +242,20 @@ Mutably :t:`borrowing` a :t:`value` proceeds as follows:
The :t:`mutable borrow` is checked against other :t:`[borrow]s` and
:t:`by move` passing within the enclosing :t:`item`.

#. :dp:`fls_7Kzu0qXiBUCb`
A :t:`mutable reference` to the borrowed :t:`value` is produced.

#. :dp:`fls_VDHBP4oAoqT5`
The :t:`mutable borrow` is released immediately after the last usage of its
related :t:`mutable reference`.

.. rubric:: Examples

.. code-block:: rust
let mutable_borrow = &mut 42;
let immutable_borrow = &42;
:dp:`fls_lfgophgm7jd8`
Variable ``x`` is captured using a unique immutable borrow.

.. code-block:: rust
let x = &mut 42;
let unique_immutable_borrow = || *x = 1;
.. _fls_77scxuomlbgs:

Passing Conventions
Expand All @@ -265,7 +265,7 @@ Passing Conventions

:dp:`fls_fvwx2ufeyzcs`
A :t:`passing convention` is the mechanism that defines how a :t:`value` is
transferred between :t:`[place]s`. **place is not the appropriate term here**
transferred between :t:`[place]s`.

:dp:`fls_h2pgsij1rbms`
A :t:`copy type` is a :t:`type` that implements the :std:`core::marker::Copy`
Expand Down
4 changes: 4 additions & 0 deletions src/types-and-traits.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2192,6 +2192,10 @@ to :t:`[floating-point type]s`.
A :t:`diverging type variable` is a :t:`type variable` that can refer to any
:t:`type` and originates from a :t:`diverging expression`.

:dp:`fls_JryXiKBIFvF3`
A :dt:`lifetime variable` is a placeholder used during :t:`type inference` to
stand in for an undetermined :t:`lifetime` of a :t:`type`.

:dp:`fls_rvj3XspFZ1u3`
The :t:`type inference` algorithm uses :t:`type unification` to propagate known
:t:`[type]s` of :t:`[expression]s` and :t:`[pattern]s` across the
Expand Down

0 comments on commit 96c347c

Please sign in to comment.