]> git.lizzy.rs Git - rust.git/blob - tests/run-make-fulldeps/extern-fn-with-packed-struct/test.rs
Merge commit '598f0909568a51de8a2d1148f55a644fd8dffad0' into sync_cg_clif-2023-01-24
[rust.git] / tests / run-make-fulldeps / extern-fn-with-packed-struct / test.rs
1 #[repr(C, packed)]
2 #[derive(Copy, Clone, Debug, PartialEq)]
3 struct Foo {
4     a: i8,
5     b: i16,
6     c: i8,
7 }
8
9 #[link(name = "test", kind = "static")]
10 extern "C" {
11     fn foo(f: Foo) -> Foo;
12 }
13
14 fn main() {
15     unsafe {
16         let a = Foo { a: 1, b: 2, c: 3 };
17         let b = foo(a);
18         assert_eq!(a, b);
19     }
20 }