Skip to content

Commit 044d057

Browse files
committed
add 'import functions' to the list of situations where ABI compatibility comes up
1 parent 281d8cc commit 044d057

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

library/core/src/primitive_docs.rs

+8-5
Original file line numberDiff line numberDiff line change
@@ -1515,11 +1515,14 @@ mod prim_ref {}
15151515
/// alignment, they might be passed in different registers and hence not be ABI-compatible.
15161516
///
15171517
/// ABI compatibility as a concern only arises in code that alters the type of function pointers,
1518-
/// and in code that combines `#[target_feature]` with `extern fn`. Altering the type of
1519-
/// function pointers is wildly unsafe (as in, a lot more unsafe than even
1520-
/// [`transmute_copy`][mem::transmute_copy]), and should only occur in the most exceptional
1521-
/// circumstances. `#[target_feature]` is also used rarely. But assuming such circumstances, what
1522-
/// are the rules?
1518+
/// code that imports functions via `extern` blocks, and in code that combines `#[target_feature]`
1519+
/// with `extern fn`. Altering the type of function pointers is wildly unsafe (as in, a lot more
1520+
/// unsafe than even [`transmute_copy`][mem::transmute_copy]), and should only occur in the most
1521+
/// exceptional circumstances. Most Rust code just imports functions via `use`. `#[target_feature]`
1522+
/// is also used rarely. So, most likely you do not have to worry about ABI compatibility.
1523+
///
1524+
/// But assuming such circumstances, what are the rules? For this section, we are specifically
1525+
/// concerned with the case where both the caller and the callee are defined in Rust.
15231526
///
15241527
/// For two signatures to be considered *ABI-compatible*, they must use a compatible ABI string,
15251528
/// must take the same number of arguments, the individual argument types and the return types must

0 commit comments

Comments
 (0)