2014-05-27 01:56:52 -05:00
|
|
|
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
|
|
|
|
// file at the top-level directory of this distribution and at
|
|
|
|
// http://rust-lang.org/COPYRIGHT.
|
|
|
|
//
|
|
|
|
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
|
|
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
|
|
// option. This file may not be copied, modified, or distributed
|
|
|
|
// except according to those terms.
|
|
|
|
|
|
|
|
#![deny(ctypes)]
|
|
|
|
#![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" {
|
2014-08-14 14:18:14 -05:00
|
|
|
fn foo(x: A); //~ ERROR found type without foreign-function-safe
|
|
|
|
fn bar(x: B); //~ ERROR foreign-function-safe
|
2014-05-27 01:56:52 -05:00
|
|
|
fn baz(x: C);
|
2014-08-14 14:18:14 -05:00
|
|
|
fn qux(x: A2); //~ ERROR foreign-function-safe
|
|
|
|
fn quux(x: B2); //~ ERROR foreign-function-safe
|
2014-05-27 01:56:52 -05:00
|
|
|
fn corge(x: C2);
|
2014-08-14 14:18:14 -05:00
|
|
|
fn fred(x: D); //~ ERROR foreign-function-safe
|
2014-05-27 01:56:52 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
fn main() { }
|