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

Update to 1.82 #529

Closed
wants to merge 16 commits into from
43 changes: 43 additions & 0 deletions src/attributes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ Built-in Attributes
| TestContent
| TrackCallerContent
| TypeLengthLimitContent
| UnsafeContent
| UsedContent
| WindowsSubsystemContent

Expand Down Expand Up @@ -226,6 +227,9 @@ The following :t:`[built-in attribute]s` are :dt:`[diagnostics attribute]s`:
* :dp:`fls_NrTL2FruARAv`
:t:`Attribute` ``expect``.

* :dp:`fls_4d2ArC50kNWL`
:t:`Attribute` ``unsafe``.

:dp:`fls_3fxhz0olhbcy`
The following :t:`[built-in attribute]s` are :dt:`[documentation attribute]s`:

Expand Down Expand Up @@ -1358,6 +1362,45 @@ related :t:`type`.
second_field: i8
}

.. _fls_19LnTi3WabFd:

Attribute ``unsafe``
^^^^^^^^^^^^^^^^^^^^

.. rubric:: Syntax

.. syntax::

UnsafeContent ::=
$$unsafe$$ $$($$ BuiltinAttributeContent $$)$$

.. rubric:: Legality Rules

:dp:`fls_5pjo3nGOxbVw`
:t:`Attribute` :c:`unsafe` shall apply to what the contained :t:`attribute` applies to.

:dp:`fls_gpxlWbQUNsj8`
:t:`Attribute` :c:`unsafe` behaves like the contained :t:`attribute`.

:dp:`fls_PhrfxSBvXTPV`
The contained :t:`attribute` shall be one of:

* :dp:`fls_pCSew95bKJJ5`
:t:`attribute` :c:`no_mangle`,

:dp:`fls_NRLgmOXxuljQ`
:t:`attribute` :c:`export_name`, or

:dp:`fls_ykpxNByUDyHG`
:t:`attribute` :c:`link_section`,

.. rubric:: Examples

.. code-block:: rust

#[unsafe(no_mangle)]
pub fn clear_name() {}

.. _fls_7skf24auayqy:

Attribute ``used``
Expand Down
86 changes: 86 additions & 0 deletions src/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,92 @@ with the change that has been applied due to it.
just the language changes that had an impact to the FLS. See the `release
notes`_ for a full list of changes.


Language changes in Rust 1.82.0
-------------------------------

* `Don't make statement nonterminals match pattern nonterminals <https://github.com/rust-lang/rust/pull/120221/>`_

* No change: Exact parsing behavior of non-terminals within declarative macros is not specified

* `Patterns matching empty types can now be omitted in common cases <https://github.com/rust-lang/rust/pull/122792>`_

* New section: :ref:`fls_mcxF9y5u66sZ`

* Changed paragraphs: :p:`fls_9fjspnefoyvz`, :p:`fls_uq7ftuuq1sig`, :p:`fls_cfoy86mkmqa4`, :p:`fls_rnppz6y5z8pi`, :p:`fls_x0bmzl1315gq`, :p:`fls_MK83WE0iDqNf`

* `Enforce supertrait outlives obligations when using trait impls <https://github.com/rust-lang/rust/pull/124336>`_

* No change: the concrete type inference resolution is not part of the FLS

* `\`addr_of(_mut)!\` macros and the newly stabilized \`&raw (const|mut)\` are now safe to use with all static items <https://github.com/rust-lang/rust/pull/125834>`_

* No change: `addr_of` is not specified as it is a library defined macro, `&raw (const|mut)` appears as a new feature separately below

* `size_of_val_raw: for length 0 this is safe to call <https://github.com/rust-lang/rust/pull/126152/>`_

* No change: `size_of_val_raw` is a library defined function

* `Reorder trait bound modifiers *after* \`for<...>\` binder in trait bounds <https://github.com/rust-lang/rust/pull/127054/>`_

* Changed syntax: :s:`TraitBound`

* `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`

* New paragraphs: :p:`fls_K7SbApHPmwjM`

* `Stabilize unsafe extern blocks (RFC 3484) <https://github.com/rust-lang/rust/pull/127921>`_

* New syntax: :s:`ItemSafety`

* Changed syntax: :s:`WeakKeyword`, :s:`FunctionQualifierList`, :s:`StaticDeclaration`

* New paragraphs: :p:`fls_8ltVLtAfvy0m`, :p:`fls_WRpcVF1fLEpr`, :p:`fls_8ltVLtAfvy0m`

* Changed paragraphs: :p:`fls_g0JEluWqBpNc`, :p:`fls_7ucwmzqtittv`, :p:`fls_4dje9t5y2dia`, :p:`fls_l88r9fj82650`, :p:`fls_fo9with6xumo`

* Removed paragraph :p:`fls_iaimuqcclstl`

* `Stabilize nested field access in \`offset_of!\` <https://github.com/rust-lang/rust/pull/128284>`_

* No change: `offset_of` is a library defined macro

* `Do not require \`T\` to be live when dropping \`[T; 0]\` <https://github.com/rust-lang/rust/pull/128438>`_

* No change: The drop interaction with the borrow checker is not specified as the borrow checker is not specified in the FLS

* `Stabilize \`const\` operands in inline assembly <https://github.com/rust-lang/rust/pull/128570>`_

* Note: These changes affect content that is informational.

* New syntax: :s:`ConstRegisterExpression`

* New paragraphs: :p:`fls_81Ju1TEqJ48K`, :p:`fls_j9XOoXDmN5Dq`, :p:`fls_jU8zg4k8dFsY`

* `Stabilize floating-point arithmetic in \`const fn\` <https://github.com/rust-lang/rust/pull/128596>`_

* New paragraph: :p:`fls_lSxXWxJn0vMO`

* Removed paragraph: :p:`fls_9mrrosm8jnn7`

* `Stabilize explicit opt-in to unsafe attributes <https://github.com/rust-lang/rust/pull/128771>`_

* New section: :ref:`fls_19LnTi3WabFd`

* `Document NaN bit patterns guarantees <https://github.com/rust-lang/rust/pull/129559>`_

* New paragraph: :p:`fls_nuFAwLHOdQBx`

Language changes in Rust 1.81.0
-------------------------------

Expand Down
77 changes: 70 additions & 7 deletions src/expressions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -280,11 +280,6 @@ explicitly invokes an :t:`associated trait function` or uses
:t:`[arithmetic operator]s` of non-builtin :t:`[type]s` that invoke
:std:`core::ops` :t:`[trait]s`.

:dp:`fls_9mrrosm8jnn7`
An :t:`arithmetic expression` that operates with :t:`[floating-point value]s` is
not considered a :t:`constant expression` when it appears inside the
:t:`function body` of a :t:`constant function`.

:dp:`fls_fmqar6o1bwqk`
It is a static error if the :t:`size operand` of an
:t:`array repetition constructor` or an :t:`array type` depends on
Expand Down Expand Up @@ -482,6 +477,9 @@ The following :t:`[construct]s` are :t:`[place expression context]s`:
* :dp:`fls_Ufz9W5vyZkv3`
The :t:`operand` of a :t:`borrow expression`,

* :dp:`fls_K7SbApHPmwjM`
The :t:`operand` of a :t:`raw borrow expression`,

* :dp:`fls_KxWIzoh9WwK7`
The :t:`operand` of a :t:`dereference expression`,

Expand Down Expand Up @@ -927,13 +925,19 @@ Operator Expressions
| ErrorPropagationExpression
| LazyBooleanExpression
| NegationExpression
| RawBorrowExpression
| TypeCastExpression

.. rubric:: Legality Rules

:dp:`fls_ursc5ynymoy`
An :t:`operator expression` is an :t:`expression` that involves an operator.

.. rubric:: Dynamic Semantics

:dp:`fls_lSxXWxJn0vMO`
An :t:`operator expression` that operates with :t:`[floating-point value]s` run as a :t:`constant expression` is allowed to yield different :t:`[value]s` compared to when run as a non-:t:`constant expression`.

.. _fls_qztk0bkju9u:

Borrow Expression
Expand Down Expand Up @@ -971,11 +975,11 @@ state, or simply :t:`borrowed`.
The :t:`type` of a :t:`borrow expression` is determined as follows:

* :dp:`fls_5b2x5ri2w54r`
If the :t:`borrow expression` denotes a :t:`shared reference`, then the
If the :t:`borrow expression` denotes an :t:`immutable borrow expression`, then the
:t:`type` is ``&T``, where ``T`` is the :t:`type` of the :t:`operand`.

* :dp:`fls_agl09ia869rk`
If the :t:`borrow expression` denotes a :t:`mutable reference`, then the
If the :t:`borrow expression` denotes a :t:`mutable borrow expression`, then the
:t:`type` is ``&mut T``, where ``T`` is the :t:`type` of the :t:`operand`.

:dp:`fls_8cvmee9bzs40`
Expand Down Expand Up @@ -2057,6 +2061,65 @@ The :t:`evaluation` of a :t:`lazy or expression` proceeds as follows:
false && panic!()
this || that

.. _fls_vXGuvRWOLbEE:

Raw Borrow Expression
~~~~~~~~~~~~~~~~~~~~~

.. rubric:: Syntax

.. syntax::

RawBorrowExpression ::=
$$&$$ $$raw$$ ($$const$$ | $$mut$$) Operand

.. rubric:: Legality Rules

:dp:`fls_TS6DvMon5h27`
A :t:`raw borrow expression` is an :t:`expression` that creates a :t:`raw pointer` to the memory location of its :t:`operand` without incurring a :t:`borrow`.

:dp:`fls_UtjWrE2qeplQ`
An :dt:`immutable raw borrow expression` is a :t:`raw borrow expression` that has :t:`keyword` ``const``.

:dp:`fls_4e7EE4a8Yvmy`
A :dt:`mutable raw borrow expression` is a :t:`raw borrow expression` that has :t:`keyword` ``mut``.

:dp:`fls_gOXUWePymgGV`
When the :t:`operand` of a :t:`raw borrow expression` is a :t:`place expression`, the :t:`raw borrow expression` produces a :t:`raw pointer` to the memory location indicated by the :t:`operand`.

:dp:`fls_YBC8GrIBzZbi`
It is a static error if the :t:`operand` of a :t:`raw borrow expression` is a :t:`temporary`.

:dp:`fls_Twkre8IzUa8S`
The :t:`type` of a :t:`raw borrow expression` is determined as follows:

* :dp:`fls_Ki4FOzJMqtvJ`
If the :t:`raw borrow expression` denotes an :t:`immutable raw borrow expression`, then the :t:`type` is ``*const T``, where ``T`` is the :t:`type` of the :t:`operand`.

* :dp:`fls_DJxQDBsO9hc7`
If the :t:`raw borrow expression` denotes a :t:`mutable raw borrow expression`, then the :t:`type` is ``*mut T``, where ``T`` is the :t:`type` of the :t:`operand`.

:dp:`fls_WlXB0AHifCdd`
The :t:`value` of a :t:`raw borrow expression` is the address of its :t:`operand`.

.. rubric:: Dynamic Semantics

:dp:`fls_qQrV8QuGGcVO`
The :t:`evaluation` of a :t:`raw borrow expression` evaluates its :t:`operand`.

.. rubric:: Examples

.. code-block:: rust

let mut answer = 42;

:dp:`fls_dTABiwAPGhdZ`
Mutable raw borrow.

.. syntax::

let ref_answer = &raw mut answer;

.. _fls_1qhsun1vyarz:

Type Cast Expressions
Expand Down
13 changes: 6 additions & 7 deletions src/ffi.rst
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,10 @@ External Blocks

:dp:`fls_4dje9t5y2dia`
An :t:`external block` is a :t:`construct` that provides the declarations of
foreign :t:`[function]s` as unchecked imports.
:t:`[external function]s` and :t:`[external static]s` as unchecked imports.

:dp:`fls_8ltVLtAfvy0m`
An :t:`unsafe external block` is an :t:`external block` subject to keyword ``unsafe``.

:dp:`fls_Nz0l16hMxqTd`
The :t:`ABI` of an :t:`external block` is determined as follows:
Expand All @@ -171,10 +174,6 @@ The :t:`ABI` of an :t:`external block` is determined as follows:
* :dp:`fls_PBsepNHImJKH`
Otherwise the :t:`ABI` is the :t:`extern C ABI`.

:dp:`fls_iaimuqcclstl`
The ``unsafe`` :t:`keyword` of an :t:`external block` is rejected, but may
still be consumed by :t:`[macro]s`.

.. rubric:: Examples

.. code-block:: rust
Expand All @@ -201,7 +200,7 @@ External Functions
An :t:`external function` is an unchecked import of a foreign :t:`function`.

:dp:`fls_l88r9fj82650`
An :t:`external function` shall be invoked from an :t:`unsafe context`.
An :t:`external function` shall be invoked from an :t:`unsafe context` unless it is defined in an :t:`unsafe external block` and subject to :s:`ItemSafety` with keyword ``safe``.

:dp:`fls_qwchgvvnp0qe`
An :t:`external function` shall not specify a :s:`FunctionQualifierList`.
Expand Down Expand Up @@ -240,7 +239,7 @@ An :t:`external static` inherits the :t:`ABI` of its enclosing
:t:`external block`.

:dp:`fls_fo9with6xumo`
An :t:`external static` shall be referenced from an :t:`unsafe context`.
An :t:`external static` shall be referenced from an :t:`unsafe context` unless it is defined in an :t:`unsafe external block` and subject to :s:`ItemSafety` with keyword ``safe``.

:dp:`fls_tr7purzcldn0`
An :t:`external static` shall not specify a :t:`static initializer`.
Expand Down
7 changes: 5 additions & 2 deletions src/functions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Functions
FunctionQualifierList $$fn$$ Name GenericParameterList? $$($$ FunctionParameterList? $$)$$ ReturnType? WhereClause? (FunctionBody | ;)

FunctionQualifierList ::=
$$const$$? $$async$$? $$unsafe$$? AbiSpecification?
$$const$$? $$async$$? ItemSafety? AbiSpecification?

FunctionParameterList ::=
(FunctionParameter ($$,$$ FunctionParameter)* $$,$$?)
Expand Down Expand Up @@ -171,7 +171,10 @@ is equivalent to :t:`function`
}

:dp:`fls_7ucwmzqtittv`
An :t:`unsafe function` is a :t:`function` subject to :t:`keyword` ``unsafe``.
An :t:`unsafe function` is a :t:`function` subject to an :s:`ItemSafety` with :t:`keyword` ``unsafe``.

:dp:`fls_8ltVLtAfvy0m`
A :t:`function` shall only be subject to an :s:`ItemSafety` with :t:`keyword` ``safe`` if it is an :t:`external function` in an :t:`unsafe external block`.

:dp:`fls_5hn8fkf7rcvz`
The invocation of an :t:`unsafe function` shall require :t:`unsafe context`.
Expand Down
Loading