From 8367ad0f6c3dec6aafc94b9d6b711fe9c1e7305e Mon Sep 17 00:00:00 2001 From: Tshepang Mbambo Date: Thu, 16 Apr 2026 08:58:22 +0200 Subject: [PATCH 1/5] document preservation of padding in operations on pointers --- src/changelog.rst | 7 +++++++ src/expressions.rst | 3 +++ src/values.rst | 6 ++++++ 3 files changed, 16 insertions(+) diff --git a/src/changelog.rst b/src/changelog.rst index 09c9ae55..285cfa17 100644 --- a/src/changelog.rst +++ b/src/changelog.rst @@ -33,6 +33,13 @@ Language changes in Rust 1.95.0 - The target is outside the scope of the FLS. - `const-eval: be more consistent in the behavior of padding during typed copies `_ + + New paragraphs: + + - :p:`fls_LmPbrh0Cba8g` + - :p:`fls_nwgIMLkvD2Ol` + - :p:`fls_hOIImCr1c6IF` + - `Const blocks are no longer evaluated to determine if expressions involving fallible operations can implicitly be constant-promoted `_ - `Make operational semantics of pattern matching independent of crate and module `_ diff --git a/src/expressions.rst b/src/expressions.rst index 848fb111..bb4f59a5 100644 --- a/src/expressions.rst +++ b/src/expressions.rst @@ -341,6 +341,9 @@ control reaches the invocation of :t:`macro` :std:`core::panic`. It is a static error if the evaluation of a :t:`constant expression` results in a :t:`value` that is unaligned. +:dp:`fls_hOIImCr1c6IF` +In a :t:`constant context`, it is undefined behavior to convert a :t:`pointer` that has :t:`provenance` into a non-pointer type. + .. rubric:: Dynamic Semantics :dp:`fls_tg0kya5125jt` diff --git a/src/values.rst b/src/values.rst index 68c27eb5..6c14d021 100644 --- a/src/values.rst +++ b/src/values.rst @@ -111,6 +111,12 @@ 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_LmPbrh0Cba8g` +The representation of the value of a :t:`constant initializer` or :t:`static initializer` must only contain bytes with :t:`provenance` where all bytes of some original :t:`pointer` are in the correct order. + +:dp:`fls_nwgIMLkvD2Ol` +:dt:`Provenance` is the memory that a :t:`pointer` has permission to access, the timespan during which it can acesss that memory, and if it can access the memory for writes. + .. rubric:: Dynamic Semantics :dp:`fls_xezt9hl069h4` From 00eb3eeebb708aa1dee7b2d2533c7e92584e6656 Mon Sep 17 00:00:00 2001 From: Tshepang Mbambo Date: Tue, 21 Apr 2026 17:34:43 +0200 Subject: [PATCH 2/5] be more consistent with other ub paragraphs Co-authored-by: Hristian Kirtchev <60669983+kirtchev-adacore@users.noreply.github.com> --- src/expressions.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/expressions.rst b/src/expressions.rst index bb4f59a5..c3a17245 100644 --- a/src/expressions.rst +++ b/src/expressions.rst @@ -342,7 +342,7 @@ It is a static error if the evaluation of a :t:`constant expression` results in a :t:`value` that is unaligned. :dp:`fls_hOIImCr1c6IF` -In a :t:`constant context`, it is undefined behavior to convert a :t:`pointer` that has :t:`provenance` into a non-pointer type. +It is undefined behavior to convert a :t:`pointer` that has :t:`provenance` into a non-:t:`pointer type` in a :t:`constant context`. .. rubric:: Dynamic Semantics From 56265ddc3cb0781e58d90dc880e509d6e5e80c18 Mon Sep 17 00:00:00 2001 From: Tshepang Mbambo Date: Tue, 21 Apr 2026 17:40:31 +0200 Subject: [PATCH 3/5] add some links Co-authored-by: Hristian Kirtchev <60669983+kirtchev-adacore@users.noreply.github.com> --- src/values.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/values.rst b/src/values.rst index 6c14d021..1eeb685e 100644 --- a/src/values.rst +++ b/src/values.rst @@ -112,7 +112,7 @@ The value of a :t:`constant` is determined by evaluating its :t:`constant initializer`. :dp:`fls_LmPbrh0Cba8g` -The representation of the value of a :t:`constant initializer` or :t:`static initializer` must only contain bytes with :t:`provenance` where all bytes of some original :t:`pointer` are in the correct order. +The :t:`representation` of the :t:`value` of a :t:`constant initializer` or :t:`static initializer` must only contain bytes with :t:`provenance` where all bytes of some original :t:`pointer` are in the correct order. :dp:`fls_nwgIMLkvD2Ol` :dt:`Provenance` is the memory that a :t:`pointer` has permission to access, the timespan during which it can acesss that memory, and if it can access the memory for writes. From e1cade083d8e442abb543bc1e855c7a32ff85c66 Mon Sep 17 00:00:00 2001 From: Tshepang Mbambo Date: Tue, 21 Apr 2026 17:37:50 +0200 Subject: [PATCH 4/5] add ub marker --- src/expressions.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/expressions.rst b/src/expressions.rst index c3a17245..3c85d797 100644 --- a/src/expressions.rst +++ b/src/expressions.rst @@ -341,6 +341,8 @@ control reaches the invocation of :t:`macro` :std:`core::panic`. It is a static error if the evaluation of a :t:`constant expression` results in a :t:`value` that is unaligned. +.. rubric:: Undefined Behavior + :dp:`fls_hOIImCr1c6IF` It is undefined behavior to convert a :t:`pointer` that has :t:`provenance` into a non-:t:`pointer type` in a :t:`constant context`. From d22f218a4e7395632a5ad54dd1ef921e858bc8bb Mon Sep 17 00:00:00 2001 From: Tshepang Mbambo Date: Tue, 21 Apr 2026 18:10:18 +0200 Subject: [PATCH 5/5] use the full term --- src/values.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/values.rst b/src/values.rst index 1eeb685e..83f351eb 100644 --- a/src/values.rst +++ b/src/values.rst @@ -112,7 +112,7 @@ The value of a :t:`constant` is determined by evaluating its :t:`constant initializer`. :dp:`fls_LmPbrh0Cba8g` -The :t:`representation` of the :t:`value` of a :t:`constant initializer` or :t:`static initializer` must only contain bytes with :t:`provenance` where all bytes of some original :t:`pointer` are in the correct order. +The :t:`type representation` of the :t:`value` of a :t:`constant initializer` or :t:`static initializer` must only contain bytes with :t:`provenance` where all bytes of some original :t:`pointer` are in the correct order. :dp:`fls_nwgIMLkvD2Ol` :dt:`Provenance` is the memory that a :t:`pointer` has permission to access, the timespan during which it can acesss that memory, and if it can access the memory for writes.