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