Skip to content

Commit

Permalink
improper_ctypes test: move types to separate module
Browse files Browse the repository at this point in the history
  • Loading branch information
TimNN committed Dec 20, 2015
1 parent 653d32e commit 4dd01ef
Showing 1 changed file with 20 additions and 16 deletions.
36 changes: 20 additions & 16 deletions src/test/compile-fail/lint-ctypes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,28 @@
#![deny(improper_ctypes)]
#![feature(libc)]

use types::*;

extern crate libc;

trait Mirror { type It; }
impl<T> Mirror for T { type It = Self; }
#[repr(C)]
pub struct StructWithProjection(*mut <StructWithProjection as Mirror>::It);
#[repr(C)]
pub struct StructWithProjectionAndLifetime<'a>(
&'a mut <StructWithProjectionAndLifetime<'a> as Mirror>::It
);
pub type I32Pair = (i32, i32);
#[repr(C)]
pub struct ZeroSize;
pub type RustFn = fn();
pub type RustBadRet = extern fn() -> Box<u32>;
pub type CVoidRet = ();
pub struct Foo;
pub trait Bar {}
pub mod types {
pub trait Mirror { type It; }
impl<T> Mirror for T { type It = Self; }
#[repr(C)]
pub struct StructWithProjection(*mut <StructWithProjection as Mirror>::It);
#[repr(C)]
pub struct StructWithProjectionAndLifetime<'a>(
&'a mut <StructWithProjectionAndLifetime<'a> as Mirror>::It
);
pub type I32Pair = (i32, i32);
#[repr(C)]
pub struct ZeroSize;
pub type RustFn = fn();
pub type RustBadRet = extern fn() -> Box<u32>;
pub type CVoidRet = ();
pub struct Foo;
pub trait Bar {}
}

extern {
pub fn ptr_type1(size: *const Foo); //~ ERROR: found struct without
Expand Down

0 comments on commit 4dd01ef

Please sign in to comment.