]> git.lizzy.rs Git - rust.git/blob - src/test/ui/abi/extern/extern-pass-TwoU64s.rs
Rollup merge of #95353 - jyn514:invalid-filter-hard-error, r=Mark-Simulacrum
[rust.git] / src / test / ui / abi / extern / extern-pass-TwoU64s.rs
1 // run-pass
2 #![allow(improper_ctypes)]
3
4 // ignore-wasm32-bare no libc for ffi testing
5
6 // Test a foreign function that accepts and returns a struct
7 // by value.
8
9 #[derive(Copy, Clone, PartialEq, Debug)]
10 pub struct TwoU64s {
11     one: u64,
12     two: u64,
13 }
14
15 #[link(name = "rust_test_helpers", kind = "static")]
16 extern "C" {
17     pub fn rust_dbg_extern_identity_TwoU64s(v: TwoU64s) -> TwoU64s;
18 }
19
20 pub fn main() {
21     unsafe {
22         let x = TwoU64s { one: 22, two: 23 };
23         let y = rust_dbg_extern_identity_TwoU64s(x);
24         assert_eq!(x, y);
25     }
26 }