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