From 3f816676cbf833690911d43dfba12bcfe4e0ee15 Mon Sep 17 00:00:00 2001 From: Tshepang Mbambo Date: Fri, 10 Oct 2025 16:25:24 +0200 Subject: [PATCH 01/13] document Rust 1.90 changes --- src/changelog.rst | 15 +++++++++++++++ src/patterns.rst | 6 ++++++ 2 files changed, 21 insertions(+) diff --git a/src/changelog.rst b/src/changelog.rst index 1bd0db60..dcd8b541 100644 --- a/src/changelog.rst +++ b/src/changelog.rst @@ -18,6 +18,21 @@ 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.90.0 +------------------------------- + +- `Split up the unknown_or_malformed_diagnostic_attributes lint `_ + + - No change: lints are not part of the FLS + +- `Allow constants whose final value has references to mutable/external memory, but reject such constants as patterns `_ + + - New paragraph: :p:`fls_wJ9f906BlBvg` + +- `Allow volatile access to non-Rust memory, including address 0 `_ + + - No change: lints are not part of the FLS + Language changes in Rust 1.89.0 ------------------------------- diff --git a/src/patterns.rst b/src/patterns.rst index 4b494156..57de8092 100644 --- a/src/patterns.rst +++ b/src/patterns.rst @@ -370,6 +370,12 @@ When a :t:`path pattern` refers to an :t:`associated constant` or a :t:`constant`, the :t:`type` of the :t:`associated constant` or :t:`constant` shall be :t:`structurally equal`. +:dp:`fls_wJ9f906BlBvg` +When a :t:`path pattern` refers to an :t:`associated constant` or a +:t:`constant`, the :t:`constant` must not contain any references to +:t:`[mutable static]s`, :t:`[static]s` with :t:`interior mutability`, +or :t:`[external static]s`. + :dp:`fls_hF19K8sWU8FF` When the type of the :t:`path pattern` is of an :t:`enum type` or :t:`struct type`, then the :t:`enum type` or :t:`struct type` shall be subject From c91d9b391c513fe226bf508eb6a6cd1f0335241a Mon Sep 17 00:00:00 2001 From: Tshepang Mbambo Date: Fri, 10 Oct 2025 21:57:27 +0200 Subject: [PATCH 02/13] bump version --- version.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.rst b/version.rst index c2f931c7..928a28e3 100644 --- a/version.rst +++ b/version.rst @@ -1,4 +1,4 @@ .. SPDX-License-Identifier: MIT OR Apache-2.0 SPDX-FileCopyrightText: The Ferrocene Developers SPDX-FileCopyrightText: The Rust Project Developers -.. |spec_version| replace:: 1.88.0 +.. |spec_version| replace:: 1.90.0 From 1ffaf13944cb185ce6a99bd1788e2804c515d7dd Mon Sep 17 00:00:00 2001 From: Tshepang Mbambo Date: Tue, 14 Oct 2025 00:06:40 +0200 Subject: [PATCH 03/13] the restriction was not documented --- src/changelog.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/changelog.rst b/src/changelog.rst index dcd8b541..589fcff7 100644 --- a/src/changelog.rst +++ b/src/changelog.rst @@ -27,7 +27,8 @@ Language changes in Rust 1.90.0 - `Allow constants whose final value has references to mutable/external memory, but reject such constants as patterns `_ - - New paragraph: :p:`fls_wJ9f906BlBvg` + - This lifted restriction was not specified in the FLS + - The restriction on patterns is documented in :p:`fls_wJ9f906BlBvg` - `Allow volatile access to non-Rust memory, including address 0 `_ From 807ad1bf9fb6e1727406086694cd4bac5ed477cd Mon Sep 17 00:00:00 2001 From: Tshepang Mbambo Date: Thu, 16 Oct 2025 15:24:26 +0200 Subject: [PATCH 04/13] remove an obsolete restriction --- src/changelog.rst | 1 + src/expressions.rst | 4 ---- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/src/changelog.rst b/src/changelog.rst index 589fcff7..03386d66 100644 --- a/src/changelog.rst +++ b/src/changelog.rst @@ -332,6 +332,7 @@ Language changes in Rust 1.83.0 * `Stabilize \`&mut\`, \`*mut\`, \`&Cell\`, and \`*const Cell\` in const. `_ * Changed paragraphs: :p:`fls_to4e7imq2c0w`, :p:`fls_6g7c1kjrmfnr`, :p:`fls_hkbwa8xx2fwx` + * Removed paragraph: :p:`fls_ox6sgl9n43g2` * `Allow creating references to statics in \`const\` initializers. `_ diff --git a/src/expressions.rst b/src/expressions.rst index 06d5fad3..002dbe18 100644 --- a/src/expressions.rst +++ b/src/expressions.rst @@ -312,10 +312,6 @@ A :t:`constant context` is a :t:`construct` that requires a * :dp:`fls_ucFupTeCyylb` The :t:`block expression` of a :t:`const block expression`. -:dp:`fls_ox6sgl9n43g2` -It is a static error to create a :t:`mutable reference` in a -:t:`constant context`. - :dp:`fls_od0h3v40kjp6` An invocation of the :std:`core::ptr::addr_of` :t:`macro` expands to a :t:`constant expression` allowed in any :t:`constant context` and From fc14b8dbfe14590902db1607f44c5a13b3e3a6d9 Mon Sep 17 00:00:00 2001 From: Tshepang Mbambo Date: Sat, 18 Oct 2025 12:05:15 +0200 Subject: [PATCH 05/13] restore an adjusted restriction --- src/changelog.rst | 11 +++++++++-- src/values.rst | 3 +++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/changelog.rst b/src/changelog.rst index 03386d66..d0373fbe 100644 --- a/src/changelog.rst +++ b/src/changelog.rst @@ -331,8 +331,15 @@ Language changes in Rust 1.83.0 * `Stabilize \`&mut\`, \`*mut\`, \`&Cell\`, and \`*const Cell\` in const. `_ - * Changed paragraphs: :p:`fls_to4e7imq2c0w`, :p:`fls_6g7c1kjrmfnr`, :p:`fls_hkbwa8xx2fwx` - * Removed paragraph: :p:`fls_ox6sgl9n43g2` + * Changed paragraphs: + + - :p:`fls_to4e7imq2c0w` + + - :p:`fls_6g7c1kjrmfnr` + + - :p:`fls_hkbwa8xx2fwx` + + - :p:`fls_ox6sgl9n43g2` * `Allow creating references to statics in \`const\` initializers. `_ diff --git a/src/values.rst b/src/values.rst index 68c27eb5..37190235 100644 --- a/src/values.rst +++ b/src/values.rst @@ -95,6 +95,9 @@ The :t:`type specification` of a :t:`constant` shall have ``'static`` The :t:`type` of a :t:`constant` shall implement the :std:`core::marker::Sized` :t:`trait`. +:dp:`fls_ox6sgl9n43g2` +The type of a :t:`constant` cannot be a :t:`mutable reference type`. + :dp:`fls_ndmfqxjpvsqy` A :t:`constant initializer` is a :t:`construct` that provides the :t:`value` of its related :t:`constant`. From 3dc362ce9ea5305adc531e53d091d854ab9e9267 Mon Sep 17 00:00:00 2001 From: Tshepang Mbambo Date: Sat, 18 Oct 2025 14:03:54 +0200 Subject: [PATCH 06/13] that equivalent paragraph was actually moved to a new place --- src/changelog.rst | 10 +++------- src/values.rst | 2 +- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/src/changelog.rst b/src/changelog.rst index d0373fbe..6e573083 100644 --- a/src/changelog.rst +++ b/src/changelog.rst @@ -331,15 +331,11 @@ Language changes in Rust 1.83.0 * `Stabilize \`&mut\`, \`*mut\`, \`&Cell\`, and \`*const Cell\` in const. `_ - * Changed paragraphs: + * Changed paragraphs: :p:`fls_to4e7imq2c0w`, :p:`fls_6g7c1kjrmfnr`, :p:`fls_hkbwa8xx2fwx` - - :p:`fls_to4e7imq2c0w` + * New paragraph: :p:`fls_ooOYxhVh8hZo` - - :p:`fls_6g7c1kjrmfnr` - - - :p:`fls_hkbwa8xx2fwx` - - - :p:`fls_ox6sgl9n43g2` + * Removed paragraph: :p:`fls_ox6sgl9n43g2` * `Allow creating references to statics in \`const\` initializers. `_ diff --git a/src/values.rst b/src/values.rst index 37190235..07bb7bfa 100644 --- a/src/values.rst +++ b/src/values.rst @@ -95,7 +95,7 @@ The :t:`type specification` of a :t:`constant` shall have ``'static`` The :t:`type` of a :t:`constant` shall implement the :std:`core::marker::Sized` :t:`trait`. -:dp:`fls_ox6sgl9n43g2` +:dp:`fls_ooOYxhVh8hZo` The type of a :t:`constant` cannot be a :t:`mutable reference type`. :dp:`fls_ndmfqxjpvsqy` From fb5a2a50b3a0611a2e22c4ffd8fffbb42e90807b Mon Sep 17 00:00:00 2001 From: Tshepang Mbambo Date: Sat, 18 Oct 2025 15:50:36 +0200 Subject: [PATCH 07/13] add restrictions on constant expressions --- src/changelog.rst | 1 + src/expressions.rst | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/src/changelog.rst b/src/changelog.rst index 6e573083..e9b5fd5a 100644 --- a/src/changelog.rst +++ b/src/changelog.rst @@ -29,6 +29,7 @@ Language changes in Rust 1.90.0 - This lifted restriction was not specified in the FLS - The restriction on patterns is documented in :p:`fls_wJ9f906BlBvg` + - New paragraph: :p:`fls_zyuxqty09SDO` - `Allow volatile access to non-Rust memory, including address 0 `_ diff --git a/src/expressions.rst b/src/expressions.rst index 002dbe18..8d087dca 100644 --- a/src/expressions.rst +++ b/src/expressions.rst @@ -312,6 +312,12 @@ A :t:`constant context` is a :t:`construct` that requires a * :dp:`fls_ucFupTeCyylb` The :t:`block expression` of a :t:`const block expression`. +* :dp:`fls_zyuxqty09SDO` + All forms of :t:`[borrow]s` except those of expressions that would be subject to + :t:`drop scope extension`, + and which are either :t:`[mutable borrow]s` + or borrows of expressions that result in values with :t:`interior mutability`. + :dp:`fls_od0h3v40kjp6` An invocation of the :std:`core::ptr::addr_of` :t:`macro` expands to a :t:`constant expression` allowed in any :t:`constant context` and From 2d9b29e804b3b9fc6c83520f1d645ff814942574 Mon Sep 17 00:00:00 2001 From: Tshepang Mbambo Date: Sat, 25 Oct 2025 22:48:57 +0200 Subject: [PATCH 08/13] lifetime extension here applies to static lifetimes --- src/expressions.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/expressions.rst b/src/expressions.rst index 8d087dca..944fde2e 100644 --- a/src/expressions.rst +++ b/src/expressions.rst @@ -314,7 +314,7 @@ A :t:`constant context` is a :t:`construct` that requires a * :dp:`fls_zyuxqty09SDO` All forms of :t:`[borrow]s` except those of expressions that would be subject to - :t:`drop scope extension`, + :t:`drop scope extension` to the end of the program and which are either :t:`[mutable borrow]s` or borrows of expressions that result in values with :t:`interior mutability`. From 08395fc39528801a16756c62ad4066ae00015d87 Mon Sep 17 00:00:00 2001 From: Tshepang Mbambo Date: Sat, 25 Oct 2025 22:53:40 +0200 Subject: [PATCH 09/13] stronger wording --- src/expressions.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/expressions.rst b/src/expressions.rst index 944fde2e..e8bb5ae1 100644 --- a/src/expressions.rst +++ b/src/expressions.rst @@ -313,7 +313,7 @@ A :t:`constant context` is a :t:`construct` that requires a The :t:`block expression` of a :t:`const block expression`. * :dp:`fls_zyuxqty09SDO` - All forms of :t:`[borrow]s` except those of expressions that would be subject to + All forms of :t:`[borrow]s` except those of expressions that are subject to :t:`drop scope extension` to the end of the program and which are either :t:`[mutable borrow]s` or borrows of expressions that result in values with :t:`interior mutability`. From 3d1222a4f1656d907e9434f09219de1d1c3e2989 Mon Sep 17 00:00:00 2001 From: Tshepang Mbambo Date: Mon, 10 Nov 2025 17:04:46 +0200 Subject: [PATCH 10/13] move rule to a proper list --- src/expressions.rst | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/expressions.rst b/src/expressions.rst index e8bb5ae1..ab9c0e37 100644 --- a/src/expressions.rst +++ b/src/expressions.rst @@ -271,6 +271,12 @@ involve :t:`[type]s` that require :t:`destruction`: * :dp:`fls_qvofy4wkql0s` :t:`[While loop expression]s`. +* :dp:`fls_zyuxqty09SDO` + All forms of :t:`[borrow]s` except those of expressions that are subject to + :t:`drop scope extension` to the end of the program + and which are either :t:`[mutable borrow]s` + or borrows of expressions that result in values with :t:`interior mutability`. + :dp:`fls_3i7efddbsmn0` An :t:`expression` is not considered a :t:`constant expression` when it explicitly invokes an :t:`associated trait function` or uses @@ -312,12 +318,6 @@ A :t:`constant context` is a :t:`construct` that requires a * :dp:`fls_ucFupTeCyylb` The :t:`block expression` of a :t:`const block expression`. -* :dp:`fls_zyuxqty09SDO` - All forms of :t:`[borrow]s` except those of expressions that are subject to - :t:`drop scope extension` to the end of the program - and which are either :t:`[mutable borrow]s` - or borrows of expressions that result in values with :t:`interior mutability`. - :dp:`fls_od0h3v40kjp6` An invocation of the :std:`core::ptr::addr_of` :t:`macro` expands to a :t:`constant expression` allowed in any :t:`constant context` and From 1b9a0db56e5bac67ccaecfb7728a63f451c1915c Mon Sep 17 00:00:00 2001 From: Tshepang Mbambo Date: Mon, 10 Nov 2025 17:13:06 +0200 Subject: [PATCH 11/13] remove obsolete paragraphs --- src/changelog.rst | 2 ++ src/expressions.rst | 6 ------ 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/src/changelog.rst b/src/changelog.rst index e9b5fd5a..da933aaf 100644 --- a/src/changelog.rst +++ b/src/changelog.rst @@ -31,6 +31,8 @@ Language changes in Rust 1.90.0 - The restriction on patterns is documented in :p:`fls_wJ9f906BlBvg` - New paragraph: :p:`fls_zyuxqty09SDO` + - Above paragraph replaces :p:`fls_6g7c1kjrmfnr` and :p:`fls_hkbwa8xx2fwx` + - `Allow volatile access to non-Rust memory, including address 0 `_ - No change: lints are not part of the FLS diff --git a/src/expressions.rst b/src/expressions.rst index ab9c0e37..1f277099 100644 --- a/src/expressions.rst +++ b/src/expressions.rst @@ -209,9 +209,6 @@ involve :t:`[type]s` that require :t:`destruction`: * :dp:`fls_b5fraqx07wuo` :t:`[If let expression]s`, -* :dp:`fls_6g7c1kjrmfnr` - :t:`[Immutable borrow expression]s`. - * :dp:`fls_rpapnm3afan8` :t:`[Index expression]s`, @@ -248,9 +245,6 @@ involve :t:`[type]s` that require :t:`destruction`: * :dp:`fls_3bucpdj828bq` :t:`[Range expression]s`, -* :dp:`fls_hkbwa8xx2fwx` - :t:`[Borrow]s`, - * :dp:`fls_fobs8ebt7dhc` :t:`[Struct expression]s`, From 54478816d6b562e2dc167ca9fd19b1dd2bd6644e Mon Sep 17 00:00:00 2001 From: Tshepang Mbambo Date: Fri, 14 Nov 2025 20:55:21 +0200 Subject: [PATCH 12/13] document where mutable references are allowed in const items --- src/changelog.rst | 14 ++++++++++++-- src/values.rst | 20 +++++++++++++++++--- 2 files changed, 29 insertions(+), 5 deletions(-) diff --git a/src/changelog.rst b/src/changelog.rst index da933aaf..784d8a8a 100644 --- a/src/changelog.rst +++ b/src/changelog.rst @@ -33,6 +33,18 @@ Language changes in Rust 1.90.0 - Above paragraph replaces :p:`fls_6g7c1kjrmfnr` and :p:`fls_hkbwa8xx2fwx` + * New paragraphs: + + - :p:`fls_ooOYxhVh8hZo` + + - :p:`fls_zkNFeBLy80UA` + + - :p:`fls_VhzGfnWg7YrG` + + - :p:`fls_ibYKKQdB2tDn` + + - :p:`fls_dQdSxf8kOgbi` + - `Allow volatile access to non-Rust memory, including address 0 `_ - No change: lints are not part of the FLS @@ -336,8 +348,6 @@ Language changes in Rust 1.83.0 * Changed paragraphs: :p:`fls_to4e7imq2c0w`, :p:`fls_6g7c1kjrmfnr`, :p:`fls_hkbwa8xx2fwx` - * New paragraph: :p:`fls_ooOYxhVh8hZo` - * Removed paragraph: :p:`fls_ox6sgl9n43g2` * `Allow creating references to statics in \`const\` initializers. `_ diff --git a/src/values.rst b/src/values.rst index 07bb7bfa..b0387e2a 100644 --- a/src/values.rst +++ b/src/values.rst @@ -95,9 +95,6 @@ The :t:`type specification` of a :t:`constant` shall have ``'static`` The :t:`type` of a :t:`constant` shall implement the :std:`core::marker::Sized` :t:`trait`. -:dp:`fls_ooOYxhVh8hZo` -The type of a :t:`constant` cannot be a :t:`mutable reference type`. - :dp:`fls_ndmfqxjpvsqy` A :t:`constant initializer` is a :t:`construct` that provides the :t:`value` of its related :t:`constant`. @@ -114,6 +111,23 @@ The :t:`expression` of a :t:`constant initializer` shall be a The value of a :t:`constant` is determined by evaluating its :t:`constant initializer`. +:dp:`fls_ooOYxhVh8hZo` +After a :t:`constant initializer` is evaluated to a value of the declared type, +the value of the constant, after :t:`type coercion`, +cannot contain any :t:`[mutable reference]s`, except when + +- :dp:`fls_zkNFeBLy80UA` + The :t:`mutable reference` is contained within an :t:`external static`, or + +- :dp:`fls_VhzGfnWg7YrG` + The :t:`mutable reference` is contained within a :t:`mutable static`, or + +- :dp:`fls_ibYKKQdB2tDn` + The :t:`mutable reference` is contained within an :t:`union`, or + +- :dp:`fls_dQdSxf8kOgbi` + The :t:`referent` is a value of a :t:`zero-sized type`. + .. rubric:: Dynamic Semantics :dp:`fls_xezt9hl069h4` From 61b165ee8fee26fff83d61cba26dafb48132671c Mon Sep 17 00:00:00 2001 From: Tshepang Mbambo Date: Sat, 15 Nov 2025 03:17:33 +0200 Subject: [PATCH 13/13] remove redundant text; it is explained just prior --- src/values.rst | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/values.rst b/src/values.rst index b0387e2a..6cc61b79 100644 --- a/src/values.rst +++ b/src/values.rst @@ -112,9 +112,8 @@ The value of a :t:`constant` is determined by evaluating its :t:`constant initializer`. :dp:`fls_ooOYxhVh8hZo` -After a :t:`constant initializer` is evaluated to a value of the declared type, -the value of the constant, after :t:`type coercion`, -cannot contain any :t:`[mutable reference]s`, except when +After :t:`type coercion`, the value of the constant cannot contain any +:t:`[mutable reference]s`, except when - :dp:`fls_zkNFeBLy80UA` The :t:`mutable reference` is contained within an :t:`external static`, or