]> git.proxmox.com Git - rustc.git/blob - src/test/run-pass/extern-pass-empty.rs
17b0bb580fce27e10a98c2945230db1a3eaed1f0
[rustc.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 // pretty-expanded FIXME #23616
14
15 struct TwoU8s {
16 one: u8,
17 two: u8,
18 }
19
20 struct ManyInts {
21 arg1: i8,
22 arg2: i16,
23 arg3: i32,
24 arg4: i16,
25 arg5: i8,
26 arg6: TwoU8s,
27 }
28
29 struct Empty;
30
31 #[link(name = "rust_test_helpers")]
32 extern {
33 fn rust_dbg_extern_empty_struct(v1: ManyInts, e: Empty, v2: ManyInts);
34 }
35
36 pub fn main() {
37 unsafe {
38 let x = ManyInts {
39 arg1: 2,
40 arg2: 3,
41 arg3: 4,
42 arg4: 5,
43 arg5: 6,
44 arg6: TwoU8s { one: 7, two: 8, }
45 };
46 let y = ManyInts {
47 arg1: 1,
48 arg2: 2,
49 arg3: 3,
50 arg4: 4,
51 arg5: 5,
52 arg6: TwoU8s { one: 6, two: 7, }
53 };
54 let empty = Empty;
55 rust_dbg_extern_empty_struct(x, empty, y);
56 }
57 }