Skip to content

Commit

Permalink
Fix tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
reitermarkus committed Mar 2, 2024
1 parent cca7ae8 commit f93f0ae
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 180 deletions.
67 changes: 2 additions & 65 deletions tests/ui/lint/clashing-extern-fn.stderr
Original file line number Diff line number Diff line change
@@ -1,31 +1,3 @@
warning: `extern` block uses type `Option<NonZero<usize>>`, which is not FFI-safe
--> $DIR/clashing-extern-fn.rs:369:43
|
LL | fn option_non_zero_usize() -> Option<core::num::NonZero<usize>>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
|
= help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum
= note: enum has no representation hint
= note: `#[warn(improper_ctypes)]` on by default

warning: `extern` block uses type `Option<NonZero<isize>>`, which is not FFI-safe
--> $DIR/clashing-extern-fn.rs:370:43
|
LL | fn option_non_zero_isize() -> Option<core::num::NonZero<isize>>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
|
= help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum
= note: enum has no representation hint

warning: `extern` block uses type `Option<Transparent>`, which is not FFI-safe
--> $DIR/clashing-extern-fn.rs:428:46
|
LL | fn hidden_niche_transparent() -> Option<Transparent>;
| ^^^^^^^^^^^^^^^^^^^ not FFI-safe
|
= help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum
= note: enum has no representation hint

warning: `extern` block uses type `Option<TransparentNoNiche>`, which is not FFI-safe
--> $DIR/clashing-extern-fn.rs:430:55
|
Expand All @@ -34,6 +6,7 @@ LL | fn hidden_niche_transparent_no_niche() -> Option<TransparentNoN
|
= help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum
= note: enum has no representation hint
= note: `#[warn(improper_ctypes)]` on by default

warning: `extern` block uses type `Option<UnsafeCell<NonZero<usize>>>`, which is not FFI-safe
--> $DIR/clashing-extern-fn.rs:434:46
Expand Down Expand Up @@ -205,30 +178,6 @@ LL | fn non_null_ptr() -> *const usize;
= note: expected `unsafe extern "C" fn() -> NonNull<usize>`
found `unsafe extern "C" fn() -> *const usize`

warning: `option_non_zero_usize` redeclared with a different signature
--> $DIR/clashing-extern-fn.rs:369:13
|
LL | fn option_non_zero_usize() -> usize;
| ----------------------------------- `option_non_zero_usize` previously declared here
...
LL | fn option_non_zero_usize() -> Option<core::num::NonZero<usize>>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this signature doesn't match the previous declaration
|
= note: expected `unsafe extern "C" fn() -> usize`
found `unsafe extern "C" fn() -> Option<NonZero<usize>>`

warning: `option_non_zero_isize` redeclared with a different signature
--> $DIR/clashing-extern-fn.rs:370:13
|
LL | fn option_non_zero_isize() -> isize;
| ----------------------------------- `option_non_zero_isize` previously declared here
...
LL | fn option_non_zero_isize() -> Option<core::num::NonZero<isize>>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this signature doesn't match the previous declaration
|
= note: expected `unsafe extern "C" fn() -> isize`
found `unsafe extern "C" fn() -> Option<NonZero<isize>>`

warning: `option_non_zero_usize_incorrect` redeclared with a different signature
--> $DIR/clashing-extern-fn.rs:374:13
|
Expand All @@ -253,18 +202,6 @@ LL | fn option_non_null_ptr_incorrect() -> *const isize;
= note: expected `unsafe extern "C" fn() -> *const usize`
found `unsafe extern "C" fn() -> *const isize`

warning: `hidden_niche_transparent` redeclared with a different signature
--> $DIR/clashing-extern-fn.rs:428:13
|
LL | fn hidden_niche_transparent() -> usize;
| -------------------------------------- `hidden_niche_transparent` previously declared here
...
LL | fn hidden_niche_transparent() -> Option<Transparent>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this signature doesn't match the previous declaration
|
= note: expected `unsafe extern "C" fn() -> usize`
found `unsafe extern "C" fn() -> Option<Transparent>`

warning: `hidden_niche_transparent_no_niche` redeclared with a different signature
--> $DIR/clashing-extern-fn.rs:430:13
|
Expand All @@ -289,5 +226,5 @@ LL | fn hidden_niche_unsafe_cell() -> Option<UnsafeCell<NonZero<usiz
= note: expected `unsafe extern "C" fn() -> usize`
found `unsafe extern "C" fn() -> Option<UnsafeCell<NonZero<usize>>>`

warning: 25 warnings emitted
warning: 19 warnings emitted

120 changes: 5 additions & 115 deletions tests/ui/lint/lint-ctypes-enum.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -45,131 +45,21 @@ note: the type is defined here
LL | enum T {
| ^^^^^^

error: `extern` block uses type `Option<NonZero<u8>>`, which is not FFI-safe
--> $DIR/lint-ctypes-enum.rs:71:21
|
LL | fn nonzero_u8(x: Option<num::NonZero<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 `Option<NonZero<u16>>`, which is not FFI-safe
--> $DIR/lint-ctypes-enum.rs:72:22
|
LL | fn nonzero_u16(x: Option<num::NonZero<u16>>);
| ^^^^^^^^^^^^^^^^^^^^^^^^^ 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<NonZero<u32>>`, which is not FFI-safe
--> $DIR/lint-ctypes-enum.rs:73:22
|
LL | fn nonzero_u32(x: Option<num::NonZero<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 `Option<NonZero<u64>>`, which is not FFI-safe
--> $DIR/lint-ctypes-enum.rs:74:22
|
LL | fn nonzero_u64(x: Option<num::NonZero<u64>>);
| ^^^^^^^^^^^^^^^^^^^^^^^^^ 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<NonZero<u128>>`, which is not FFI-safe
error: `extern` block uses type `u128`, which is not FFI-safe
--> $DIR/lint-ctypes-enum.rs:75:23
|
LL | fn nonzero_u128(x: Option<num::NonZero<u128>>);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ 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<NonZero<usize>>`, which is not FFI-safe
--> $DIR/lint-ctypes-enum.rs:77:24
|
LL | fn nonzero_usize(x: Option<num::NonZero<usize>>);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ 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<NonZero<i8>>`, which is not FFI-safe
--> $DIR/lint-ctypes-enum.rs:78:21
|
LL | fn nonzero_i8(x: Option<num::NonZero<i8>>);
| ^^^^^^^^^^^^^^^^^^^^^^^^ 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<NonZero<i16>>`, which is not FFI-safe
--> $DIR/lint-ctypes-enum.rs:79:22
|
LL | fn nonzero_i16(x: Option<num::NonZero<i16>>);
| ^^^^^^^^^^^^^^^^^^^^^^^^^ 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<NonZero<i32>>`, which is not FFI-safe
--> $DIR/lint-ctypes-enum.rs:80:22
|
LL | fn nonzero_i32(x: Option<num::NonZero<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 `Option<NonZero<i64>>`, which is not FFI-safe
--> $DIR/lint-ctypes-enum.rs:81:22
|
LL | fn nonzero_i64(x: Option<num::NonZero<i64>>);
| ^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
|
= help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum
= note: enum has no representation hint
= note: 128-bit integers don't currently have a known stable ABI

error: `extern` block uses type `Option<NonZero<i128>>`, which is not FFI-safe
error: `extern` block uses type `i128`, which is not FFI-safe
--> $DIR/lint-ctypes-enum.rs:82:23
|
LL | fn nonzero_i128(x: Option<num::NonZero<i128>>);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ 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<NonZero<isize>>`, which is not FFI-safe
--> $DIR/lint-ctypes-enum.rs:84:24
|
LL | fn nonzero_isize(x: Option<num::NonZero<isize>>);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ 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<TransparentStruct<NonZero<u8>>>`, which is not FFI-safe
--> $DIR/lint-ctypes-enum.rs:85:29
|
LL | fn transparent_struct(x: Option<TransparentStruct<num::NonZero<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 `Option<TransparentEnum<NonZero<u8>>>`, which is not FFI-safe
--> $DIR/lint-ctypes-enum.rs:86:27
|
LL | fn transparent_enum(x: Option<TransparentEnum<num::NonZero<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
= 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:87:28
Expand Down Expand Up @@ -198,5 +88,5 @@ LL | fn no_result(x: Result<(), num::NonZero<i32>>);
= 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 20 previous errors
error: aborting due to 8 previous errors

0 comments on commit f93f0ae

Please sign in to comment.