Skip to content

Conversation

RalfJung
Copy link
Member

Context: #147588

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Oct 11, 2025
@RalfJung
Copy link
Member Author

@bors try

rust-bors bot added a commit that referenced this pull request Oct 11, 2025
[crater only] complain about uninhabited types being ignored in repr(transparent)
@rust-bors

This comment has been minimized.

@rust-log-analyzer
Copy link
Collaborator

The job aarch64-gnu-llvm-20-1 failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)
---- [ui] tests/ui/lint/improper-ctypes/lint-ctypes.rs stdout ----
Saved the actual stderr to `/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/lint/improper-ctypes/lint-ctypes/lint-ctypes.stderr`
diff of stderr:

+ warning: zero-sized fields in `repr(transparent)` cannot contain external non-exhaustive types
+   --> $DIR/lint-ctypes.rs:41:38
+    |
+ LL | pub struct TransparentCustomZst(i32, ZeroSize);
+    |                                      ^^^^^^^^
+    |
+    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+    = note: for more information, see issue #78586 <https://github.com/rust-lang/rust/issues/78586>
+    = note: this field contains `ZeroSize`, which is marked with `#[repr(C)]`, and makes it not a breaking change to become non-zero-sized in the future.
+    = note: `#[warn(repr_transparent_external_private_fields)]` (part of `#[warn(future_incompatible)]`) on by default
+ 
1 error: `extern` block uses type `Foo`, which is not FFI-safe
2   --> $DIR/lint-ctypes.rs:47:28
3    |

209    = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum
210    = note: enum has no representation hint
211 
- error: aborting due to 21 previous errors
+ error: aborting due to 21 previous errors; 1 warning emitted
213 
214 

Note: some mismatched output was normalized before being compared
-   --> /checkout/tests/ui/lint/improper-ctypes/lint-ctypes.rs:41:38
+ warning: zero-sized fields in `repr(transparent)` cannot contain external non-exhaustive types
+   --> $DIR/lint-ctypes.rs:41:38
+    |
+ LL | pub struct TransparentCustomZst(i32, ZeroSize);
+    |                                      ^^^^^^^^
+    |
+    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+    = note: for more information, see issue #78586 <https://github.com/rust-lang/rust/issues/78586>
+    = note: this field contains `ZeroSize`, which is marked with `#[repr(C)]`, and makes it not a breaking change to become non-zero-sized in the future.
---
To only update this specific test, also pass `--test-args lint/improper-ctypes/lint-ctypes.rs`

error: 1 errors occurred comparing output.
status: exit status: 1
command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/lint/improper-ctypes/lint-ctypes.rs" "-Zthreads=1" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2" "--target=aarch64-unknown-linux-gnu" "--check-cfg" "cfg(test,FALSE)" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/lint/improper-ctypes/lint-ctypes" "-A" "unused" "-A" "internal_features" "-A" "unused_parens" "-A" "unused_braces" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/aarch64-unknown-linux-gnu/native/rust-test-helpers"
stdout: none
--- stderr -------------------------------
warning: zero-sized fields in `repr(transparent)` cannot contain external non-exhaustive types
##[warning]  --> /checkout/tests/ui/lint/improper-ctypes/lint-ctypes.rs:41:38
   |
LL | pub struct TransparentCustomZst(i32, ZeroSize);
   |                                      ^^^^^^^^
   |
   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
   = note: for more information, see issue #78586 <https://github.com/rust-lang/rust/issues/78586>
   = note: this field contains `ZeroSize`, which is marked with `#[repr(C)]`, and makes it not a breaking change to become non-zero-sized in the future.
   = note: `#[warn(repr_transparent_external_private_fields)]` (part of `#[warn(future_incompatible)]`) on by default

error: `extern` block uses type `Foo`, which is not FFI-safe
##[error]  --> /checkout/tests/ui/lint/improper-ctypes/lint-ctypes.rs:47:28
   |
LL |     pub fn ptr_type1(size: *const Foo); //~ ERROR: uses type `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
  --> /checkout/tests/ui/lint/improper-ctypes/lint-ctypes.rs:25:1
---
   |
LL | #![deny(improper_ctypes)]
   |         ^^^^^^^^^^^^^^^

error: `extern` block uses type `Foo`, which is not FFI-safe
##[error]  --> /checkout/tests/ui/lint/improper-ctypes/lint-ctypes.rs:48:28
   |
LL |     pub fn ptr_type2(size: *const Foo); //~ ERROR: uses type `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
  --> /checkout/tests/ui/lint/improper-ctypes/lint-ctypes.rs:25:1
   |
LL | pub struct Foo;
   | ^^^^^^^^^^^^^^

error: `extern` block uses type `((),)`, which is not FFI-safe
##[error]  --> /checkout/tests/ui/lint/improper-ctypes/lint-ctypes.rs:50:25
   |
LL |     pub fn ptr_tuple(p: *const ((),)); //~ ERROR: uses type `((),)`
   |                         ^^^^^^^^^^^^ 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
##[error]  --> /checkout/tests/ui/lint/improper-ctypes/lint-ctypes.rs:51:26
   |
LL |     pub fn slice_type(p: &[u32]); //~ ERROR: uses type `[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
##[error]  --> /checkout/tests/ui/lint/improper-ctypes/lint-ctypes.rs:52:24
   |
LL |     pub fn str_type(p: &str); //~ ERROR: uses type `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
##[error]  --> /checkout/tests/ui/lint/improper-ctypes/lint-ctypes.rs:53:24
   |
LL |     pub fn box_type(p: Box<u32>); //~ ERROR uses type `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 `char`, which is not FFI-safe
##[error]  --> /checkout/tests/ui/lint/improper-ctypes/lint-ctypes.rs:55:25
   |
LL |     pub fn char_type(p: char); //~ ERROR uses type `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 `dyn Bar`, which is not FFI-safe
##[error]  --> /checkout/tests/ui/lint/improper-ctypes/lint-ctypes.rs:56:26
   |
LL |     pub fn trait_type(p: &dyn Bar); //~ ERROR uses type `dyn Bar`
   |                          ^^^^^^^^ not FFI-safe
   |
   = note: trait objects have no C equivalent

error: `extern` block uses type `(i32, i32)`, which is not FFI-safe
##[error]  --> /checkout/tests/ui/lint/improper-ctypes/lint-ctypes.rs:57:26
   |
LL |     pub fn tuple_type(p: (i32, i32)); //~ ERROR uses type `(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
##[error]  --> /checkout/tests/ui/lint/improper-ctypes/lint-ctypes.rs:58:27
   |
LL |     pub fn tuple_type2(p: I32Pair); //~ ERROR uses type `(i32, i32)`
   |                           ^^^^^^^ 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
##[error]  --> /checkout/tests/ui/lint/improper-ctypes/lint-ctypes.rs:59:25
   |
LL |     pub fn zero_size(p: ZeroSize); //~ ERROR uses type `ZeroSize`
   |                         ^^^^^^^^ not FFI-safe
   |
   = help: consider adding a member to this struct
   = note: this struct has no fields
note: the type is defined here
  --> /checkout/tests/ui/lint/improper-ctypes/lint-ctypes.rs:21:1
   |
LL | pub struct ZeroSize;
   | ^^^^^^^^^^^^^^^^^^^

error: `extern` block uses type `ZeroSizeWithPhantomData`, which is not FFI-safe
##[error]  --> /checkout/tests/ui/lint/improper-ctypes/lint-ctypes.rs:60:33
   |
LL |     pub fn zero_size_phantom(p: ZeroSizeWithPhantomData);
   |                                 ^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
   |
   = note: composed only of `PhantomData`
note: the type is defined here
  --> /checkout/tests/ui/lint/improper-ctypes/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
##[error]  --> /checkout/tests/ui/lint/improper-ctypes/lint-ctypes.rs:63:12
   |
LL |         -> ::std::marker::PhantomData<bool>; //~ ERROR uses type `PhantomData<bool>`
   |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
   |
   = note: composed only of `PhantomData`

error: `extern` block uses type `fn()`, which is not FFI-safe
##[error]  --> /checkout/tests/ui/lint/improper-ctypes/lint-ctypes.rs:64:23
   |
LL |     pub fn fn_type(p: RustFn); //~ ERROR uses type `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 `fn()`, which is not FFI-safe
##[error]  --> /checkout/tests/ui/lint/improper-ctypes/lint-ctypes.rs:65:24
   |
LL |     pub fn fn_type2(p: fn()); //~ ERROR uses type `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
##[error]  --> /checkout/tests/ui/lint/improper-ctypes/lint-ctypes.rs:66:28
   |
LL |     pub fn fn_contained(p: RustBadRet); //~ ERROR: uses type `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 `str`, which is not FFI-safe
##[error]  --> /checkout/tests/ui/lint/improper-ctypes/lint-ctypes.rs:67:31
   |
LL |     pub fn transparent_str(p: TransparentStr); //~ ERROR: uses type `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
##[error]  --> /checkout/tests/ui/lint/improper-ctypes/lint-ctypes.rs:68:30
   |
LL |     pub fn transparent_fn(p: TransparentBadFn); //~ ERROR: uses type `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 `[u8; 8]`, which is not FFI-safe
##[error]  --> /checkout/tests/ui/lint/improper-ctypes/lint-ctypes.rs:69:27
   |
LL |     pub fn raw_array(arr: [u8; 8]); //~ ERROR: uses type `[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
##[error]  --> /checkout/tests/ui/lint/improper-ctypes/lint-ctypes.rs:71:26
   |
LL |     pub fn no_niche_a(a: Option<UnsafeCell<extern "C" 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
##[error]  --> /checkout/tests/ui/lint/improper-ctypes/lint-ctypes.rs:73: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: aborting due to 21 previous errors; 1 warning emitted
------------------------------------------

---- [ui] tests/ui/lint/improper-ctypes/lint-ctypes.rs stdout end ----
---- [ui] tests/ui/lint/improper-ctypes/lint-fn.rs stdout ----
Saved the actual stderr to `/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/lint/improper-ctypes/lint-fn/lint-fn.stderr`
diff of stderr:

+ warning: zero-sized fields in `repr(transparent)` cannot contain external non-exhaustive types
+   --> $DIR/lint-fn.rs:57:38
+    |
+ LL | pub struct TransparentCustomZst(i32, ZeroSize);
+    |                                      ^^^^^^^^
+    |
+    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+    = note: for more information, see issue #78586 <https://github.com/rust-lang/rust/issues/78586>
+    = note: this field contains `ZeroSize`, which is marked with `#[repr(C)]`, and makes it not a breaking change to become non-zero-sized in the future.
+    = note: `#[warn(repr_transparent_external_private_fields)]` (part of `#[warn(future_incompatible)]`) on by default
+ 
1 error: `extern` fn uses type `[u32]`, which is not FFI-safe
2   --> $DIR/lint-fn.rs:70:33
3    |

160    = help: consider adding a `#[repr(C)]` or `#[repr(transparent)]` attribute to this struct
161    = note: this struct has unspecified layout
---
165 

Note: some mismatched output was normalized before being compared
-   --> /checkout/tests/ui/lint/improper-ctypes/lint-fn.rs:57:38
+ warning: zero-sized fields in `repr(transparent)` cannot contain external non-exhaustive types
+   --> $DIR/lint-fn.rs:57:38
+    |
+ LL | pub struct TransparentCustomZst(i32, ZeroSize);
+    |                                      ^^^^^^^^
+    |
+    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+    = note: for more information, see issue #78586 <https://github.com/rust-lang/rust/issues/78586>
+    = note: this field contains `ZeroSize`, which is marked with `#[repr(C)]`, and makes it not a breaking change to become non-zero-sized in the future.
---
To only update this specific test, also pass `--test-args lint/improper-ctypes/lint-fn.rs`

error: 1 errors occurred comparing output.
status: exit status: 1
command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/lint/improper-ctypes/lint-fn.rs" "-Zthreads=1" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2" "--target=aarch64-unknown-linux-gnu" "--check-cfg" "cfg(test,FALSE)" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/lint/improper-ctypes/lint-fn" "-A" "unused" "-A" "internal_features" "-A" "unused_parens" "-A" "unused_braces" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/aarch64-unknown-linux-gnu/native/rust-test-helpers"
stdout: none
--- stderr -------------------------------
warning: zero-sized fields in `repr(transparent)` cannot contain external non-exhaustive types
##[warning]  --> /checkout/tests/ui/lint/improper-ctypes/lint-fn.rs:57:38
   |
LL | pub struct TransparentCustomZst(i32, ZeroSize);
   |                                      ^^^^^^^^
   |
   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
   = note: for more information, see issue #78586 <https://github.com/rust-lang/rust/issues/78586>
   = note: this field contains `ZeroSize`, which is marked with `#[repr(C)]`, and makes it not a breaking change to become non-zero-sized in the future.
   = note: `#[warn(repr_transparent_external_private_fields)]` (part of `#[warn(future_incompatible)]`) on by default

error: `extern` fn uses type `[u32]`, which is not FFI-safe
##[error]  --> /checkout/tests/ui/lint/improper-ctypes/lint-fn.rs:70:33
   |
LL | pub extern "C" fn slice_type(p: &[u32]) { }
   |                                 ^^^^^^ not FFI-safe
   |
   = help: consider using a raw pointer instead
   = note: slices have no C equivalent
note: the lint level is defined here
  --> /checkout/tests/ui/lint/improper-ctypes/lint-fn.rs:2:9
   |
LL | #![deny(improper_ctypes_definitions)]
   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: `extern` fn uses type `str`, which is not FFI-safe
##[error]  --> /checkout/tests/ui/lint/improper-ctypes/lint-fn.rs:73:31
   |
LL | pub extern "C" 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` fn uses type `Box<[u8]>`, which is not FFI-safe
##[error]  --> /checkout/tests/ui/lint/improper-ctypes/lint-fn.rs:80:34
   |
LL | pub extern "C" fn boxed_slice(p: Box<[u8]>) { }
   |                                  ^^^^^^^^^ not FFI-safe
   |
   = note: box cannot be represented as a single pointer

error: `extern` fn uses type `Box<str>`, which is not FFI-safe
##[error]  --> /checkout/tests/ui/lint/improper-ctypes/lint-fn.rs:83:35
   |
LL | pub extern "C" fn boxed_string(p: Box<str>) { }
   |                                   ^^^^^^^^ not FFI-safe
   |
   = note: box cannot be represented as a single pointer

error: `extern` fn uses type `Box<dyn Trait>`, which is not FFI-safe
##[error]  --> /checkout/tests/ui/lint/improper-ctypes/lint-fn.rs:86:34
   |
LL | pub extern "C" fn boxed_trait(p: Box<dyn Trait>) { }
   |                                  ^^^^^^^^^^^^^^ not FFI-safe
   |
   = note: box cannot be represented as a single pointer

error: `extern` fn uses type `char`, which is not FFI-safe
##[error]  --> /checkout/tests/ui/lint/improper-ctypes/lint-fn.rs:89:32
   |
LL | pub extern "C" 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` fn uses type `(i32, i32)`, which is not FFI-safe
##[error]  --> /checkout/tests/ui/lint/improper-ctypes/lint-fn.rs:92:33
   |
LL | pub extern "C" fn tuple_type(p: (i32, i32)) { }
   |                                 ^^^^^^^^^^ not FFI-safe
   |
   = help: consider using a struct instead
   = note: tuples have unspecified layout

error: `extern` fn uses type `(i32, i32)`, which is not FFI-safe
##[error]  --> /checkout/tests/ui/lint/improper-ctypes/lint-fn.rs:95:34
   |
LL | pub extern "C" fn tuple_type2(p: I32Pair) { }
   |                                  ^^^^^^^ not FFI-safe
   |
   = help: consider using a struct instead
   = note: tuples have unspecified layout

error: `extern` fn uses type `ZeroSize`, which is not FFI-safe
##[error]  --> /checkout/tests/ui/lint/improper-ctypes/lint-fn.rs:98:32
   |
LL | pub extern "C" 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
  --> /checkout/tests/ui/lint/improper-ctypes/lint-fn.rs:25:1
   |
LL | pub struct ZeroSize;
   | ^^^^^^^^^^^^^^^^^^^

error: `extern` fn uses type `ZeroSizeWithPhantomData`, which is not FFI-safe
##[error]  --> /checkout/tests/ui/lint/improper-ctypes/lint-fn.rs:101:40
   |
LL | pub extern "C" fn zero_size_phantom(p: ZeroSizeWithPhantomData) { }
   |                                        ^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
   |
   = note: composed only of `PhantomData`
note: the type is defined here
  --> /checkout/tests/ui/lint/improper-ctypes/lint-fn.rs:60:1
   |
LL | pub struct ZeroSizeWithPhantomData(PhantomData<i32>);
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: `extern` fn uses type `PhantomData<bool>`, which is not FFI-safe
##[error]  --> /checkout/tests/ui/lint/improper-ctypes/lint-fn.rs:104:51
   |
LL | pub extern "C" fn zero_size_phantom_toplevel() -> PhantomData<bool> {
   |                                                   ^^^^^^^^^^^^^^^^^ not FFI-safe
   |
   = note: composed only of `PhantomData`

error: `extern` fn uses type `fn()`, which is not FFI-safe
##[error]  --> /checkout/tests/ui/lint/improper-ctypes/lint-fn.rs:109:30
   |
LL | pub extern "C" 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` fn uses type `fn()`, which is not FFI-safe
##[error]  --> /checkout/tests/ui/lint/improper-ctypes/lint-fn.rs:112:31
   |
LL | pub extern "C" 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` fn uses type `str`, which is not FFI-safe
##[error]  --> /checkout/tests/ui/lint/improper-ctypes/lint-fn.rs:117:38
   |
LL | pub extern "C" 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` fn uses type `PhantomData<bool>`, which is not FFI-safe
##[error]  --> /checkout/tests/ui/lint/improper-ctypes/lint-fn.rs:169:43
   |
LL | pub extern "C" fn unused_generic2<T>() -> PhantomData<bool> {
   |                                           ^^^^^^^^^^^^^^^^^ not FFI-safe
   |
   = note: composed only of `PhantomData`

error: `extern` fn uses type `Vec<T>`, which is not FFI-safe
##[error]  --> /checkout/tests/ui/lint/improper-ctypes/lint-fn.rs:182:39
   |
LL | pub extern "C" fn used_generic4<T>(x: Vec<T>) { }
   |                                       ^^^^^^ not FFI-safe
   |
   = help: consider adding a `#[repr(C)]` or `#[repr(transparent)]` attribute to this struct
   = note: this struct has unspecified layout

error: `extern` fn uses type `Vec<T>`, which is not FFI-safe
##[error]  --> /checkout/tests/ui/lint/improper-ctypes/lint-fn.rs:185:41
   |
LL | pub extern "C" fn used_generic5<T>() -> Vec<T> {
   |                                         ^^^^^^ not FFI-safe
   |

@rust-bors
Copy link

rust-bors bot commented Oct 11, 2025

☀️ Try build successful (CI)
Build commit: 54e27f5 (54e27f559f23913c1d5afb1a0f0114e9e61b81b8, parent: b3f8586fb1e4859678d6b231e780ff81801d2282)

@RalfJung
Copy link
Member Author

@craterbot check

@craterbot
Copy link
Collaborator

👌 Experiment pr-147589 created and queued.
🤖 Automatically detected try build 54e27f5
🔍 You can check out the queue and this experiment's details.

ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

@craterbot craterbot added S-waiting-on-crater Status: Waiting on a crater run to be completed. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Oct 11, 2025
@bors
Copy link
Collaborator

bors commented Oct 13, 2025

☔ The latest upstream changes (presumably #147629) made this pull request unmergeable. Please resolve the merge conflicts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-crater Status: Waiting on a crater run to be completed. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants