From 7f4881c0853be786be926465db4f7cbbcf6c5cf9 Mon Sep 17 00:00:00 2001 From: Tshepang Mbambo Date: Tue, 9 Dec 2025 18:04:50 +0200 Subject: [PATCH 01/10] this is not referenced anywhere in the FLS --- src/ffi.rst | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/ffi.rst b/src/ffi.rst index 95725dfb..4a7d43a3 100644 --- a/src/ffi.rst +++ b/src/ffi.rst @@ -74,8 +74,7 @@ The following :t:`[ABI]s` are supported: :dt:`Rust ABI`. * :dp:`fls_8m7pc3riokst` - ``extern "system"`` - The operating system-dependent :t:`ABI`, referred to as - :dt:`external system ABI`. + ``extern "system"`` - The operating system-dependent :t:`ABI`. * :dp:`fls_NQAzj5ai1La5` ``extern "system-unwind"`` - The same as ``extern "system"`` with the From f91761f831446a87e882beb5d74e37da2d7d53a6 Mon Sep 17 00:00:00 2001 From: Tshepang Mbambo Date: Thu, 4 Dec 2025 21:47:24 +0200 Subject: [PATCH 02/10] more ABIs are now allowed in variadic functions --- src/changelog.rst | 16 ++++++++++++++++ src/types-and-traits.rst | 25 ++++++++++++++++++++++++- 2 files changed, 40 insertions(+), 1 deletion(-) diff --git a/src/changelog.rst b/src/changelog.rst index eee2fab7..347c0e82 100644 --- a/src/changelog.rst +++ b/src/changelog.rst @@ -31,6 +31,22 @@ Language changes in Rust 1.91.0 - `Stabilize declaration of C-style variadic functions for 'sysv64', 'win64', 'efiapi', and 'aapcs' ABIs `_. This brings these ABIs in line with the C ABI: variadic functions can be declared in extern blocks but not defined. + - Changed paragraph: :p:`fls_hbn1l42xmr3h` + + - New paragraphs: + + - :p:`fls_OR85NVifPwjr` + - :p:`fls_4s2IdfYDzPrX` + - :p:`fls_ZJJppPfiJRou` + - :p:`fls_jOyZh9ujWWHQ` + - :p:`fls_Xdr0bFwxhWiB` + - :p:`fls_DpTFEHZAABdD` + - :p:`fls_eHPWHrvs7ETl` + - :p:`fls_mjCrvmikm58M` + - :p:`fls_4EUb9zFatZ97` + - :p:`fls_4B4B5FIqAes9` + - :p:`fls_b7FTlWfnX2OI` + - `Add dangling_pointers_from_locals lint to warn against dangling pointers from local variables `_ - No change: lints are not part of the FLS diff --git a/src/types-and-traits.rst b/src/types-and-traits.rst index 870181b2..b6b587e3 100644 --- a/src/types-and-traits.rst +++ b/src/types-and-traits.rst @@ -979,7 +979,30 @@ parameters. :dp:`fls_hbn1l42xmr3h` A :t:`variadic part` shall be specified only when the :t:`ABI` of the -:t:`function pointer type` is either ``extern "C"`` or ``extern "cdecl"``. +:t:`function pointer type` is one of the following: + +* :dp:`fls_OR85NVifPwjr` + ``extern "C"`` +* :dp:`fls_4s2IdfYDzPrX` + ``extern "C-unwind"`` +* :dp:`fls_ZJJppPfiJRou` + ``extern "aapcs"`` +* :dp:`fls_jOyZh9ujWWHQ` + ``extern "aapcs-unwind"`` +* :dp:`fls_Xdr0bFwxhWiB` + ``extern "cdecl"`` +* :dp:`fls_DpTFEHZAABdD` + ``extern "cdecl-unwind"`` +* :dp:`fls_eHPWHrvs7ETl` + ``extern "sysv64"`` +* :dp:`fls_mjCrvmikm58M` + ``extern "sysv64-unwind"`` +* :dp:`fls_4EUb9zFatZ97` + ``extern "win64"`` +* :dp:`fls_4B4B5FIqAes9` + ``extern "win64-unwind"`` +* :dp:`fls_b7FTlWfnX2OI` + ``extern "efiapi"`` :dp:`fls_g1iYVw7upBnH` The :t:`return type` of a :t:`function pointer type` is determined as follows: From 489e3f1faac0c5388f6921400eb935d2d3967a87 Mon Sep 17 00:00:00 2001 From: Tshepang Mbambo Date: Wed, 10 Dec 2025 13:54:40 +0200 Subject: [PATCH 03/10] list other ABIs --- src/changelog.rst | 11 ++++++++++- src/ffi.rst | 21 ++++++++++++++++++++- 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/src/changelog.rst b/src/changelog.rst index 347c0e82..da52a677 100644 --- a/src/changelog.rst +++ b/src/changelog.rst @@ -31,7 +31,10 @@ Language changes in Rust 1.91.0 - `Stabilize declaration of C-style variadic functions for 'sysv64', 'win64', 'efiapi', and 'aapcs' ABIs `_. This brings these ABIs in line with the C ABI: variadic functions can be declared in extern blocks but not defined. - - Changed paragraph: :p:`fls_hbn1l42xmr3h` + - Changed paragraphs: + + - :p:`fls_hbn1l42xmr3h` + - :p:`fls_dbbfqaqa80r8` - New paragraphs: @@ -47,6 +50,12 @@ Language changes in Rust 1.91.0 - :p:`fls_4B4B5FIqAes9` - :p:`fls_b7FTlWfnX2OI` + - :p:`fls_UippZpUyYpHl` + - :p:`fls_CIyK8BYzzo26` + - :p:`fls_ccFdnlX5HIYk` + - :p:`fls_xrCRprWS13R1` + - :p:`fls_JHlqXjn4Sf07` + - `Add dangling_pointers_from_locals lint to warn against dangling pointers from local variables `_ - No change: lints are not part of the FLS diff --git a/src/ffi.rst b/src/ffi.rst index 4a7d43a3..7ab1b6d3 100644 --- a/src/ffi.rst +++ b/src/ffi.rst @@ -95,11 +95,19 @@ A tool is allowed to specify additional :t:`[ABI]s`. These :t:`[ABI]s` may include, but may not be limited to, the following: * :dp:`fls_dbbfqaqa80r8` - ``extern "aapcs"`` - The ARM :t:`ABI`. + ``extern "aapcs"`` - The soft-float ABI for 32-bit ARM targets. + +* :dp:`fls_UippZpUyYpHl` + ``extern "aapcs-unwind"`` - The same as ``extern "aapcs"`` + with the addition that unwinding across FFI is permitted. * :dp:`fls_36qrs2fxxvi7` ``extern "cdecl"`` - The x86_32 :t:`ABI` of :t:`C` code. +* :dp:`fls_CIyK8BYzzo26` + ``extern "cdecl-unwind"`` - The same as ``extern "cdecl"`` + with the addition that unwinding across FFI is permitted. + * :dp:`fls_6rtj6rwqxojh` ``extern "fastcall"`` - The ``fastcall`` :t:`ABI` that corresponds to MSVC's ``__fastcall`` and GCC and clang's ``__attribute__((fastcall))``. @@ -110,6 +118,10 @@ include, but may not be limited to, the following: * :dp:`fls_7t7yxh94wnbl` ``extern "sysv64"`` - The x86_64 non-Windows :t:`ABI` of :t:`C` code. +* :dp:`fls_ccFdnlX5HIYk` + ``extern "sysv64-unwind"`` - The same as ``extern "sysv64"`` + with the addition that unwinding across FFI is permitted. + * :dp:`fls_sxj4vy39sj4g` ``extern "vectorcall"`` - The ``vectorcall`` :t:`ABI` that corresponds to MSVC's ``__vectorcall`` and clang's ``__attribute__((vectorcall))``. @@ -117,6 +129,13 @@ include, but may not be limited to, the following: * :dp:`fls_tyjs1x4j8ovp` ``extern "win64"`` - The x86_64 Windows :t:`ABI` of :t:`C` code. +* :dp:`fls_xrCRprWS13R1` + ``extern "win64-unwind"`` - The same as ``extern "win64"`` + with the addition that unwinding across FFI is permitted. + +* :dp:`fls_JHlqXjn4Sf07` + ``extern "efiapi"`` - The :t:`ABI` for `UEFI `_. + .. rubric:: Undefined Behavior :dp:`fls_M4LqHf8hbPA8` From 2b179dbfd87d06b3657148204e79915c7d3b7063 Mon Sep 17 00:00:00 2001 From: Tshepang Mbambo Date: Wed, 10 Dec 2025 14:25:52 +0200 Subject: [PATCH 04/10] define "variadic ABI", and refer to it --- src/changelog.rst | 2 ++ src/functions.rst | 2 +- src/types-and-traits.rst | 5 ++++- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/changelog.rst b/src/changelog.rst index da52a677..0ad493c2 100644 --- a/src/changelog.rst +++ b/src/changelog.rst @@ -35,6 +35,7 @@ Language changes in Rust 1.91.0 - :p:`fls_hbn1l42xmr3h` - :p:`fls_dbbfqaqa80r8` + - :p:`fls_icdzs1mjh0n4` - New paragraphs: @@ -49,6 +50,7 @@ Language changes in Rust 1.91.0 - :p:`fls_4EUb9zFatZ97` - :p:`fls_4B4B5FIqAes9` - :p:`fls_b7FTlWfnX2OI` + - :p:`fls_o4uSLPo00KUg` - :p:`fls_UippZpUyYpHl` - :p:`fls_CIyK8BYzzo26` diff --git a/src/functions.rst b/src/functions.rst index e7822952..b4d8e5f8 100644 --- a/src/functions.rst +++ b/src/functions.rst @@ -105,7 +105,7 @@ The :t:`[binding]s` of all :t:`[pattern]s` of all :t:`[function parameter]s` of :dp:`fls_icdzs1mjh0n4` A :t:`function` shall not specify a :s:`FunctionParameterVariadicPart` unless -it is an :t:`external function`. +it is an :t:`external function` subject to a :t:`variadic ABI`. :dp:`fls_vljy4mm0zca2` A :t:`return type` is the :t:`type` of the result a :t:`function`, :t:`closure type` or :t:`function pointer type` returns. diff --git a/src/types-and-traits.rst b/src/types-and-traits.rst index b6b587e3..3a065039 100644 --- a/src/types-and-traits.rst +++ b/src/types-and-traits.rst @@ -979,7 +979,10 @@ parameters. :dp:`fls_hbn1l42xmr3h` A :t:`variadic part` shall be specified only when the :t:`ABI` of the -:t:`function pointer type` is one of the following: +:t:`function pointer type` is a :t:`variadic ABI`. + +:dp:`fls_o4uSLPo00KUg` +A :dt:`variadic ABI` is any of the following :t:`[ABI]s`: * :dp:`fls_OR85NVifPwjr` ``extern "C"`` From 040ac8f80d4ab54bab7910c87551634bb51b055e Mon Sep 17 00:00:00 2001 From: Tshepang Mbambo Date: Wed, 10 Dec 2025 14:30:37 +0200 Subject: [PATCH 05/10] whitespace --- src/changelog.rst | 1 - 1 file changed, 1 deletion(-) diff --git a/src/changelog.rst b/src/changelog.rst index 0ad493c2..3912117a 100644 --- a/src/changelog.rst +++ b/src/changelog.rst @@ -51,7 +51,6 @@ Language changes in Rust 1.91.0 - :p:`fls_4B4B5FIqAes9` - :p:`fls_b7FTlWfnX2OI` - :p:`fls_o4uSLPo00KUg` - - :p:`fls_UippZpUyYpHl` - :p:`fls_CIyK8BYzzo26` - :p:`fls_ccFdnlX5HIYk` From a45df410e416139beb4e62cad7fb480dda44408e Mon Sep 17 00:00:00 2001 From: Tshepang Mbambo Date: Thu, 11 Dec 2025 07:23:38 +0200 Subject: [PATCH 06/10] sort --- src/types-and-traits.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/types-and-traits.rst b/src/types-and-traits.rst index 3a065039..f0881a33 100644 --- a/src/types-and-traits.rst +++ b/src/types-and-traits.rst @@ -996,6 +996,8 @@ A :dt:`variadic ABI` is any of the following :t:`[ABI]s`: ``extern "cdecl"`` * :dp:`fls_DpTFEHZAABdD` ``extern "cdecl-unwind"`` +* :dp:`fls_b7FTlWfnX2OI` + ``extern "efiapi"`` * :dp:`fls_eHPWHrvs7ETl` ``extern "sysv64"`` * :dp:`fls_mjCrvmikm58M` @@ -1004,8 +1006,6 @@ A :dt:`variadic ABI` is any of the following :t:`[ABI]s`: ``extern "win64"`` * :dp:`fls_4B4B5FIqAes9` ``extern "win64-unwind"`` -* :dp:`fls_b7FTlWfnX2OI` - ``extern "efiapi"`` :dp:`fls_g1iYVw7upBnH` The :t:`return type` of a :t:`function pointer type` is determined as follows: From 275e8a17ec685139afa73220fe3a4e7f262acd36 Mon Sep 17 00:00:00 2001 From: Tshepang Mbambo Date: Sat, 13 Dec 2025 11:49:51 +0200 Subject: [PATCH 07/10] define "variadic function" instead of "variadic ABI" This avoids defining a new term, and instead follows Rust Reference --- src/functions.rst | 30 ++++++++++++++++++++++++++++-- src/types-and-traits.rst | 29 +---------------------------- 2 files changed, 29 insertions(+), 30 deletions(-) diff --git a/src/functions.rst b/src/functions.rst index b4d8e5f8..056aba8f 100644 --- a/src/functions.rst +++ b/src/functions.rst @@ -103,9 +103,35 @@ The :t:`expected type` of the :t:`pattern` of a :t:`function parameter` is the : :dp:`fls_PGDKWK7nPvgw` The :t:`[binding]s` of all :t:`[pattern]s` of all :t:`[function parameter]s` of a :t:`function` shall not shadow another. +:dp:`fls_o4uSLPo00KUg` +A :dt:`variadic function` is an :t:`external function` that specifies +:s:`FunctionParameterVariadicPart` as the last :t:`function parameter`. + :dp:`fls_icdzs1mjh0n4` -A :t:`function` shall not specify a :s:`FunctionParameterVariadicPart` unless -it is an :t:`external function` subject to a :t:`variadic ABI`. +A :t:`variadic function` can only be used with one of the following :t:`[ABI]s`: + +* :dp:`fls_OR85NVifPwjr` + ``extern "C"`` +* :dp:`fls_4s2IdfYDzPrX` + ``extern "C-unwind"`` +* :dp:`fls_ZJJppPfiJRou` + ``extern "aapcs"`` +* :dp:`fls_jOyZh9ujWWHQ` + ``extern "aapcs-unwind"`` +* :dp:`fls_Xdr0bFwxhWiB` + ``extern "cdecl"`` +* :dp:`fls_DpTFEHZAABdD` + ``extern "cdecl-unwind"`` +* :dp:`fls_b7FTlWfnX2OI` + ``extern "efiapi"`` +* :dp:`fls_eHPWHrvs7ETl` + ``extern "sysv64"`` +* :dp:`fls_mjCrvmikm58M` + ``extern "sysv64-unwind"`` +* :dp:`fls_4EUb9zFatZ97` + ``extern "win64"`` +* :dp:`fls_4B4B5FIqAes9` + ``extern "win64-unwind"`` :dp:`fls_vljy4mm0zca2` A :t:`return type` is the :t:`type` of the result a :t:`function`, :t:`closure type` or :t:`function pointer type` returns. diff --git a/src/types-and-traits.rst b/src/types-and-traits.rst index f0881a33..997a232d 100644 --- a/src/types-and-traits.rst +++ b/src/types-and-traits.rst @@ -978,34 +978,7 @@ A :t:`variadic part` indicates the presence of :t:`C`-like optional parameters. :dp:`fls_hbn1l42xmr3h` -A :t:`variadic part` shall be specified only when the :t:`ABI` of the -:t:`function pointer type` is a :t:`variadic ABI`. - -:dp:`fls_o4uSLPo00KUg` -A :dt:`variadic ABI` is any of the following :t:`[ABI]s`: - -* :dp:`fls_OR85NVifPwjr` - ``extern "C"`` -* :dp:`fls_4s2IdfYDzPrX` - ``extern "C-unwind"`` -* :dp:`fls_ZJJppPfiJRou` - ``extern "aapcs"`` -* :dp:`fls_jOyZh9ujWWHQ` - ``extern "aapcs-unwind"`` -* :dp:`fls_Xdr0bFwxhWiB` - ``extern "cdecl"`` -* :dp:`fls_DpTFEHZAABdD` - ``extern "cdecl-unwind"`` -* :dp:`fls_b7FTlWfnX2OI` - ``extern "efiapi"`` -* :dp:`fls_eHPWHrvs7ETl` - ``extern "sysv64"`` -* :dp:`fls_mjCrvmikm58M` - ``extern "sysv64-unwind"`` -* :dp:`fls_4EUb9zFatZ97` - ``extern "win64"`` -* :dp:`fls_4B4B5FIqAes9` - ``extern "win64-unwind"`` +A :t:`variadic part` can only be used on a :t:`variadic function`. :dp:`fls_g1iYVw7upBnH` The :t:`return type` of a :t:`function pointer type` is determined as follows: From 29426757a0eb41a7e5452644c260256b44bf7394 Mon Sep 17 00:00:00 2001 From: Tshepang Mbambo Date: Sun, 14 Dec 2025 14:16:02 +0200 Subject: [PATCH 08/10] missed these 2 ABIs --- src/changelog.rst | 2 ++ src/functions.rst | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/src/changelog.rst b/src/changelog.rst index 3912117a..ede01209 100644 --- a/src/changelog.rst +++ b/src/changelog.rst @@ -45,6 +45,8 @@ Language changes in Rust 1.91.0 - :p:`fls_jOyZh9ujWWHQ` - :p:`fls_Xdr0bFwxhWiB` - :p:`fls_DpTFEHZAABdD` + - :p:`fls_6urL6fZ5cpaA` + - :p:`fls_TMOzb6cYIOlH` - :p:`fls_eHPWHrvs7ETl` - :p:`fls_mjCrvmikm58M` - :p:`fls_4EUb9zFatZ97` diff --git a/src/functions.rst b/src/functions.rst index 056aba8f..d7c6afca 100644 --- a/src/functions.rst +++ b/src/functions.rst @@ -124,6 +124,10 @@ A :t:`variadic function` can only be used with one of the following :t:`[ABI]s`: ``extern "cdecl-unwind"`` * :dp:`fls_b7FTlWfnX2OI` ``extern "efiapi"`` +* :dp:`fls_6urL6fZ5cpaA` + ``extern "system"`` +* :dp:`fls_TMOzb6cYIOlH` + ``extern "system-unwind"`` * :dp:`fls_eHPWHrvs7ETl` ``extern "sysv64"`` * :dp:`fls_mjCrvmikm58M` From 686f9d0ac48fa03e4b33eb8b9d0539b06b15c1ac Mon Sep 17 00:00:00 2001 From: Tshepang Mbambo Date: Mon, 15 Dec 2025 11:10:43 +0200 Subject: [PATCH 09/10] use more direct language from review > Since it is the job of the programmer to ensure proper ABI use, the rule must be stated as a requirement ("shall", "must", etc). Co-authored-by: Hristian Kirtchev <60669983+kirtchev-adacore@users.noreply.github.com> --- src/functions.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/functions.rst b/src/functions.rst index d7c6afca..3a5e02c2 100644 --- a/src/functions.rst +++ b/src/functions.rst @@ -108,7 +108,7 @@ A :dt:`variadic function` is an :t:`external function` that specifies :s:`FunctionParameterVariadicPart` as the last :t:`function parameter`. :dp:`fls_icdzs1mjh0n4` -A :t:`variadic function` can only be used with one of the following :t:`[ABI]s`: +A :t:`variadic function` shall specify one of the following :t:`[ABI]s`: * :dp:`fls_OR85NVifPwjr` ``extern "C"`` From cf4355434e5d30b4b138f1f678d3ecab8b13518c Mon Sep 17 00:00:00 2001 From: Tshepang Mbambo Date: Mon, 15 Dec 2025 11:11:49 +0200 Subject: [PATCH 10/10] fix grammar Co-authored-by: Hristian Kirtchev <60669983+kirtchev-adacore@users.noreply.github.com> --- src/types-and-traits.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/types-and-traits.rst b/src/types-and-traits.rst index 997a232d..593d7440 100644 --- a/src/types-and-traits.rst +++ b/src/types-and-traits.rst @@ -978,7 +978,7 @@ A :t:`variadic part` indicates the presence of :t:`C`-like optional parameters. :dp:`fls_hbn1l42xmr3h` -A :t:`variadic part` can only be used on a :t:`variadic function`. +A :t:`variadic part` can only be used in a :t:`variadic function`. :dp:`fls_g1iYVw7upBnH` The :t:`return type` of a :t:`function pointer type` is determined as follows: