Use of ptr::NonNull in FFI #49220
Labels
A-FFI
Area: Foreign function interface (FFI)
C-enhancement
Category: An issue proposing an enhancement or a PR with one.
T-libs-api
Relevant to the library API team, which will review and decide on the PR/issue.
I think it would be interesting to use
ptr::NonNull
to explicitly document FFI arguments that aren't allowed to beNULL
, so that e.g.:could be an implementation for:
However,
ptr::NonNull
doesn't have#[repr(transparent)]
, so I'm not sure if that is sound. Whether it's supposed to be used this way or not, it may be worth explicitly documenting it. Currently its docs don't say anything about FFI compatibility.The text was updated successfully, but these errors were encountered: