-
Notifications
You must be signed in to change notification settings - Fork 13k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of #87529 - FabianWolff:issue-87496, r=nikomatsakis
Fix ICE in `improper_ctypes_definitions` lint with all-ZST transparent types Fixes #87496. There is also another function in the same file that looks fishy, but I haven't been able to produce an ICE there, and in any case, it's not related to #87496: https://github.com/rust-lang/rust/blob/fd853c00e255559255885aadff9e93a1760c8728/compiler/rustc_lint/src/types.rs#L720-L734 r? ```@JohnTitor```
- Loading branch information
Showing
3 changed files
with
36 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
|