Files
rust/tests/ui/abi/extern/extern-pass-TwoU32s.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

25 lines
508 B
Rust
Raw Normal View History

//@ run-pass
#![allow(improper_ctypes)]
// Test a foreign function that accepts and returns a struct
// by value.
2015-03-30 09:38:27 -04:00
#[derive(Copy, Clone, PartialEq, Debug)]
pub struct TwoU32s {
2020-09-01 17:12:52 -04:00
one: u32,
two: u32,
}
2016-11-23 16:09:51 -08:00
#[link(name = "rust_test_helpers", kind = "static")]
2020-09-01 17:12:52 -04:00
extern "C" {
pub fn rust_dbg_extern_identity_TwoU32s(v: TwoU32s) -> TwoU32s;
}
pub fn main() {
unsafe {
2020-09-01 17:12:52 -04:00
let x = TwoU32s { one: 22, two: 23 };
let y = rust_dbg_extern_identity_TwoU32s(x);
assert_eq!(x, y);
}
}