Skip to content

Commit 4dd01ef

Browse files
committed
improper_ctypes test: move types to separate module
1 parent 653d32e commit 4dd01ef

File tree

1 file changed

+20
-16
lines changed

1 file changed

+20
-16
lines changed

src/test/compile-fail/lint-ctypes.rs

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -11,24 +11,28 @@
1111
#![deny(improper_ctypes)]
1212
#![feature(libc)]
1313

14+
use types::*;
15+
1416
extern crate libc;
1517

16-
trait Mirror { type It; }
17-
impl<T> Mirror for T { type It = Self; }
18-
#[repr(C)]
19-
pub struct StructWithProjection(*mut <StructWithProjection as Mirror>::It);
20-
#[repr(C)]
21-
pub struct StructWithProjectionAndLifetime<'a>(
22-
&'a mut <StructWithProjectionAndLifetime<'a> as Mirror>::It
23-
);
24-
pub type I32Pair = (i32, i32);
25-
#[repr(C)]
26-
pub struct ZeroSize;
27-
pub type RustFn = fn();
28-
pub type RustBadRet = extern fn() -> Box<u32>;
29-
pub type CVoidRet = ();
30-
pub struct Foo;
31-
pub trait Bar {}
18+
pub mod types {
19+
pub trait Mirror { type It; }
20+
impl<T> Mirror for T { type It = Self; }
21+
#[repr(C)]
22+
pub struct StructWithProjection(*mut <StructWithProjection as Mirror>::It);
23+
#[repr(C)]
24+
pub struct StructWithProjectionAndLifetime<'a>(
25+
&'a mut <StructWithProjectionAndLifetime<'a> as Mirror>::It
26+
);
27+
pub type I32Pair = (i32, i32);
28+
#[repr(C)]
29+
pub struct ZeroSize;
30+
pub type RustFn = fn();
31+
pub type RustBadRet = extern fn() -> Box<u32>;
32+
pub type CVoidRet = ();
33+
pub struct Foo;
34+
pub trait Bar {}
35+
}
3236

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

0 commit comments

Comments
 (0)