diff options
author | sheaf <sam.derbyshire@gmail.com> | 2022-04-26 21:09:33 +0200 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2022-04-27 10:03:43 -0400 |
commit | 8bef471aaaf3cf40d68786f06b2b9f65d3d851e7 (patch) | |
tree | e38ad6211c96ffd02be973cb2fdb887905358a7c /docs | |
parent | 5de6be0c9120550aaa15534d0a1466018eff137a (diff) | |
download | haskell-8bef471aaaf3cf40d68786f06b2b9f65d3d851e7.tar.gz |
Ensure that Any is Boxed in FFI imports/exports
We should only accept the type `Any` in foreign import/export
declarations when it has type `Type` or `UnliftedType`.
This patch adds a kind check, and a special error message triggered by
occurrences of `Any` in foreign import/export declarations at other
kinds.
Fixes #21305
Diffstat (limited to 'docs')
-rw-r--r-- | docs/users_guide/exts/ffi.rst | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/docs/users_guide/exts/ffi.rst b/docs/users_guide/exts/ffi.rst index 22f8f33280..eed9f5a348 100644 --- a/docs/users_guide/exts/ffi.rst +++ b/docs/users_guide/exts/ffi.rst @@ -295,9 +295,10 @@ calling convention ``prim``, e.g.: :: This is used to import functions written in Cmm code that follow an internal GHC calling convention. The arguments and results must be -unboxed types, except that an argument may be of type ``Any`` (by way of +unboxed types, except that an argument may be of type ``Any :: Type`` +or ``Any :: UnliftedType`` (which can be arranged by way of ``unsafeCoerce#``) and the result type is allowed to be an unboxed tuple -or the type ``Any``. +or the types ``Any :: Type`` or ``Any :: UnliftedType``. This feature is not intended for use outside of the core libraries that come with GHC. For more details see the |