@@ -1743,20 +1743,18 @@ mod prim_ref {}
1743
1743
/// alignment, they might be passed in different registers and hence not be ABI-compatible.
1744
1744
///
1745
1745
/// ABI compatibility as a concern only arises in code that alters the type of function pointers,
1746
- /// code that imports functions via `extern` blocks, and in code that combines `#[target_feature]`
1747
- /// with `extern fn`. Altering the type of function pointers is wildly unsafe (as in, a lot more
1748
- /// unsafe than even [`transmute_copy`][mem::transmute_copy]), and should only occur in the most
1749
- /// exceptional circumstances. Most Rust code just imports functions via `use`. `#[target_feature]`
1750
- /// is also used rarely. So, most likely you do not have to worry about ABI compatibility.
1746
+ /// and code that imports functions via `extern` blocks. Altering the type of function pointers is
1747
+ /// wildly unsafe (as in, a lot more unsafe than even [`transmute_copy`][mem::transmute_copy]), and
1748
+ /// should only occur in the most exceptional circumstances. Most Rust code just imports functions
1749
+ /// via `use`. So, most likely you do not have to worry about ABI compatibility.
1751
1750
///
1752
1751
/// But assuming such circumstances, what are the rules? For this section, we are only considering
1753
1752
/// the ABI of direct Rust-to-Rust calls, not linking in general -- once functions are imported via
1754
1753
/// `extern` blocks, there are more things to consider that we do not go into here.
1755
1754
///
1756
1755
/// For two signatures to be considered *ABI-compatible*, they must use a compatible ABI string,
1757
- /// must take the same number of arguments, the individual argument types and the return types must
1758
- /// be ABI-compatible, and the target feature requirements must be met (see the subsection below for
1759
- /// the last point). The ABI string is declared via `extern "ABI" fn(...) -> ...`; note that
1756
+ /// must take the same number of arguments, and the individual argument types and the return types
1757
+ /// must be ABI-compatible. The ABI string is declared via `extern "ABI" fn(...) -> ...`; note that
1760
1758
/// `fn name(...) -> ...` implicitly uses the `"Rust"` ABI string and `extern fn name(...) -> ...`
1761
1759
/// implicitly uses the `"C"` ABI string.
1762
1760
///
@@ -1826,24 +1824,6 @@ mod prim_ref {}
1826
1824
/// Behavior since transmuting `None::<NonZero<i32>>` to `NonZero<i32>` violates the non-zero
1827
1825
/// requirement.
1828
1826
///
1829
- /// #### Requirements concerning target features
1830
- ///
1831
- /// Under some conditions, the signature used by the caller and the callee can be ABI-incompatible
1832
- /// even if the exact same ABI string and types are being used. As an example, the
1833
- /// `std::arch::x86_64::__m256` type has a different `extern "C"` ABI when the `avx` feature is
1834
- /// enabled vs when it is not enabled.
1835
- ///
1836
- /// Therefore, to ensure ABI compatibility when code using different target features is combined
1837
- /// (such as via `#[target_feature]`), we further require that one of the following conditions is
1838
- /// met:
1839
- ///
1840
- /// - The function uses the `"Rust"` ABI string (which is the default without `extern`).
1841
- /// - Caller and callee are using the exact same set of target features. For the callee we consider
1842
- /// the features enabled (via `#[target_feature]` and `-C target-feature`/`-C target-cpu`) at the
1843
- /// declaration site; for the caller we consider the features enabled at the call site.
1844
- /// - Neither any argument nor the return value involves a SIMD type (`#[repr(simd)]`) that is not
1845
- /// behind a pointer indirection (i.e., `*mut __m256` is fine, but `(i32, __m256)` is not).
1846
- ///
1847
1827
/// ### Trait implementations
1848
1828
///
1849
1829
/// In this documentation the shorthand `fn(T₁, T₂, …, Tₙ)` is used to represent non-variadic
0 commit comments