Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Specify default abi for extern blocks #471

Merged
merged 1 commit into from
Nov 16, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions src/ffi.rst
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ External Blocks
.. syntax::

ExternalBlock ::=
$$unsafe$$? $$extern$$ AbiSpecification? $${$$
$$unsafe$$? $$extern$$ AbiKind? $${$$
InnerAttributeOrDoc*
ExternItem*
$$}$$
Expand All @@ -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`.
Expand Down Expand Up @@ -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.