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

This comment has been minimized.

@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.

@craterbot
Copy link
Collaborator

🚧 Experiment pr-147589 is now running

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

@craterbot
Copy link
Collaborator

🎉 Experiment pr-147589 is completed!
📊 2 regressed and 4 fixed (714994 total)
📊 1694 spurious results on the retry-regessed-list.txt, consider a retry1 if this is a significant amount.
📰 Open the summary report.

⚠️ If you notice any spurious failure please add them to the denylist!
ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

Footnotes

  1. re-run the experiment with crates=https://crater-reports.s3.amazonaws.com/pr-147589/retry-regressed-list.txt

@craterbot craterbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-crater Status: Waiting on a crater run to be completed. labels Oct 16, 2025
@RalfJung
Copy link
Member Author

Uh... I may have cratered the version where this is a lint, not a hard error... oopsie...

@RalfJung RalfJung force-pushed the repr-transparent-uninhabited branch from 0f4ab71 to 0a90c48 Compare October 16, 2025 20:56
@RalfJung
Copy link
Member Author

@bors try

rust-bors bot added a commit that referenced this pull request Oct 16, 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:

- error: `extern` block uses type `Foo`, which is not FFI-safe
-   --> $DIR/lint-ctypes.rs:47:28
+ error: zero-sized fields in `repr(transparent)` cannot contain external non-exhaustive types
+   --> $DIR/lint-ctypes.rs:41:38
3    |
- LL |     pub fn ptr_type1(size: *const Foo);
-    |                            ^^^^^^^^^^ not FFI-safe
+ LL | pub struct TransparentCustomZst(i32, ZeroSize);
+    |                                      ^^^^^^^^
6    |
-    = 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
---
- LL | #![deny(improper_ctypes)]
-    |         ^^^^^^^^^^^^^^^
+    = 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.
19 
- 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
-    |
---
-    |
- 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 `char`, which is not FFI-safe
-   --> $DIR/lint-ctypes.rs:55: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 `dyn Bar`, which is not FFI-safe
-   --> $DIR/lint-ctypes.rs:56: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:57: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:58: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:59: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:60: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:63: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:64: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:65: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:66: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 `str`, which is 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:68: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:69: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: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
-   --> $DIR/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
+ error: aborting due to 1 previous error
213 
214 

Note: some mismatched output was normalized before being compared
-   --> /checkout/tests/ui/lint/improper-ctypes/lint-ctypes.rs:41:38
+ error: zero-sized fields in `repr(transparent)` cannot contain external non-exhaustive types
+   --> $DIR/lint-ctypes.rs:41:38
+ LL | pub struct TransparentCustomZst(i32, ZeroSize);
+    |                                      ^^^^^^^^
+    = 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.
+ error: aborting due to 1 previous error


The actual stderr differed from the expected stderr
To update references, rerun the tests and pass the `--bless` flag
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 -------------------------------
error: zero-sized fields in `repr(transparent)` cannot contain external non-exhaustive types
##[error]  --> /checkout/tests/ui/lint/improper-ctypes/lint-ctypes.rs:41:38
   |
LL | pub struct TransparentCustomZst(i32, ZeroSize);
   |                                      ^^^^^^^^
   |
   = 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.

error: aborting due to 1 previous error
------------------------------------------

---- [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:

- error: `extern` fn uses type `[u32]`, which is not FFI-safe
-   --> $DIR/lint-fn.rs:70:33
+ error: zero-sized fields in `repr(transparent)` cannot contain external non-exhaustive types
+   --> $DIR/lint-fn.rs:57:38
3    |
- LL | pub extern "C" fn slice_type(p: &[u32]) { }
-    |                                 ^^^^^^ not FFI-safe
+ LL | pub struct TransparentCustomZst(i32, ZeroSize);
+    |                                      ^^^^^^^^
6    |
-    = help: consider using a raw pointer instead
-    = note: slices have no C equivalent
- note: the lint level is defined here
-   --> $DIR/lint-fn.rs:2:9
-    |
- LL | #![deny(improper_ctypes_definitions)]
-    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+    = 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.
14 
- error: `extern` fn uses type `str`, which is not FFI-safe
-   --> $DIR/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
-   --> $DIR/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
-   --> $DIR/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
-   --> $DIR/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
-   --> $DIR/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
-   --> $DIR/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
-   --> $DIR/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
-   --> $DIR/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
-   --> $DIR/lint-fn.rs:25:1
-    |
- LL | pub struct ZeroSize;
-    | ^^^^^^^^^^^^^^^^^^^
- 
- error: `extern` fn uses type `ZeroSizeWithPhantomData`, which is not FFI-safe
-   --> $DIR/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
-   --> $DIR/lint-fn.rs:60:1
-    |
- LL | pub struct ZeroSizeWithPhantomData(PhantomData<i32>);
-    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- 
- error: `extern` fn uses type `PhantomData<bool>`, which is not FFI-safe
-   --> $DIR/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
-   --> $DIR/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
-   --> $DIR/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
-   --> $DIR/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
-   --> $DIR/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
-   --> $DIR/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
-   --> $DIR/lint-fn.rs:185:41
-    |
- LL | pub extern "C" fn used_generic5<T>() -> Vec<T> {
-    |                                         ^^^^^^ not FFI-safe
-    |
---
165 

Note: some mismatched output was normalized before being compared
-   --> /checkout/tests/ui/lint/improper-ctypes/lint-fn.rs:57:38
+ error: zero-sized fields in `repr(transparent)` cannot contain external non-exhaustive types
+   --> $DIR/lint-fn.rs:57:38
+ LL | pub struct TransparentCustomZst(i32, ZeroSize);
+    |                                      ^^^^^^^^
+    = 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.
+ error: aborting due to 1 previous error


The actual stderr differed from the expected stderr
To update references, rerun the tests and pass the `--bless` flag
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 -------------------------------
error: zero-sized fields in `repr(transparent)` cannot contain external non-exhaustive types
##[error]  --> /checkout/tests/ui/lint/improper-ctypes/lint-fn.rs:57:38
   |
LL | pub struct TransparentCustomZst(i32, ZeroSize);
   |                                      ^^^^^^^^
   |
   = 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.

error: aborting due to 1 previous error
------------------------------------------

---- [ui] tests/ui/lint/improper-ctypes/lint-fn.rs stdout end ----
---- [ui] tests/ui/repr/repr-transparent-non-exhaustive.rs stdout ----

error: 2 diagnostics expected in test file but not reported in JSON output
tests/ui/repr/repr-transparent-non-exhaustive.rs:52:1: ERROR: zero-sized fields in `repr(transparent)` cannot contain external non-exhaustive types
tests/ui/repr/repr-transparent-non-exhaustive.rs:52:1: WARN: this was previously accepted by the compiler

thread '[ui] tests/ui/repr/repr-transparent-non-exhaustive.rs' panicked at src/tools/compiletest/src/runtest.rs:924:13:
errors differ from expected
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/repr/repr-transparent-non-exhaustive.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/repr/repr-transparent-non-exhaustive" "-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" "-L" "/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/repr/repr-transparent-non-exhaustive/auxiliary"

stack backtrace:
   5: __rustc::rust_begin_unwind
             at /rustc/bb624dcb4c8ab987e10c0808d92d76f3b84dd117/library/std/src/panicking.rs:698:5
   6: core::panicking::panic_fmt
---
---- [ui] tests/ui/uninhabited/uninhabited-transparent-return-abi.rs stdout ----

error: test compilation failed although it shouldn't!
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/uninhabited/uninhabited-transparent-return-abi.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)" "-O" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "-C" "prefer-dynamic" "-o" "/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/uninhabited/uninhabited-transparent-return-abi/a" "-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 -------------------------------
error: zero-sized fields in `repr(transparent)` cannot contain external non-exhaustive types
##[error]  --> /checkout/tests/ui/uninhabited/uninhabited-transparent-return-abi.rs:10:23
   |
LL | struct NoReturn<T>(T, Void);
   |                       ^^^^
   |
   = note: this field contains `Void`, which is not inhabited, and makes it not a breaking change to become non-zero-sized in the future.

error: aborting due to 1 previous error
------------------------------------------

---- [ui] tests/ui/uninhabited/uninhabited-transparent-return-abi.rs stdout end ----

@asquared31415
Copy link
Contributor

Uh... I may have cratered the version where this is a lint, not a hard error... oopsie...

i was slightly surprised that it seemed like there were no meaningful changes in the crater report! that would explain it though.

@rust-bors
Copy link

rust-bors bot commented Oct 16, 2025

☀️ Try build successful (CI)
Build commit: 438eb4c (438eb4c1a1c3841523d7f672601e8adbe04cff28, parent: 779e19d8baa3e3625bd4fc5c85cbb2ad47b43155)

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

Labels

S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. 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.

6 participants