Skip to content

Commit

Permalink
Add regression test for #134060
Browse files Browse the repository at this point in the history
Mostly just to check that the lint impl doesn't ICE from an easy case.
  • Loading branch information
jieyouxu committed Dec 9, 2024
1 parent 1fcbb1e commit 38bfd88
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
15 changes: 15 additions & 0 deletions tests/ui/lint/improper_ctypes_definitions_ice_134060.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
//! Regression test for <https://github.com/rust-lang/rust/issues/134060> due to impl bug from
//! <https://github.com/rust-lang/rust/pull/131669>. This test should be adjusted in favor of more
//! comprehensive coverage when the changes are to be relanded, as this is a basic sanity check to
//! check that the fuzzed example from #134060 doesn't ICE.
//@ check-pass

#![crate_type = "lib"]

pub trait Foo {
extern "C" fn foo_(&self, _: ()) -> i64 {
//~^ WARN `extern` fn uses type `()`, which is not FFI-safe
0
}
}
12 changes: 12 additions & 0 deletions tests/ui/lint/improper_ctypes_definitions_ice_134060.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
warning: `extern` fn uses type `()`, which is not FFI-safe
--> $DIR/improper_ctypes_definitions_ice_134060.rs:11:34
|
LL | extern "C" fn foo_(&self, _: ()) -> i64 {
| ^^ not FFI-safe
|
= help: consider using a struct instead
= note: tuples have unspecified layout
= note: `#[warn(improper_ctypes_definitions)]` on by default

warning: 1 warning emitted

0 comments on commit 38bfd88

Please sign in to comment.