Skip to content

Commit

Permalink
Merge #536
Browse files Browse the repository at this point in the history
536: Update to 1.82 and 1.83 r=tshepang a=Veykril

Builds atop of #529 

Co-authored-by: Lukas Wirth <[email protected]>
  • Loading branch information
bors-ferrocene[bot] and Veykril authored Dec 10, 2024
2 parents 1f02cbd + 127ff1b commit c75feeb
Show file tree
Hide file tree
Showing 13 changed files with 406 additions and 42 deletions.
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
128 changes: 128 additions & 0 deletions src/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,134 @@ 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.83.0
-------------------------------

* `Stabilize \`&mut\`, \`*mut\`, \`&Cell\`, and \`*const Cell\` in const. <https://github.com/rust-lang/rust/pull/129195>`_

* Changed paragraphs: :p:`fls_to4e7imq2c0w`, :p:`fls_6g7c1kjrmfnr`, :p:`fls_hkbwa8xx2fwx`

* `Allow creating references to statics in \`const\` initializers. <https://github.com/rust-lang/rust/pull/129759>`_

* No change: This previous restriction is not specified in the FLS

* `Implement raw lifetimes and labels (\`'r#ident\`). <https://github.com/rust-lang/rust/pull/126452>`_

* Changed syntax: :s:`Lifetime`

* `Define behavior when atomic and non-atomic reads race. <https://github.com/rust-lang/rust/pull/128778>`_

* No change: Already covered by the definition of :t:`data race`.

* `Non-exhaustive structs may now be empty. <https://github.com/rust-lang/rust/pull/128934>`_

* Removed paragraph: :p:`fls_2CWUWbYT9KcT`

* Changed paragraph: :p:`fls_fSNrRsgzLd0E`, :p:`fls_S9QL6yVF5LFI`

* `Disallow implicit coercions from places of type \`!\` <https://github.com/rust-lang/rust/pull/129392>`_

* No change: The FLS does not specify type inference to such a degree

* `\`const extern\` functions can now be defined for other calling conventions. <https://github.com/rust-lang/rust/pull/129753>`_

* No change: This previous restriction is not specified in the FLS

* `Stabilize \`expr_2021\` macro fragment specifier in all editions. <https://github.com/rust-lang/rust/pull/129972>`_

* Changed syntax: :s:`MacroFragmentSpecifier`

* Changed paragraphs: :p:`fls_k00bck2k8tde`, :p:`fls_PxR9vNHsaFnI`

* `The \`non_local_definitions\` lint now fires on less code and warns by default. <https://github.com/rust-lang/rust/pull/127117>`_

* No change: Lints are not part of the FLS

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
86 changes: 73 additions & 13 deletions src/expressions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,7 @@ involve :t:`[type]s` that require :t:`destruction`:
:t:`[Constant parameter]s`,

* :dp:`fls_to4e7imq2c0w`
:t:`[Dereference expression]s` when the :t:`operand` is not of a
:t:`raw pointer type`,
:t:`[Dereference expression]s`,

* :dp:`fls_krtbrpwf3mh0`
:t:`[Expression statement]s`,
Expand All @@ -211,8 +210,7 @@ involve :t:`[type]s` that require :t:`destruction`:
:t:`[If let expression]s`,

* :dp:`fls_6g7c1kjrmfnr`
:t:`[Immutable borrow expression]s` where the borrowed :t:`type` is not
subject to :t:`interior mutability`.
:t:`[Immutable borrow expression]s`.

* :dp:`fls_rpapnm3afan8`
:t:`[Index expression]s`,
Expand Down Expand Up @@ -251,8 +249,7 @@ involve :t:`[type]s` that require :t:`destruction`:
:t:`[Range expression]s`,

* :dp:`fls_hkbwa8xx2fwx`
:t:`[Shared borrow]s` that do not involve :t:`[type]s` with
:t:`interior mutability`,
:t:`[Borrow]s`,

* :dp:`fls_fobs8ebt7dhc`
:t:`[Struct expression]s`,
Expand Down Expand Up @@ -280,11 +277,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 +474,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 +922,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 +972,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 +2058,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
Loading

0 comments on commit c75feeb

Please sign in to comment.