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