]> git.lizzy.rs Git - rust.git/blob - src/test/run-pass/extern-pass-empty.rs
cleanup: s/impl Copy/#[derive(Copy)]/g
[rust.git] / src / test / run-pass / extern-pass-empty.rs
1 // Copyright 2014 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.
4 //
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.
10
11 // Test a foreign function that accepts empty struct.
12
13 struct TwoU8s {
14     one: u8,
15     two: u8,
16 }
17
18 struct ManyInts {
19     arg1: i8,
20     arg2: i16,
21     arg3: i32,
22     arg4: i16,
23     arg5: i8,
24     arg6: TwoU8s,
25 }
26
27 struct Empty;
28
29 #[link(name = "rust_test_helpers")]
30 extern {
31     fn rust_dbg_extern_empty_struct(v1: ManyInts, e: Empty, v2: ManyInts);
32 }
33
34 pub fn main() {
35     unsafe {
36         let x = ManyInts {
37             arg1: 2,
38             arg2: 3,
39             arg3: 4,
40             arg4: 5,
41             arg5: 6,
42             arg6: TwoU8s { one: 7, two: 8, }
43         };
44         let y = ManyInts {
45             arg1: 1,
46             arg2: 2,
47             arg3: 3,
48             arg4: 4,
49             arg5: 5,
50             arg6: TwoU8s { one: 6, two: 7, }
51         };
52         let empty = Empty;
53         rust_dbg_extern_empty_struct(x, empty, y);
54     }
55 }