Skip to content

Commit 538345a

Browse files
committed
Turn explanation into a sidenote
1 parent 9387d35 commit 538345a

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

src/ffi.md

+8-9
Original file line numberDiff line numberDiff line change
@@ -704,15 +704,8 @@ for more information.
704704

705705
# Representing opaque structs
706706

707-
Sometimes, a C library wants to provide a pointer to something, but not let you
708-
know the internal details of the thing it wants. The simplest way is to use "extern types".
709-
But it's currently (as of June 2021) unstable and has some unresolved questions,
710-
see the [RFC page][extern-type-rfc] and the [tracking issue][extern-type-issue] for more details.
711-
712-
[extern-type-issue]: https://github.com/rust-lang/rust/issues/43467
713-
[extern-type-rfc]: https://rust-lang.github.io/rfcs/1861-extern-types.html
714-
715-
Alternatively, we can use a `void *` argument:
707+
Sometimes, a C library wants to provide a pointer to something, but not let you know the internal details of the thing it wants.
708+
A stable and simple way is to use a `void *` argument:
716709

717710
```c
718711
void foo(void *arg);
@@ -781,3 +774,9 @@ Notice that it is a really bad idea to use an empty enum as FFI type.
781774
The compiler relies on empty enums being uninhabited, so handling values of type
782775
`&Empty` is a huge footgun and can lead to buggy program behavior (by triggering
783776
undefined behavior).
777+
778+
> **NOTE:** The simplest way would use "extern types".
779+
But it's currently (as of June 2021) unstable and has some unresolved questions, see the [RFC page][extern-type-rfc] and the [tracking issue][extern-type-issue] for more details.
780+
781+
[extern-type-issue]: https://github.com/rust-lang/rust/issues/43467
782+
[extern-type-rfc]: https://rust-lang.github.io/rfcs/1861-extern-types.html

0 commit comments

Comments
 (0)