Skip to content

Commit 399c0dc

Browse files
committed
Unique<T> is now considered FFI-safe
1 parent c58af72 commit 399c0dc

File tree

2 files changed

+6
-16
lines changed

2 files changed

+6
-16
lines changed

src/test/ui/lint/lint-ctypes-enum.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@ extern "C" {
6767
fn option_fn(x: Option<extern "C" fn()>);
6868
fn nonnull(x: Option<std::ptr::NonNull<u8>>);
6969
fn unique(x: Option<std::ptr::Unique<u8>>);
70-
//~^ ERROR `extern` block uses type `Option<Unique<u8>>`
7170
fn nonzero_u8(x: Option<num::NonZeroU8>);
7271
fn nonzero_u16(x: Option<num::NonZeroU16>);
7372
fn nonzero_u32(x: Option<num::NonZeroU32>);

src/test/ui/lint/lint-ctypes-enum.stderr

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -54,33 +54,24 @@ LL | | G,
5454
LL | | }
5555
| |_^
5656

57-
error: `extern` block uses type `Option<Unique<u8>>`, which is not FFI-safe
58-
--> $DIR/lint-ctypes-enum.rs:69:17
59-
|
60-
LL | fn unique(x: Option<std::ptr::Unique<u8>>);
61-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
62-
|
63-
= help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum
64-
= note: enum has no representation hint
65-
6657
error: `extern` block uses type `u128`, which is not FFI-safe
67-
--> $DIR/lint-ctypes-enum.rs:75:23
58+
--> $DIR/lint-ctypes-enum.rs:74:23
6859
|
6960
LL | fn nonzero_u128(x: Option<num::NonZeroU128>);
7061
| ^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
7162
|
7263
= note: 128-bit integers don't currently have a known stable ABI
7364

7465
error: `extern` block uses type `i128`, which is not FFI-safe
75-
--> $DIR/lint-ctypes-enum.rs:82:23
66+
--> $DIR/lint-ctypes-enum.rs:81:23
7667
|
7768
LL | fn nonzero_i128(x: Option<num::NonZeroI128>);
7869
| ^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
7970
|
8071
= note: 128-bit integers don't currently have a known stable ABI
8172

8273
error: `extern` block uses type `Option<TransparentUnion<NonZeroU8>>`, which is not FFI-safe
83-
--> $DIR/lint-ctypes-enum.rs:87:28
74+
--> $DIR/lint-ctypes-enum.rs:86:28
8475
|
8576
LL | fn transparent_union(x: Option<TransparentUnion<num::NonZeroU8>>);
8677
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
@@ -89,7 +80,7 @@ LL | fn transparent_union(x: Option<TransparentUnion<num::NonZeroU8>>);
8980
= note: enum has no representation hint
9081

9182
error: `extern` block uses type `Option<Rust<NonZeroU8>>`, which is not FFI-safe
92-
--> $DIR/lint-ctypes-enum.rs:89:20
83+
--> $DIR/lint-ctypes-enum.rs:88:20
9384
|
9485
LL | fn repr_rust(x: Option<Rust<num::NonZeroU8>>);
9586
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
@@ -98,13 +89,13 @@ LL | fn repr_rust(x: Option<Rust<num::NonZeroU8>>);
9889
= note: enum has no representation hint
9990

10091
error: `extern` block uses type `Result<(), NonZeroI32>`, which is not FFI-safe
101-
--> $DIR/lint-ctypes-enum.rs:90:20
92+
--> $DIR/lint-ctypes-enum.rs:89:20
10293
|
10394
LL | fn no_result(x: Result<(), num::NonZeroI32>);
10495
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
10596
|
10697
= help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum
10798
= note: enum has no representation hint
10899

109-
error: aborting due to 9 previous errors
100+
error: aborting due to 8 previous errors
110101

0 commit comments

Comments
 (0)