Add regression test for #134060
Mostly just to check that the lint impl doesn't ICE from an easy case.
This commit is contained in:
parent
1fcbb1e338
commit
38bfd88db7
2 changed files with 27 additions and 0 deletions
15
tests/ui/lint/improper_ctypes_definitions_ice_134060.rs
Normal file
15
tests/ui/lint/improper_ctypes_definitions_ice_134060.rs
Normal file
|
@ -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
tests/ui/lint/improper_ctypes_definitions_ice_134060.stderr
Normal file
12
tests/ui/lint/improper_ctypes_definitions_ice_134060.stderr
Normal file
|
@ -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
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue