From cd10556cb41c4a8a393072e5ea1d590851c56a5e Mon Sep 17 00:00:00 2001 From: Lukas Wirth Date: Thu, 16 Nov 2023 13:13:04 +0100 Subject: [PATCH] Specify default abi for extern blocks --- src/ffi.rst | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/ffi.rst b/src/ffi.rst index 94dfc78b..a9ba5871 100644 --- a/src/ffi.rst +++ b/src/ffi.rst @@ -138,7 +138,7 @@ External Blocks .. syntax:: ExternalBlock ::= - $$unsafe$$? $$extern$$ AbiSpecification? $${$$ + $$unsafe$$? $$extern$$ AbiKind? $${$$ InnerAttributeOrDoc* ExternItem* $$}$$ @@ -158,6 +158,15 @@ External Blocks An :t:`external block` is a :t:`construct` that provides the declarations of foreign :t:`[function]s` as unchecked imports. +:dp:`fls_Nz0l16hMxqTd` +The :t:`ABI` of a :t:`extern block` is determined as follows: + +* :dp:`fls_4XOoiFloXM7t` + If the :t:`extern block` specifies an :s:`AbiKind`, then the :t:`ABI` is the specified :s:`AbiKind`. + +* :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`. @@ -237,4 +246,3 @@ An :t:`external static` shall not specify a :t:`static initializer`. :dp:`fls_en2h09ehj0j3` An :t:`immutable` :t:`external static` shall be initialized before Rust code is executed. -