Unique<T> is now considered FFI-safe

This commit is contained in:
Eduardo Sánchez Muñoz 2022-04-13 19:15:34 +02:00
parent c58af72a03
commit 399c0dcc10
2 changed files with 6 additions and 16 deletions

View file

@ -67,7 +67,6 @@ extern "C" {
fn option_fn(x: Option<extern "C" fn()>);
fn nonnull(x: Option<std::ptr::NonNull<u8>>);
fn unique(x: Option<std::ptr::Unique<u8>>);
//~^ ERROR `extern` block uses type `Option<Unique<u8>>`
fn nonzero_u8(x: Option<num::NonZeroU8>);
fn nonzero_u16(x: Option<num::NonZeroU16>);
fn nonzero_u32(x: Option<num::NonZeroU32>);

View file

@ -54,17 +54,8 @@ LL | | G,
LL | | }
| |_^
error: `extern` block uses type `Option<Unique<u8>>`, which is not FFI-safe
--> $DIR/lint-ctypes-enum.rs:69:17
|
LL | fn unique(x: Option<std::ptr::Unique<u8>>);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 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-enum.rs:75:23
--> $DIR/lint-ctypes-enum.rs:74:23
|
LL | fn nonzero_u128(x: Option<num::NonZeroU128>);
| ^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
@ -72,7 +63,7 @@ LL | fn nonzero_u128(x: Option<num::NonZeroU128>);
= 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:82:23
--> $DIR/lint-ctypes-enum.rs:81:23
|
LL | fn nonzero_i128(x: Option<num::NonZeroI128>);
| ^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
@ -80,7 +71,7 @@ LL | fn nonzero_i128(x: Option<num::NonZeroI128>);
= note: 128-bit integers don't currently have a known stable ABI
error: `extern` block uses type `Option<TransparentUnion<NonZeroU8>>`, which is not FFI-safe
--> $DIR/lint-ctypes-enum.rs:87:28
--> $DIR/lint-ctypes-enum.rs:86:28
|
LL | fn transparent_union(x: Option<TransparentUnion<num::NonZeroU8>>);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
@ -89,7 +80,7 @@ LL | fn transparent_union(x: Option<TransparentUnion<num::NonZeroU8>>);
= note: enum has no representation hint
error: `extern` block uses type `Option<Rust<NonZeroU8>>`, which is not FFI-safe
--> $DIR/lint-ctypes-enum.rs:89:20
--> $DIR/lint-ctypes-enum.rs:88:20
|
LL | fn repr_rust(x: Option<Rust<num::NonZeroU8>>);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
@ -98,7 +89,7 @@ LL | fn repr_rust(x: Option<Rust<num::NonZeroU8>>);
= note: enum has no representation hint
error: `extern` block uses type `Result<(), NonZeroI32>`, which is not FFI-safe
--> $DIR/lint-ctypes-enum.rs:90:20
--> $DIR/lint-ctypes-enum.rs:89:20
|
LL | fn no_result(x: Result<(), num::NonZeroI32>);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
@ -106,5 +97,5 @@ LL | fn no_result(x: Result<(), num::NonZeroI32>);
= 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 9 previous errors
error: aborting due to 8 previous errors