Remove i128 and u128 from improper_ctypes_definitions
Rust's 128-bit integers have historically been incompatible with C [1]. However, there have been a number of changes in Rust and LLVM that mean this is no longer the case: * Incorrect alignment of `i128` on x86 [1]: adjusting Rust's alignment proposed at https://github.com/rust-lang/compiler-team/issues/683, implemented at https://github.com/rust-lang/rust/pull/116672. * LLVM version of the above: resolved in LLVM, including ABI fix. Present in LLVM18 (our minimum supported version). * Incorrect alignment of `i128` on 64-bit PowerPC, SPARC, and MIPS [2]: Rust's data layouts adjusted at https://github.com/rust-lang/rust/pull/132422, https://github.com/rust-lang/rust/pull/132741, https://github.com/rust-lang/rust/pull/134115. * LLVM version of the above: done in LLVM 20 https://github.com/llvm/llvm-project/issues/102783. * Incorrect return convention of `i128` on Windows: adjusted to match GCC and Clang at https://github.com/rust-lang/rust/pull/134290. At [3], the lang team considered it acceptable to remove `i128` from `improper_ctypes_definitions` if the LLVM version is known to be compatible. Time has elapsed since then and we have dropped support for LLVM versions that do not have the x86 fixes, meaning a per-llvm-version lint should no longer be necessary. The PowerPC, SPARC, and MIPS changes only came in LLVM 20 but since Rust's datalayouts have also been updated to match, we will be using the correct alignment regardless of LLVM version. `repr(i128)` was added to this lint in [4], but is also removed here. Part of the decision is that `i128` should match `__int128` in C on platforms that provide it, which documentation is updated to indicate. We will not guarantee that `i128` matches `_BitInt(128)` since that can be different from `__int128`. Some platforms (usually 32-bit) do not provide `__int128`; if any ABIs are extended in the future to define it, we will need to make sure that our ABI matches. Closes: https://github.com/rust-lang/rust/issues/134288 Closes: https://github.com/rust-lang/rust/issues/128950 [1]: https://github.com/rust-lang/rust/issues/54341 [2]: https://github.com/rust-lang/rust/issues/128950 [3]: https://github.com/rust-lang/lang-team/issues/255#issuecomment-2088855084 [4]: https://github.com/rust-lang/rust/pull/138282
This commit is contained in:
parent
8afd71079a
commit
0cba7fb6f6
11 changed files with 75 additions and 235 deletions
|
|
@ -374,8 +374,6 @@ lint_improper_ctypes = `extern` {$desc} uses type `{$ty}`, which is not FFI-safe
|
|||
.label = not FFI-safe
|
||||
.note = the type is defined here
|
||||
|
||||
lint_improper_ctypes_128bit = 128-bit integers don't currently have a known stable ABI
|
||||
|
||||
lint_improper_ctypes_array_help = consider passing a pointer to the array
|
||||
|
||||
lint_improper_ctypes_array_reason = passing raw arrays by value is not FFI-safe
|
||||
|
|
|
|||
|
|
@ -1,9 +1,7 @@
|
|||
use std::iter;
|
||||
use std::ops::ControlFlow;
|
||||
|
||||
use rustc_abi::{
|
||||
BackendRepr, Integer, IntegerType, TagEncoding, VariantIdx, Variants, WrappingRange,
|
||||
};
|
||||
use rustc_abi::{BackendRepr, TagEncoding, VariantIdx, Variants, WrappingRange};
|
||||
use rustc_data_structures::fx::FxHashSet;
|
||||
use rustc_errors::DiagMessage;
|
||||
use rustc_hir::intravisit::VisitorExt;
|
||||
|
|
@ -1284,14 +1282,6 @@ impl<'a, 'tcx> ImproperCTypesVisitor<'a, 'tcx> {
|
|||
};
|
||||
}
|
||||
|
||||
if let Some(IntegerType::Fixed(Integer::I128, _)) = def.repr().int {
|
||||
return FfiUnsafe {
|
||||
ty,
|
||||
reason: fluent::lint_improper_ctypes_128bit,
|
||||
help: None,
|
||||
};
|
||||
}
|
||||
|
||||
use improper_ctypes::check_non_exhaustive_variant;
|
||||
|
||||
let non_exhaustive = def.variant_list_has_applicable_non_exhaustive();
|
||||
|
|
@ -1324,10 +1314,6 @@ impl<'a, 'tcx> ImproperCTypesVisitor<'a, 'tcx> {
|
|||
// but only the base type is relevant for being representable in FFI.
|
||||
ty::Pat(base, ..) => self.check_type_for_ffi(acc, base),
|
||||
|
||||
ty::Int(ty::IntTy::I128) | ty::Uint(ty::UintTy::U128) => {
|
||||
FfiUnsafe { ty, reason: fluent::lint_improper_ctypes_128bit, help: None }
|
||||
}
|
||||
|
||||
// Primitive types with a stable representation.
|
||||
ty::Bool | ty::Int(..) | ty::Uint(..) | ty::Float(..) | ty::Never => FfiSafe,
|
||||
|
||||
|
|
|
|||
|
|
@ -1428,6 +1428,18 @@ mod prim_i64 {}
|
|||
#[rustc_doc_primitive = "i128"]
|
||||
//
|
||||
/// The 128-bit signed integer type.
|
||||
///
|
||||
/// # ABI compatibility
|
||||
///
|
||||
/// Rust's `i128` is expected to be ABI-compatible with C's `__int128` on platforms where the type
|
||||
/// is available, which includes most 64-bit architectures. If any platforms that do not specify
|
||||
/// `__int128` are updated to introduce it, the Rust `i128` ABI on relevant targets will be changed
|
||||
/// to match.
|
||||
///
|
||||
/// It is important to note that in C, `__int128` is _not_ the same as `_BitInt(128)`, and the two
|
||||
/// types are allowed to have different ABIs. In particular, on x86, `__int128` and `_BitInt(128)`
|
||||
/// do not use the same alignment. `i128` is intended to always match `__int128` and does not
|
||||
/// attempt to match `_BitInt(128)` on platforms without `__int128`.
|
||||
#[stable(feature = "i128", since = "1.26.0")]
|
||||
mod prim_i128 {}
|
||||
|
||||
|
|
@ -1458,6 +1470,8 @@ mod prim_u64 {}
|
|||
#[rustc_doc_primitive = "u128"]
|
||||
//
|
||||
/// The 128-bit unsigned integer type.
|
||||
///
|
||||
/// Please see [the documentation for `i128`](prim@i128) for information on ABI compatibility.
|
||||
#[stable(feature = "i128", since = "1.26.0")]
|
||||
mod prim_u128 {}
|
||||
|
||||
|
|
|
|||
|
|
@ -7,6 +7,5 @@ use std::arch::naked_asm;
|
|||
#[unsafe(naked)]
|
||||
pub extern "C" fn naked(p: char) -> u128 {
|
||||
//~^ WARN uses type `char`
|
||||
//~| WARN uses type `u128`
|
||||
naked_asm!("")
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,13 +8,5 @@ LL | pub extern "C" fn naked(p: char) -> u128 {
|
|||
= note: the `char` type has no C equivalent
|
||||
= note: `#[warn(improper_ctypes_definitions)]` on by default
|
||||
|
||||
warning: `extern` fn uses type `u128`, which is not FFI-safe
|
||||
--> $DIR/naked-functions-ffi.rs:8:37
|
||||
|
|
||||
LL | pub extern "C" fn naked(p: char) -> u128 {
|
||||
| ^^^^ not FFI-safe
|
||||
|
|
||||
= note: 128-bit integers don't currently have a known stable ABI
|
||||
|
||||
warning: 2 warnings emitted
|
||||
warning: 1 warning emitted
|
||||
|
||||
|
|
|
|||
|
|
@ -85,8 +85,8 @@ extern "C" {
|
|||
fn repr_c(x: ReprC);
|
||||
fn repr_u8(x: U8);
|
||||
fn repr_isize(x: Isize);
|
||||
fn repr_u128(x: U128); //~ ERROR `extern` block uses type `U128`
|
||||
fn repr_i128(x: I128); //~ ERROR `extern` block uses type `I128`
|
||||
fn repr_u128(x: U128);
|
||||
fn repr_i128(x: I128);
|
||||
fn option_ref(x: Option<&'static u8>);
|
||||
fn option_fn(x: Option<extern "C" fn()>);
|
||||
fn option_nonnull(x: Option<std::ptr::NonNull<u8>>);
|
||||
|
|
@ -96,14 +96,12 @@ extern "C" {
|
|||
fn option_nonzero_u32(x: Option<num::NonZero<u32>>);
|
||||
fn option_nonzero_u64(x: Option<num::NonZero<u64>>);
|
||||
fn option_nonzero_u128(x: Option<num::NonZero<u128>>);
|
||||
//~^ ERROR `extern` block uses type `u128`
|
||||
fn option_nonzero_usize(x: Option<num::NonZero<usize>>);
|
||||
fn option_nonzero_i8(x: Option<num::NonZero<i8>>);
|
||||
fn option_nonzero_i16(x: Option<num::NonZero<i16>>);
|
||||
fn option_nonzero_i32(x: Option<num::NonZero<i32>>);
|
||||
fn option_nonzero_i64(x: Option<num::NonZero<i64>>);
|
||||
fn option_nonzero_i128(x: Option<num::NonZero<i128>>);
|
||||
//~^ ERROR `extern` block uses type `i128`
|
||||
fn option_nonzero_isize(x: Option<num::NonZero<isize>>);
|
||||
fn option_transparent_struct(x: Option<TransparentStruct<num::NonZero<u8>>>);
|
||||
fn option_transparent_enum(x: Option<TransparentEnum<num::NonZero<u8>>>);
|
||||
|
|
@ -121,14 +119,12 @@ extern "C" {
|
|||
fn result_nonzero_u32_t(x: Result<num::NonZero<u32>, ()>);
|
||||
fn result_nonzero_u64_t(x: Result<num::NonZero<u64>, ()>);
|
||||
fn result_nonzero_u128_t(x: Result<num::NonZero<u128>, ()>);
|
||||
//~^ ERROR `extern` block uses type `u128`
|
||||
fn result_nonzero_usize_t(x: Result<num::NonZero<usize>, ()>);
|
||||
fn result_nonzero_i8_t(x: Result<num::NonZero<i8>, ()>);
|
||||
fn result_nonzero_i16_t(x: Result<num::NonZero<i16>, ()>);
|
||||
fn result_nonzero_i32_t(x: Result<num::NonZero<i32>, ()>);
|
||||
fn result_nonzero_i64_t(x: Result<num::NonZero<i64>, ()>);
|
||||
fn result_nonzero_i128_t(x: Result<num::NonZero<i128>, ()>);
|
||||
//~^ ERROR `extern` block uses type `i128`
|
||||
fn result_nonzero_isize_t(x: Result<num::NonZero<isize>, ()>);
|
||||
fn result_transparent_struct_t(x: Result<TransparentStruct<num::NonZero<u8>>, ()>);
|
||||
fn result_transparent_enum_t(x: Result<TransparentEnum<num::NonZero<u8>>, ()>);
|
||||
|
|
@ -159,14 +155,12 @@ extern "C" {
|
|||
fn result_nonzero_u32_e(x: Result<(), num::NonZero<u32>>);
|
||||
fn result_nonzero_u64_e(x: Result<(), num::NonZero<u64>>);
|
||||
fn result_nonzero_u128_e(x: Result<(), num::NonZero<u128>>);
|
||||
//~^ ERROR `extern` block uses type `u128`
|
||||
fn result_nonzero_usize_e(x: Result<(), num::NonZero<usize>>);
|
||||
fn result_nonzero_i8_e(x: Result<(), num::NonZero<i8>>);
|
||||
fn result_nonzero_i16_e(x: Result<(), num::NonZero<i16>>);
|
||||
fn result_nonzero_i32_e(x: Result<(), num::NonZero<i32>>);
|
||||
fn result_nonzero_i64_e(x: Result<(), num::NonZero<i64>>);
|
||||
fn result_nonzero_i128_e(x: Result<(), num::NonZero<i128>>);
|
||||
//~^ ERROR `extern` block uses type `i128`
|
||||
fn result_nonzero_isize_e(x: Result<(), num::NonZero<isize>>);
|
||||
fn result_transparent_struct_e(x: Result<(), TransparentStruct<num::NonZero<u8>>>);
|
||||
fn result_transparent_enum_e(x: Result<(), TransparentEnum<num::NonZero<u8>>>);
|
||||
|
|
|
|||
|
|
@ -45,50 +45,8 @@ note: the type is defined here
|
|||
LL | enum T {
|
||||
| ^^^^^^
|
||||
|
||||
error: `extern` block uses type `U128`, which is not FFI-safe
|
||||
--> $DIR/lint-ctypes-enum.rs:88:21
|
||||
|
|
||||
LL | fn repr_u128(x: U128);
|
||||
| ^^^^ not FFI-safe
|
||||
|
|
||||
= note: 128-bit integers don't currently have a known stable ABI
|
||||
note: the type is defined here
|
||||
--> $DIR/lint-ctypes-enum.rs:44:1
|
||||
|
|
||||
LL | enum U128 {
|
||||
| ^^^^^^^^^
|
||||
|
||||
error: `extern` block uses type `I128`, which is not FFI-safe
|
||||
--> $DIR/lint-ctypes-enum.rs:89:21
|
||||
|
|
||||
LL | fn repr_i128(x: I128);
|
||||
| ^^^^ not FFI-safe
|
||||
|
|
||||
= note: 128-bit integers don't currently have a known stable ABI
|
||||
note: the type is defined here
|
||||
--> $DIR/lint-ctypes-enum.rs:51:1
|
||||
|
|
||||
LL | enum I128 {
|
||||
| ^^^^^^^^^
|
||||
|
||||
error: `extern` block uses type `u128`, which is not FFI-safe
|
||||
--> $DIR/lint-ctypes-enum.rs:98:31
|
||||
|
|
||||
LL | fn option_nonzero_u128(x: Option<num::NonZero<u128>>);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
|
||||
|
|
||||
= note: 128-bit integers don't currently have a known stable ABI
|
||||
|
||||
error: `extern` block uses type `i128`, which is not FFI-safe
|
||||
--> $DIR/lint-ctypes-enum.rs:105:31
|
||||
|
|
||||
LL | fn option_nonzero_i128(x: Option<num::NonZero<i128>>);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
|
||||
|
|
||||
= note: 128-bit integers don't currently have a known stable ABI
|
||||
|
||||
error: `extern` block uses type `Option<TransparentUnion<NonZero<u8>>>`, which is not FFI-safe
|
||||
--> $DIR/lint-ctypes-enum.rs:110:36
|
||||
--> $DIR/lint-ctypes-enum.rs:108:36
|
||||
|
|
||||
LL | fn option_transparent_union(x: Option<TransparentUnion<num::NonZero<u8>>>);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
|
||||
|
|
@ -97,7 +55,7 @@ LL | fn option_transparent_union(x: Option<TransparentUnion<num::NonZero<u8>
|
|||
= note: enum has no representation hint
|
||||
|
||||
error: `extern` block uses type `Option<Rust<NonZero<u8>>>`, which is not FFI-safe
|
||||
--> $DIR/lint-ctypes-enum.rs:112:28
|
||||
--> $DIR/lint-ctypes-enum.rs:110:28
|
||||
|
|
||||
LL | fn option_repr_rust(x: Option<Rust<num::NonZero<u8>>>);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
|
||||
|
|
@ -106,7 +64,7 @@ LL | fn option_repr_rust(x: Option<Rust<num::NonZero<u8>>>);
|
|||
= note: enum has no representation hint
|
||||
|
||||
error: `extern` block uses type `Option<u8>`, which is not FFI-safe
|
||||
--> $DIR/lint-ctypes-enum.rs:113:21
|
||||
--> $DIR/lint-ctypes-enum.rs:111:21
|
||||
|
|
||||
LL | fn option_u8(x: Option<u8>);
|
||||
| ^^^^^^^^^^ not FFI-safe
|
||||
|
|
@ -114,24 +72,8 @@ LL | fn option_u8(x: Option<u8>);
|
|||
= help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum
|
||||
= note: enum has no representation hint
|
||||
|
||||
error: `extern` block uses type `u128`, which is not FFI-safe
|
||||
--> $DIR/lint-ctypes-enum.rs:123:33
|
||||
|
|
||||
LL | fn result_nonzero_u128_t(x: Result<num::NonZero<u128>, ()>);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
|
||||
|
|
||||
= note: 128-bit integers don't currently have a known stable ABI
|
||||
|
||||
error: `extern` block uses type `i128`, which is not FFI-safe
|
||||
--> $DIR/lint-ctypes-enum.rs:130:33
|
||||
|
|
||||
LL | fn result_nonzero_i128_t(x: Result<num::NonZero<i128>, ()>);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
|
||||
|
|
||||
= note: 128-bit integers don't currently have a known stable ABI
|
||||
|
||||
error: `extern` block uses type `Result<TransparentUnion<NonZero<u8>>, ()>`, which is not FFI-safe
|
||||
--> $DIR/lint-ctypes-enum.rs:135:38
|
||||
--> $DIR/lint-ctypes-enum.rs:131:38
|
||||
|
|
||||
LL | fn result_transparent_union_t(x: Result<TransparentUnion<num::NonZero<u8>>, ()>);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
|
||||
|
|
@ -140,7 +82,7 @@ LL | fn result_transparent_union_t(x: Result<TransparentUnion<num::NonZero<u
|
|||
= note: enum has no representation hint
|
||||
|
||||
error: `extern` block uses type `Result<Rust<NonZero<u8>>, ()>`, which is not FFI-safe
|
||||
--> $DIR/lint-ctypes-enum.rs:137:30
|
||||
--> $DIR/lint-ctypes-enum.rs:133:30
|
||||
|
|
||||
LL | fn result_repr_rust_t(x: Result<Rust<num::NonZero<u8>>, ()>);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
|
||||
|
|
@ -149,7 +91,7 @@ LL | fn result_repr_rust_t(x: Result<Rust<num::NonZero<u8>>, ()>);
|
|||
= note: enum has no representation hint
|
||||
|
||||
error: `extern` block uses type `Result<NonZero<u8>, U>`, which is not FFI-safe
|
||||
--> $DIR/lint-ctypes-enum.rs:141:51
|
||||
--> $DIR/lint-ctypes-enum.rs:137:51
|
||||
|
|
||||
LL | fn result_1zst_exhaustive_single_variant_t(x: Result<num::NonZero<u8>, U>);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
|
||||
|
|
@ -158,7 +100,7 @@ LL | fn result_1zst_exhaustive_single_variant_t(x: Result<num::NonZero<u8>,
|
|||
= note: enum has no representation hint
|
||||
|
||||
error: `extern` block uses type `Result<NonZero<u8>, B>`, which is not FFI-safe
|
||||
--> $DIR/lint-ctypes-enum.rs:143:53
|
||||
--> $DIR/lint-ctypes-enum.rs:139:53
|
||||
|
|
||||
LL | fn result_1zst_exhaustive_multiple_variant_t(x: Result<num::NonZero<u8>, B>);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
|
||||
|
|
@ -167,7 +109,7 @@ LL | fn result_1zst_exhaustive_multiple_variant_t(x: Result<num::NonZero<u8>
|
|||
= note: enum has no representation hint
|
||||
|
||||
error: `extern` block uses type `Result<NonZero<u8>, NonExhaustive>`, which is not FFI-safe
|
||||
--> $DIR/lint-ctypes-enum.rs:145:51
|
||||
--> $DIR/lint-ctypes-enum.rs:141:51
|
||||
|
|
||||
LL | fn result_1zst_non_exhaustive_no_variant_t(x: Result<num::NonZero<u8>, NonExhaustive>);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
|
||||
|
|
@ -176,7 +118,7 @@ LL | fn result_1zst_non_exhaustive_no_variant_t(x: Result<num::NonZero<u8>,
|
|||
= note: enum has no representation hint
|
||||
|
||||
error: `extern` block uses type `Result<NonZero<u8>, Field>`, which is not FFI-safe
|
||||
--> $DIR/lint-ctypes-enum.rs:148:49
|
||||
--> $DIR/lint-ctypes-enum.rs:144:49
|
||||
|
|
||||
LL | fn result_1zst_exhaustive_single_field_t(x: Result<num::NonZero<u8>, Field>);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
|
||||
|
|
@ -185,7 +127,7 @@ LL | fn result_1zst_exhaustive_single_field_t(x: Result<num::NonZero<u8>, Fi
|
|||
= note: enum has no representation hint
|
||||
|
||||
error: `extern` block uses type `Result<Result<(), NonZero<u8>>, ()>`, which is not FFI-safe
|
||||
--> $DIR/lint-ctypes-enum.rs:150:30
|
||||
--> $DIR/lint-ctypes-enum.rs:146:30
|
||||
|
|
||||
LL | fn result_cascading_t(x: Result<Result<(), num::NonZero<u8>>, ()>);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
|
||||
|
|
@ -193,24 +135,8 @@ LL | fn result_cascading_t(x: Result<Result<(), num::NonZero<u8>>, ()>);
|
|||
= help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum
|
||||
= note: enum has no representation hint
|
||||
|
||||
error: `extern` block uses type `u128`, which is not FFI-safe
|
||||
--> $DIR/lint-ctypes-enum.rs:161:33
|
||||
|
|
||||
LL | fn result_nonzero_u128_e(x: Result<(), num::NonZero<u128>>);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
|
||||
|
|
||||
= note: 128-bit integers don't currently have a known stable ABI
|
||||
|
||||
error: `extern` block uses type `i128`, which is not FFI-safe
|
||||
--> $DIR/lint-ctypes-enum.rs:168:33
|
||||
|
|
||||
LL | fn result_nonzero_i128_e(x: Result<(), num::NonZero<i128>>);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
|
||||
|
|
||||
= note: 128-bit integers don't currently have a known stable ABI
|
||||
|
||||
error: `extern` block uses type `Result<(), TransparentUnion<NonZero<u8>>>`, which is not FFI-safe
|
||||
--> $DIR/lint-ctypes-enum.rs:173:38
|
||||
--> $DIR/lint-ctypes-enum.rs:167:38
|
||||
|
|
||||
LL | fn result_transparent_union_e(x: Result<(), TransparentUnion<num::NonZero<u8>>>);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
|
||||
|
|
@ -219,7 +145,7 @@ LL | fn result_transparent_union_e(x: Result<(), TransparentUnion<num::NonZe
|
|||
= note: enum has no representation hint
|
||||
|
||||
error: `extern` block uses type `Result<(), Rust<NonZero<u8>>>`, which is not FFI-safe
|
||||
--> $DIR/lint-ctypes-enum.rs:175:30
|
||||
--> $DIR/lint-ctypes-enum.rs:169:30
|
||||
|
|
||||
LL | fn result_repr_rust_e(x: Result<(), Rust<num::NonZero<u8>>>);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
|
||||
|
|
@ -228,7 +154,7 @@ LL | fn result_repr_rust_e(x: Result<(), Rust<num::NonZero<u8>>>);
|
|||
= note: enum has no representation hint
|
||||
|
||||
error: `extern` block uses type `Result<U, NonZero<u8>>`, which is not FFI-safe
|
||||
--> $DIR/lint-ctypes-enum.rs:179:51
|
||||
--> $DIR/lint-ctypes-enum.rs:173:51
|
||||
|
|
||||
LL | fn result_1zst_exhaustive_single_variant_e(x: Result<U, num::NonZero<u8>>);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
|
||||
|
|
@ -237,7 +163,7 @@ LL | fn result_1zst_exhaustive_single_variant_e(x: Result<U, num::NonZero<u8
|
|||
= note: enum has no representation hint
|
||||
|
||||
error: `extern` block uses type `Result<B, NonZero<u8>>`, which is not FFI-safe
|
||||
--> $DIR/lint-ctypes-enum.rs:181:53
|
||||
--> $DIR/lint-ctypes-enum.rs:175:53
|
||||
|
|
||||
LL | fn result_1zst_exhaustive_multiple_variant_e(x: Result<B, num::NonZero<u8>>);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
|
||||
|
|
@ -246,7 +172,7 @@ LL | fn result_1zst_exhaustive_multiple_variant_e(x: Result<B, num::NonZero<
|
|||
= note: enum has no representation hint
|
||||
|
||||
error: `extern` block uses type `Result<NonExhaustive, NonZero<u8>>`, which is not FFI-safe
|
||||
--> $DIR/lint-ctypes-enum.rs:183:51
|
||||
--> $DIR/lint-ctypes-enum.rs:177:51
|
||||
|
|
||||
LL | fn result_1zst_non_exhaustive_no_variant_e(x: Result<NonExhaustive, num::NonZero<u8>>);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
|
||||
|
|
@ -255,7 +181,7 @@ LL | fn result_1zst_non_exhaustive_no_variant_e(x: Result<NonExhaustive, num
|
|||
= note: enum has no representation hint
|
||||
|
||||
error: `extern` block uses type `Result<Field, NonZero<u8>>`, which is not FFI-safe
|
||||
--> $DIR/lint-ctypes-enum.rs:186:49
|
||||
--> $DIR/lint-ctypes-enum.rs:180:49
|
||||
|
|
||||
LL | fn result_1zst_exhaustive_single_field_e(x: Result<Field, num::NonZero<u8>>);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
|
||||
|
|
@ -264,7 +190,7 @@ LL | fn result_1zst_exhaustive_single_field_e(x: Result<Field, num::NonZero<
|
|||
= note: enum has no representation hint
|
||||
|
||||
error: `extern` block uses type `Result<(), Result<(), NonZero<u8>>>`, which is not FFI-safe
|
||||
--> $DIR/lint-ctypes-enum.rs:188:30
|
||||
--> $DIR/lint-ctypes-enum.rs:182:30
|
||||
|
|
||||
LL | fn result_cascading_e(x: Result<(), Result<(), num::NonZero<u8>>>);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
|
||||
|
|
@ -273,7 +199,7 @@ LL | fn result_cascading_e(x: Result<(), Result<(), num::NonZero<u8>>>);
|
|||
= note: enum has no representation hint
|
||||
|
||||
error: `extern` block uses type `Result<(), ()>`, which is not FFI-safe
|
||||
--> $DIR/lint-ctypes-enum.rs:190:27
|
||||
--> $DIR/lint-ctypes-enum.rs:184:27
|
||||
|
|
||||
LL | fn result_unit_t_e(x: Result<(), ()>);
|
||||
| ^^^^^^^^^^^^^^ not FFI-safe
|
||||
|
|
@ -281,5 +207,5 @@ LL | fn result_unit_t_e(x: Result<(), ()>);
|
|||
= help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum
|
||||
= note: enum has no representation hint
|
||||
|
||||
error: aborting due to 29 previous errors
|
||||
error: aborting due to 21 previous errors
|
||||
|
||||
|
|
|
|||
|
|
@ -89,12 +89,6 @@ pub extern "C" fn boxed_trait(p: Box<dyn Trait>) { }
|
|||
pub extern "C" fn char_type(p: char) { }
|
||||
//~^ ERROR uses type `char`
|
||||
|
||||
pub extern "C" fn i128_type(p: i128) { }
|
||||
//~^ ERROR uses type `i128`
|
||||
|
||||
pub extern "C" fn u128_type(p: u128) { }
|
||||
//~^ ERROR uses type `u128`
|
||||
|
||||
pub extern "C" fn tuple_type(p: (i32, i32)) { }
|
||||
//~^ ERROR uses type `(i32, i32)`
|
||||
|
||||
|
|
@ -120,9 +114,6 @@ pub extern "C" fn fn_type2(p: fn()) { }
|
|||
|
||||
pub extern "C" fn fn_contained(p: RustBadRet) { }
|
||||
|
||||
pub extern "C" fn transparent_i128(p: TransparentI128) { }
|
||||
//~^ ERROR: uses type `i128`
|
||||
|
||||
pub extern "C" fn transparent_str(p: TransparentStr) { }
|
||||
//~^ ERROR: uses type `str`
|
||||
|
||||
|
|
@ -161,6 +152,12 @@ pub extern "C" fn good17(p: TransparentCustomZst) { }
|
|||
#[allow(improper_ctypes_definitions)]
|
||||
pub extern "C" fn good18(_: &String) { }
|
||||
|
||||
pub extern "C" fn good_i128_type(p: i128) { }
|
||||
|
||||
pub extern "C" fn good_u128_type(p: u128) { }
|
||||
|
||||
pub extern "C" fn good_transparent_i128(p: TransparentI128) { }
|
||||
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
pub extern "C" fn good1(size: *const c_int) { }
|
||||
|
||||
|
|
|
|||
|
|
@ -54,24 +54,8 @@ LL | pub extern "C" fn char_type(p: char) { }
|
|||
= help: consider using `u32` or `libc::wchar_t` instead
|
||||
= note: the `char` type has no C equivalent
|
||||
|
||||
error: `extern` fn uses type `i128`, which is not FFI-safe
|
||||
--> $DIR/lint-ctypes-fn.rs:92:32
|
||||
|
|
||||
LL | pub extern "C" fn i128_type(p: i128) { }
|
||||
| ^^^^ not FFI-safe
|
||||
|
|
||||
= note: 128-bit integers don't currently have a known stable ABI
|
||||
|
||||
error: `extern` fn uses type `u128`, which is not FFI-safe
|
||||
--> $DIR/lint-ctypes-fn.rs:95:32
|
||||
|
|
||||
LL | pub extern "C" fn u128_type(p: u128) { }
|
||||
| ^^^^ not FFI-safe
|
||||
|
|
||||
= note: 128-bit integers don't currently have a known stable ABI
|
||||
|
||||
error: `extern` fn uses type `(i32, i32)`, which is not FFI-safe
|
||||
--> $DIR/lint-ctypes-fn.rs:98:33
|
||||
--> $DIR/lint-ctypes-fn.rs:92:33
|
||||
|
|
||||
LL | pub extern "C" fn tuple_type(p: (i32, i32)) { }
|
||||
| ^^^^^^^^^^ not FFI-safe
|
||||
|
|
@ -80,7 +64,7 @@ LL | pub extern "C" fn tuple_type(p: (i32, i32)) { }
|
|||
= note: tuples have unspecified layout
|
||||
|
||||
error: `extern` fn uses type `(i32, i32)`, which is not FFI-safe
|
||||
--> $DIR/lint-ctypes-fn.rs:101:34
|
||||
--> $DIR/lint-ctypes-fn.rs:95:34
|
||||
|
|
||||
LL | pub extern "C" fn tuple_type2(p: I32Pair) { }
|
||||
| ^^^^^^^ not FFI-safe
|
||||
|
|
@ -89,7 +73,7 @@ LL | pub extern "C" fn tuple_type2(p: I32Pair) { }
|
|||
= note: tuples have unspecified layout
|
||||
|
||||
error: `extern` fn uses type `ZeroSize`, which is not FFI-safe
|
||||
--> $DIR/lint-ctypes-fn.rs:104:32
|
||||
--> $DIR/lint-ctypes-fn.rs:98:32
|
||||
|
|
||||
LL | pub extern "C" fn zero_size(p: ZeroSize) { }
|
||||
| ^^^^^^^^ not FFI-safe
|
||||
|
|
@ -103,7 +87,7 @@ LL | pub struct ZeroSize;
|
|||
| ^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: `extern` fn uses type `ZeroSizeWithPhantomData`, which is not FFI-safe
|
||||
--> $DIR/lint-ctypes-fn.rs:107:40
|
||||
--> $DIR/lint-ctypes-fn.rs:101:40
|
||||
|
|
||||
LL | pub extern "C" fn zero_size_phantom(p: ZeroSizeWithPhantomData) { }
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
|
||||
|
|
@ -116,7 +100,7 @@ LL | pub struct ZeroSizeWithPhantomData(PhantomData<i32>);
|
|||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: `extern` fn uses type `PhantomData<bool>`, which is not FFI-safe
|
||||
--> $DIR/lint-ctypes-fn.rs:110:51
|
||||
--> $DIR/lint-ctypes-fn.rs:104:51
|
||||
|
|
||||
LL | pub extern "C" fn zero_size_phantom_toplevel() -> PhantomData<bool> {
|
||||
| ^^^^^^^^^^^^^^^^^ not FFI-safe
|
||||
|
|
@ -124,7 +108,7 @@ LL | pub extern "C" fn zero_size_phantom_toplevel() -> PhantomData<bool> {
|
|||
= note: composed only of `PhantomData`
|
||||
|
||||
error: `extern` fn uses type `fn()`, which is not FFI-safe
|
||||
--> $DIR/lint-ctypes-fn.rs:115:30
|
||||
--> $DIR/lint-ctypes-fn.rs:109:30
|
||||
|
|
||||
LL | pub extern "C" fn fn_type(p: RustFn) { }
|
||||
| ^^^^^^ not FFI-safe
|
||||
|
|
@ -133,7 +117,7 @@ LL | pub extern "C" fn fn_type(p: RustFn) { }
|
|||
= note: this function pointer has Rust-specific calling convention
|
||||
|
||||
error: `extern` fn uses type `fn()`, which is not FFI-safe
|
||||
--> $DIR/lint-ctypes-fn.rs:118:31
|
||||
--> $DIR/lint-ctypes-fn.rs:112:31
|
||||
|
|
||||
LL | pub extern "C" fn fn_type2(p: fn()) { }
|
||||
| ^^^^ not FFI-safe
|
||||
|
|
@ -141,16 +125,8 @@ LL | pub extern "C" fn fn_type2(p: fn()) { }
|
|||
= help: consider using an `extern fn(...) -> ...` function pointer instead
|
||||
= note: this function pointer has Rust-specific calling convention
|
||||
|
||||
error: `extern` fn uses type `i128`, which is not FFI-safe
|
||||
--> $DIR/lint-ctypes-fn.rs:123:39
|
||||
|
|
||||
LL | pub extern "C" fn transparent_i128(p: TransparentI128) { }
|
||||
| ^^^^^^^^^^^^^^^ not FFI-safe
|
||||
|
|
||||
= note: 128-bit integers don't currently have a known stable ABI
|
||||
|
||||
error: `extern` fn uses type `str`, which is not FFI-safe
|
||||
--> $DIR/lint-ctypes-fn.rs:126:38
|
||||
--> $DIR/lint-ctypes-fn.rs:117:38
|
||||
|
|
||||
LL | pub extern "C" fn transparent_str(p: TransparentStr) { }
|
||||
| ^^^^^^^^^^^^^^ not FFI-safe
|
||||
|
|
@ -159,7 +135,7 @@ LL | pub extern "C" fn transparent_str(p: TransparentStr) { }
|
|||
= note: string slices have no C equivalent
|
||||
|
||||
error: `extern` fn uses type `PhantomData<bool>`, which is not FFI-safe
|
||||
--> $DIR/lint-ctypes-fn.rs:172:43
|
||||
--> $DIR/lint-ctypes-fn.rs:169:43
|
||||
|
|
||||
LL | pub extern "C" fn unused_generic2<T>() -> PhantomData<bool> {
|
||||
| ^^^^^^^^^^^^^^^^^ not FFI-safe
|
||||
|
|
@ -167,7 +143,7 @@ LL | pub extern "C" fn unused_generic2<T>() -> PhantomData<bool> {
|
|||
= note: composed only of `PhantomData`
|
||||
|
||||
error: `extern` fn uses type `Vec<T>`, which is not FFI-safe
|
||||
--> $DIR/lint-ctypes-fn.rs:185:39
|
||||
--> $DIR/lint-ctypes-fn.rs:182:39
|
||||
|
|
||||
LL | pub extern "C" fn used_generic4<T>(x: Vec<T>) { }
|
||||
| ^^^^^^ not FFI-safe
|
||||
|
|
@ -176,7 +152,7 @@ LL | pub extern "C" fn used_generic4<T>(x: Vec<T>) { }
|
|||
= note: this struct has unspecified layout
|
||||
|
||||
error: `extern` fn uses type `Vec<T>`, which is not FFI-safe
|
||||
--> $DIR/lint-ctypes-fn.rs:188:41
|
||||
--> $DIR/lint-ctypes-fn.rs:185:41
|
||||
|
|
||||
LL | pub extern "C" fn used_generic5<T>() -> Vec<T> {
|
||||
| ^^^^^^ not FFI-safe
|
||||
|
|
@ -184,5 +160,5 @@ LL | pub extern "C" fn used_generic5<T>() -> Vec<T> {
|
|||
= help: consider adding a `#[repr(C)]` or `#[repr(transparent)]` attribute to this struct
|
||||
= note: this struct has unspecified layout
|
||||
|
||||
error: aborting due to 20 previous errors
|
||||
error: aborting due to 17 previous errors
|
||||
|
||||
|
|
|
|||
|
|
@ -54,8 +54,6 @@ extern "C" {
|
|||
pub fn opt_box_type(p: Option<Box<u32>>);
|
||||
//~^ ERROR uses type `Option<Box<u32>>`
|
||||
pub fn char_type(p: char); //~ ERROR uses type `char`
|
||||
pub fn i128_type(p: i128); //~ ERROR uses type `i128`
|
||||
pub fn u128_type(p: u128); //~ ERROR uses type `u128`
|
||||
pub fn trait_type(p: &dyn Bar); //~ ERROR uses type `dyn Bar`
|
||||
pub fn tuple_type(p: (i32, i32)); //~ ERROR uses type `(i32, i32)`
|
||||
pub fn tuple_type2(p: I32Pair); //~ ERROR uses type `(i32, i32)`
|
||||
|
|
@ -67,7 +65,6 @@ extern "C" {
|
|||
pub fn fn_type(p: RustFn); //~ ERROR uses type `fn()`
|
||||
pub fn fn_type2(p: fn()); //~ ERROR uses type `fn()`
|
||||
pub fn fn_contained(p: RustBadRet); //~ ERROR: uses type `Box<u32>`
|
||||
pub fn transparent_i128(p: TransparentI128); //~ ERROR: uses type `i128`
|
||||
pub fn transparent_str(p: TransparentStr); //~ ERROR: uses type `str`
|
||||
pub fn transparent_fn(p: TransparentBadFn); //~ ERROR: uses type `Box<u32>`
|
||||
pub fn raw_array(arr: [u8; 8]); //~ ERROR: uses type `[u8; 8]`
|
||||
|
|
@ -77,9 +74,6 @@ extern "C" {
|
|||
pub fn no_niche_b(b: Option<UnsafeCell<&i32>>);
|
||||
//~^ ERROR: uses type `Option<UnsafeCell<&i32>>`
|
||||
|
||||
pub static static_u128_type: u128; //~ ERROR: uses type `u128`
|
||||
pub static static_u128_array_type: [u128; 16]; //~ ERROR: uses type `u128`
|
||||
|
||||
pub fn good3(fptr: Option<extern "C" fn()>);
|
||||
pub fn good4(aptr: &[u8; 4 as usize]);
|
||||
pub fn good5(s: StructWithProjection);
|
||||
|
|
@ -99,7 +93,11 @@ extern "C" {
|
|||
pub fn good18(_: &String);
|
||||
pub fn good20(arr: *const [u8; 8]);
|
||||
pub static good21: [u8; 8];
|
||||
|
||||
pub fn good_i128_type(p: i128);
|
||||
pub fn good_u128_type(p: u128);
|
||||
pub fn good_transparent_i128(p: TransparentI128);
|
||||
pub static good_static_u128_type: u128;
|
||||
pub static good_static_u128_array_type: [u128; 16];
|
||||
}
|
||||
|
||||
#[allow(improper_ctypes)]
|
||||
|
|
|
|||
|
|
@ -85,24 +85,8 @@ LL | pub fn char_type(p: char);
|
|||
= help: consider using `u32` or `libc::wchar_t` instead
|
||||
= note: the `char` type has no C equivalent
|
||||
|
||||
error: `extern` block uses type `i128`, which is not FFI-safe
|
||||
--> $DIR/lint-ctypes.rs:57:25
|
||||
|
|
||||
LL | pub fn i128_type(p: i128);
|
||||
| ^^^^ not FFI-safe
|
||||
|
|
||||
= note: 128-bit integers don't currently have a known stable ABI
|
||||
|
||||
error: `extern` block uses type `u128`, which is not FFI-safe
|
||||
--> $DIR/lint-ctypes.rs:58:25
|
||||
|
|
||||
LL | pub fn u128_type(p: u128);
|
||||
| ^^^^ not FFI-safe
|
||||
|
|
||||
= note: 128-bit integers don't currently have a known stable ABI
|
||||
|
||||
error: `extern` block uses type `dyn Bar`, which is not FFI-safe
|
||||
--> $DIR/lint-ctypes.rs:59:26
|
||||
--> $DIR/lint-ctypes.rs:57:26
|
||||
|
|
||||
LL | pub fn trait_type(p: &dyn Bar);
|
||||
| ^^^^^^^^ not FFI-safe
|
||||
|
|
@ -110,7 +94,7 @@ LL | pub fn trait_type(p: &dyn Bar);
|
|||
= note: trait objects have no C equivalent
|
||||
|
||||
error: `extern` block uses type `(i32, i32)`, which is not FFI-safe
|
||||
--> $DIR/lint-ctypes.rs:60:26
|
||||
--> $DIR/lint-ctypes.rs:58:26
|
||||
|
|
||||
LL | pub fn tuple_type(p: (i32, i32));
|
||||
| ^^^^^^^^^^ not FFI-safe
|
||||
|
|
@ -119,7 +103,7 @@ LL | pub fn tuple_type(p: (i32, i32));
|
|||
= note: tuples have unspecified layout
|
||||
|
||||
error: `extern` block uses type `(i32, i32)`, which is not FFI-safe
|
||||
--> $DIR/lint-ctypes.rs:61:27
|
||||
--> $DIR/lint-ctypes.rs:59:27
|
||||
|
|
||||
LL | pub fn tuple_type2(p: I32Pair);
|
||||
| ^^^^^^^ not FFI-safe
|
||||
|
|
@ -128,7 +112,7 @@ LL | pub fn tuple_type2(p: I32Pair);
|
|||
= note: tuples have unspecified layout
|
||||
|
||||
error: `extern` block uses type `ZeroSize`, which is not FFI-safe
|
||||
--> $DIR/lint-ctypes.rs:62:25
|
||||
--> $DIR/lint-ctypes.rs:60:25
|
||||
|
|
||||
LL | pub fn zero_size(p: ZeroSize);
|
||||
| ^^^^^^^^ not FFI-safe
|
||||
|
|
@ -142,7 +126,7 @@ LL | pub struct ZeroSize;
|
|||
| ^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: `extern` block uses type `ZeroSizeWithPhantomData`, which is not FFI-safe
|
||||
--> $DIR/lint-ctypes.rs:63:33
|
||||
--> $DIR/lint-ctypes.rs:61:33
|
||||
|
|
||||
LL | pub fn zero_size_phantom(p: ZeroSizeWithPhantomData);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
|
||||
|
|
@ -155,7 +139,7 @@ LL | pub struct ZeroSizeWithPhantomData(::std::marker::PhantomData<i32>);
|
|||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: `extern` block uses type `PhantomData<bool>`, which is not FFI-safe
|
||||
--> $DIR/lint-ctypes.rs:66:12
|
||||
--> $DIR/lint-ctypes.rs:64:12
|
||||
|
|
||||
LL | -> ::std::marker::PhantomData<bool>;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
|
||||
|
|
@ -163,7 +147,7 @@ LL | -> ::std::marker::PhantomData<bool>;
|
|||
= note: composed only of `PhantomData`
|
||||
|
||||
error: `extern` block uses type `fn()`, which is not FFI-safe
|
||||
--> $DIR/lint-ctypes.rs:67:23
|
||||
--> $DIR/lint-ctypes.rs:65:23
|
||||
|
|
||||
LL | pub fn fn_type(p: RustFn);
|
||||
| ^^^^^^ not FFI-safe
|
||||
|
|
@ -172,7 +156,7 @@ LL | pub fn fn_type(p: RustFn);
|
|||
= note: this function pointer has Rust-specific calling convention
|
||||
|
||||
error: `extern` block uses type `fn()`, which is not FFI-safe
|
||||
--> $DIR/lint-ctypes.rs:68:24
|
||||
--> $DIR/lint-ctypes.rs:66:24
|
||||
|
|
||||
LL | pub fn fn_type2(p: fn());
|
||||
| ^^^^ not FFI-safe
|
||||
|
|
@ -181,7 +165,7 @@ LL | pub fn fn_type2(p: fn());
|
|||
= note: this function pointer has Rust-specific calling convention
|
||||
|
||||
error: `extern` block uses type `Box<u32>`, which is not FFI-safe
|
||||
--> $DIR/lint-ctypes.rs:69:28
|
||||
--> $DIR/lint-ctypes.rs:67:28
|
||||
|
|
||||
LL | pub fn fn_contained(p: RustBadRet);
|
||||
| ^^^^^^^^^^ not FFI-safe
|
||||
|
|
@ -189,16 +173,8 @@ LL | pub fn fn_contained(p: RustBadRet);
|
|||
= help: consider adding a `#[repr(C)]` or `#[repr(transparent)]` attribute to this struct
|
||||
= note: this struct has unspecified layout
|
||||
|
||||
error: `extern` block uses type `i128`, which is not FFI-safe
|
||||
--> $DIR/lint-ctypes.rs:70:32
|
||||
|
|
||||
LL | pub fn transparent_i128(p: TransparentI128);
|
||||
| ^^^^^^^^^^^^^^^ not FFI-safe
|
||||
|
|
||||
= note: 128-bit integers don't currently have a known stable ABI
|
||||
|
||||
error: `extern` block uses type `str`, which is not FFI-safe
|
||||
--> $DIR/lint-ctypes.rs:71:31
|
||||
--> $DIR/lint-ctypes.rs:68:31
|
||||
|
|
||||
LL | pub fn transparent_str(p: TransparentStr);
|
||||
| ^^^^^^^^^^^^^^ not FFI-safe
|
||||
|
|
@ -207,7 +183,7 @@ LL | pub fn transparent_str(p: TransparentStr);
|
|||
= note: string slices have no C equivalent
|
||||
|
||||
error: `extern` block uses type `Box<u32>`, which is not FFI-safe
|
||||
--> $DIR/lint-ctypes.rs:72:30
|
||||
--> $DIR/lint-ctypes.rs:69:30
|
||||
|
|
||||
LL | pub fn transparent_fn(p: TransparentBadFn);
|
||||
| ^^^^^^^^^^^^^^^^ not FFI-safe
|
||||
|
|
@ -216,7 +192,7 @@ LL | pub fn transparent_fn(p: TransparentBadFn);
|
|||
= note: this struct has unspecified layout
|
||||
|
||||
error: `extern` block uses type `[u8; 8]`, which is not FFI-safe
|
||||
--> $DIR/lint-ctypes.rs:73:27
|
||||
--> $DIR/lint-ctypes.rs:70:27
|
||||
|
|
||||
LL | pub fn raw_array(arr: [u8; 8]);
|
||||
| ^^^^^^^ not FFI-safe
|
||||
|
|
@ -225,7 +201,7 @@ LL | pub fn raw_array(arr: [u8; 8]);
|
|||
= note: passing raw arrays by value is not FFI-safe
|
||||
|
||||
error: `extern` block uses type `Option<UnsafeCell<extern "C" fn()>>`, which is not FFI-safe
|
||||
--> $DIR/lint-ctypes.rs:75:26
|
||||
--> $DIR/lint-ctypes.rs:72:26
|
||||
|
|
||||
LL | pub fn no_niche_a(a: Option<UnsafeCell<extern "C" fn()>>);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
|
||||
|
|
@ -234,7 +210,7 @@ LL | pub fn no_niche_a(a: Option<UnsafeCell<extern "C" fn()>>);
|
|||
= note: enum has no representation hint
|
||||
|
||||
error: `extern` block uses type `Option<UnsafeCell<&i32>>`, which is not FFI-safe
|
||||
--> $DIR/lint-ctypes.rs:77:26
|
||||
--> $DIR/lint-ctypes.rs:74:26
|
||||
|
|
||||
LL | pub fn no_niche_b(b: Option<UnsafeCell<&i32>>);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
|
||||
|
|
@ -242,21 +218,5 @@ LL | pub fn no_niche_b(b: Option<UnsafeCell<&i32>>);
|
|||
= help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum
|
||||
= note: enum has no representation hint
|
||||
|
||||
error: `extern` block uses type `u128`, which is not FFI-safe
|
||||
--> $DIR/lint-ctypes.rs:80:34
|
||||
|
|
||||
LL | pub static static_u128_type: u128;
|
||||
| ^^^^ not FFI-safe
|
||||
|
|
||||
= note: 128-bit integers don't currently have a known stable ABI
|
||||
|
||||
error: `extern` block uses type `u128`, which is not FFI-safe
|
||||
--> $DIR/lint-ctypes.rs:81:40
|
||||
|
|
||||
LL | pub static static_u128_array_type: [u128; 16];
|
||||
| ^^^^^^^^^^ not FFI-safe
|
||||
|
|
||||
= note: 128-bit integers don't currently have a known stable ABI
|
||||
|
||||
error: aborting due to 27 previous errors
|
||||
error: aborting due to 22 previous errors
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue