1 // Copyright 2012 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
11 #![deny(improper_ctypes)]
16 trait Mirror { type It: ?Sized; }
17 impl<T: ?Sized> Mirror for T { type It = Self; }
19 pub struct StructWithProjection(*mut <StructWithProjection as Mirror>::It);
21 pub struct StructWithProjectionAndLifetime<'a>(
22 &'a mut <StructWithProjectionAndLifetime<'a> as Mirror>::It
24 pub type I32Pair = (i32, i32);
27 pub type RustFn = fn();
28 pub type RustBadRet = extern fn() -> Box<u32>;
29 pub type CVoidRet = ();
33 pub fn ptr_type1(size: *const Foo); //~ ERROR: found struct without
34 pub fn ptr_type2(size: *const Foo); //~ ERROR: found struct without
35 pub fn slice_type(p: &[u32]); //~ ERROR: found Rust slice type
36 pub fn str_type(p: &str); //~ ERROR: found Rust type
37 pub fn box_type(p: Box<u32>); //~ ERROR found Rust type
38 pub fn char_type(p: char); //~ ERROR found Rust type
39 pub fn trait_type(p: &Clone); //~ ERROR found Rust trait type
40 pub fn tuple_type(p: (i32, i32)); //~ ERROR found Rust tuple type
41 pub fn tuple_type2(p: I32Pair); //~ ERROR found Rust tuple type
42 pub fn zero_size(p: ZeroSize); //~ ERROR found zero-size struct
43 pub fn fn_type(p: RustFn); //~ ERROR found function pointer with Rust
44 pub fn fn_type2(p: fn()); //~ ERROR found function pointer with Rust
45 pub fn fn_contained(p: RustBadRet); //~ ERROR: found Rust type
47 pub fn good1(size: *const libc::c_int);
48 pub fn good2(size: *const libc::c_uint);
49 pub fn good3(fptr: Option<extern fn()>);
50 pub fn good4(aptr: &[u8; 4 as usize]);
51 pub fn good5(s: StructWithProjection);
52 pub fn good6(s: StructWithProjectionAndLifetime);
53 pub fn good7(fptr: extern fn() -> ());
54 pub fn good8(fptr: extern fn() -> !);
56 pub fn good10() -> CVoidRet;
57 pub fn good11(size: isize);
58 pub fn good12(size: usize);