2014-10-27 22:37:07 +00:00
|
|
|
#![deny(improper_ctypes)]
|
2014-05-27 06:56:52 +00:00
|
|
|
#![allow(dead_code)]
|
|
|
|
|
2014-08-14 19:18:14 +00:00
|
|
|
struct A {
|
|
|
|
x: i32
|
2014-05-27 06:56:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#[repr(C, packed)]
|
|
|
|
struct B {
|
2014-08-14 19:18:14 +00:00
|
|
|
x: i32,
|
2014-05-27 06:56:52 +00:00
|
|
|
y: A
|
|
|
|
}
|
|
|
|
|
|
|
|
#[repr(C)]
|
|
|
|
struct C {
|
2014-08-14 19:18:14 +00:00
|
|
|
x: i32
|
2014-05-27 06:56:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
type A2 = A;
|
|
|
|
type B2 = B;
|
|
|
|
type C2 = C;
|
|
|
|
|
|
|
|
#[repr(C)]
|
|
|
|
struct D {
|
|
|
|
x: C,
|
|
|
|
y: A
|
|
|
|
}
|
|
|
|
|
|
|
|
extern "C" {
|
2019-09-10 21:29:31 +00:00
|
|
|
fn foo(x: A); //~ ERROR type `A`, which is not FFI-safe
|
2018-02-12 00:08:48 +00:00
|
|
|
fn bar(x: B); //~ ERROR type `A`
|
2014-05-27 06:56:52 +00:00
|
|
|
fn baz(x: C);
|
2018-02-12 00:08:48 +00:00
|
|
|
fn qux(x: A2); //~ ERROR type `A`
|
|
|
|
fn quux(x: B2); //~ ERROR type `A`
|
2014-05-27 06:56:52 +00:00
|
|
|
fn corge(x: C2);
|
2018-02-12 00:08:48 +00:00
|
|
|
fn fred(x: D); //~ ERROR type `A`
|
2014-05-27 06:56:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
fn main() { }
|