mirror of https://github.com/rust-lang/rust
263 lines
9.0 KiB
Plaintext
263 lines
9.0 KiB
Plaintext
error: `extern` block uses type `Foo`, which is not FFI-safe
|
|
--> $DIR/lint-ctypes.rs:47:28
|
|
|
|
|
LL | pub fn ptr_type1(size: *const Foo);
|
|
| ^^^^^^^^^^ not FFI-safe
|
|
|
|
|
= help: consider adding a `#[repr(C)]` or `#[repr(transparent)]` attribute to this struct
|
|
= note: this struct has unspecified layout
|
|
note: the type is defined here
|
|
--> $DIR/lint-ctypes.rs:25:1
|
|
|
|
|
LL | pub struct Foo;
|
|
| ^^^^^^^^^^^^^^
|
|
note: the lint level is defined here
|
|
--> $DIR/lint-ctypes.rs:4:9
|
|
|
|
|
LL | #![deny(improper_ctypes)]
|
|
| ^^^^^^^^^^^^^^^
|
|
|
|
error: `extern` block uses type `Foo`, which is not FFI-safe
|
|
--> $DIR/lint-ctypes.rs:48:28
|
|
|
|
|
LL | pub fn ptr_type2(size: *const Foo);
|
|
| ^^^^^^^^^^ not FFI-safe
|
|
|
|
|
= help: consider adding a `#[repr(C)]` or `#[repr(transparent)]` attribute to this struct
|
|
= note: this struct has unspecified layout
|
|
note: the type is defined here
|
|
--> $DIR/lint-ctypes.rs:25:1
|
|
|
|
|
LL | pub struct Foo;
|
|
| ^^^^^^^^^^^^^^
|
|
|
|
error: `extern` block uses type `((),)`, which is not FFI-safe
|
|
--> $DIR/lint-ctypes.rs:50:25
|
|
|
|
|
LL | pub fn ptr_tuple(p: *const ((),));
|
|
| ^^^^^^^^^^^^ not FFI-safe
|
|
|
|
|
= help: consider using a struct instead
|
|
= note: tuples have unspecified layout
|
|
|
|
error: `extern` block uses type `[u32]`, which is not FFI-safe
|
|
--> $DIR/lint-ctypes.rs:51:26
|
|
|
|
|
LL | pub fn slice_type(p: &[u32]);
|
|
| ^^^^^^ not FFI-safe
|
|
|
|
|
= help: consider using a raw pointer instead
|
|
= note: slices have no C equivalent
|
|
|
|
error: `extern` block uses type `str`, which is not FFI-safe
|
|
--> $DIR/lint-ctypes.rs:52:24
|
|
|
|
|
LL | pub fn str_type(p: &str);
|
|
| ^^^^ not FFI-safe
|
|
|
|
|
= help: consider using `*const u8` and a length instead
|
|
= note: string slices have no C equivalent
|
|
|
|
error: `extern` block uses type `Box<u32>`, which is not FFI-safe
|
|
--> $DIR/lint-ctypes.rs:53:24
|
|
|
|
|
LL | pub fn box_type(p: Box<u32>);
|
|
| ^^^^^^^^ not FFI-safe
|
|
|
|
|
= help: consider adding a `#[repr(C)]` or `#[repr(transparent)]` attribute to this struct
|
|
= note: this struct has unspecified layout
|
|
|
|
error: `extern` block uses type `Option<Box<u32>>`, which is not FFI-safe
|
|
--> $DIR/lint-ctypes.rs:54:28
|
|
|
|
|
LL | pub fn opt_box_type(p: Option<Box<u32>>);
|
|
| ^^^^^^^^^^^^^^^^ not FFI-safe
|
|
|
|
|
= 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 `char`, which is not FFI-safe
|
|
--> $DIR/lint-ctypes.rs:56:25
|
|
|
|
|
LL | pub fn char_type(p: char);
|
|
| ^^^^ not FFI-safe
|
|
|
|
|
= 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
|
|
|
|
|
LL | pub fn trait_type(p: &dyn Bar);
|
|
| ^^^^^^^^ not FFI-safe
|
|
|
|
|
= 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
|
|
|
|
|
LL | pub fn tuple_type(p: (i32, i32));
|
|
| ^^^^^^^^^^ not FFI-safe
|
|
|
|
|
= help: consider using a struct instead
|
|
= note: tuples have unspecified layout
|
|
|
|
error: `extern` block uses type `(i32, i32)`, which is not FFI-safe
|
|
--> $DIR/lint-ctypes.rs:61:27
|
|
|
|
|
LL | pub fn tuple_type2(p: I32Pair);
|
|
| ^^^^^^^ not FFI-safe
|
|
|
|
|
= help: consider using a struct instead
|
|
= note: tuples have unspecified layout
|
|
|
|
error: `extern` block uses type `ZeroSize`, which is not FFI-safe
|
|
--> $DIR/lint-ctypes.rs:62:25
|
|
|
|
|
LL | pub fn zero_size(p: ZeroSize);
|
|
| ^^^^^^^^ not FFI-safe
|
|
|
|
|
= help: consider adding a member to this struct
|
|
= note: this struct has no fields
|
|
note: the type is defined here
|
|
--> $DIR/lint-ctypes.rs:21:1
|
|
|
|
|
LL | pub struct ZeroSize;
|
|
| ^^^^^^^^^^^^^^^^^^^
|
|
|
|
error: `extern` block uses type `ZeroSizeWithPhantomData`, which is not FFI-safe
|
|
--> $DIR/lint-ctypes.rs:63:33
|
|
|
|
|
LL | pub fn zero_size_phantom(p: ZeroSizeWithPhantomData);
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
|
|
|
|
|
= note: composed only of `PhantomData`
|
|
note: the type is defined here
|
|
--> $DIR/lint-ctypes.rs:44:1
|
|
|
|
|
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
|
|
|
|
|
LL | -> ::std::marker::PhantomData<bool>;
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
|
|
|
|
|
= note: composed only of `PhantomData`
|
|
|
|
error: `extern` block uses type `fn()`, which is not FFI-safe
|
|
--> $DIR/lint-ctypes.rs:67:23
|
|
|
|
|
LL | pub fn fn_type(p: RustFn);
|
|
| ^^^^^^ not FFI-safe
|
|
|
|
|
= help: consider using an `extern fn(...) -> ...` function pointer instead
|
|
= 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
|
|
|
|
|
LL | pub fn fn_type2(p: fn());
|
|
| ^^^^ not FFI-safe
|
|
|
|
|
= help: consider using an `extern fn(...) -> ...` function pointer instead
|
|
= 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
|
|
|
|
|
LL | pub fn fn_contained(p: RustBadRet);
|
|
| ^^^^^^^^^^ not FFI-safe
|
|
|
|
|
= 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
|
|
|
|
|
LL | pub fn transparent_str(p: TransparentStr);
|
|
| ^^^^^^^^^^^^^^ not FFI-safe
|
|
|
|
|
= help: consider using `*const u8` and a length instead
|
|
= 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
|
|
|
|
|
LL | pub fn transparent_fn(p: TransparentBadFn);
|
|
| ^^^^^^^^^^^^^^^^ not FFI-safe
|
|
|
|
|
= help: consider adding a `#[repr(C)]` or `#[repr(transparent)]` attribute to this struct
|
|
= note: this struct has unspecified layout
|
|
|
|
error: `extern` block uses type `[u8; 8]`, which is not FFI-safe
|
|
--> $DIR/lint-ctypes.rs:73:27
|
|
|
|
|
LL | pub fn raw_array(arr: [u8; 8]);
|
|
| ^^^^^^^ not FFI-safe
|
|
|
|
|
= help: consider passing a pointer to the array
|
|
= 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
|
|
|
|
|
LL | pub fn no_niche_a(a: Option<UnsafeCell<extern fn()>>);
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
|
|
|
|
|
= 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 `Option<UnsafeCell<&i32>>`, which is not FFI-safe
|
|
--> $DIR/lint-ctypes.rs:77:26
|
|
|
|
|
LL | pub fn no_niche_b(b: Option<UnsafeCell<&i32>>);
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
|
|
|
|
|
= 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
|
|
|