Fix ICE in improper_ctypes_definitions lint with all-ZST transparent types
This commit is contained in:
parent
7069a8c2b7
commit
4e76c3820f
3 changed files with 36 additions and 2 deletions
12
src/test/ui/repr/repr-transparent-issue-87496.rs
Normal file
12
src/test/ui/repr/repr-transparent-issue-87496.rs
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
// Regression test for the ICE described in #87496.
|
||||
|
||||
// check-pass
|
||||
|
||||
#[repr(transparent)]
|
||||
struct TransparentCustomZst(());
|
||||
extern "C" {
|
||||
fn good17(p: TransparentCustomZst);
|
||||
//~^ WARNING: `extern` block uses type `TransparentCustomZst`, which is not FFI-safe
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
16
src/test/ui/repr/repr-transparent-issue-87496.stderr
Normal file
16
src/test/ui/repr/repr-transparent-issue-87496.stderr
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
warning: `extern` block uses type `TransparentCustomZst`, which is not FFI-safe
|
||||
--> $DIR/repr-transparent-issue-87496.rs:8:18
|
||||
|
|
||||
LL | fn good17(p: TransparentCustomZst);
|
||||
| ^^^^^^^^^^^^^^^^^^^^ not FFI-safe
|
||||
|
|
||||
= note: `#[warn(improper_ctypes)]` on by default
|
||||
= note: this struct contains only zero-sized fields
|
||||
note: the type is defined here
|
||||
--> $DIR/repr-transparent-issue-87496.rs:6:1
|
||||
|
|
||||
LL | struct TransparentCustomZst(());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
warning: 1 warning emitted
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue