@@ -1612,6 +1612,9 @@ mod prim_ref {}
16121612/// pointers, make your type [`Option<fn()>`](core::option#options-and-pointers-nullable-pointers)
16131613/// with your required signature.
16141614///
1615+ /// Note that FFI requires additional care to ensure that the ABI for both sides of the call match.
1616+ /// The exact requirements are not currently documented.
1617+ ///
16151618/// ### Safety
16161619///
16171620/// Plain function pointers are obtained by casting either plain functions, or closures that don't
@@ -1750,8 +1753,13 @@ mod prim_ref {}
17501753/// is also used rarely. So, most likely you do not have to worry about ABI compatibility.
17511754///
17521755/// But assuming such circumstances, what are the rules? For this section, we are only considering
1753- /// the ABI of direct Rust-to-Rust calls, not linking in general -- once functions are imported via
1754- /// `extern` blocks, there are more things to consider that we do not go into here.
1756+ /// the ABI of direct Rust-to-Rust calls (with both definition and callsite visible to the
1757+ /// Rust compiler), not linking in general -- once functions are imported via `extern` blocks, there
1758+ /// are more things to consider that we do not go into here. Note that this also applies to
1759+ /// passing/calling functions across language boundaries via function pointers.
1760+ ///
1761+ /// **Nothing in this section should be taken as a guarantee for non-Rust-to-Rust calls, even with
1762+ /// types from `core::ffi` or `libc`**.
17551763///
17561764/// For two signatures to be considered *ABI-compatible*, they must use a compatible ABI string,
17571765/// must take the same number of arguments, the individual argument types and the return types must
0 commit comments