rust/tests/ui/abi/issue-28676.rs

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

39 lines
678 B
Rust
Raw Normal View History

//@ run-pass
#![allow(dead_code)]
#![allow(improper_ctypes)]
2015-10-14 20:25:38 +00:00
#[derive(Copy, Clone)]
2020-09-01 21:12:52 +00:00
pub struct Quad {
a: u64,
b: u64,
c: u64,
d: u64,
}
2015-10-14 20:25:38 +00:00
mod rustrt {
use super::Quad;
2016-11-24 00:09:51 +00:00
#[link(name = "rust_test_helpers", kind = "static")]
2020-09-01 21:12:52 +00:00
extern "C" {
pub fn get_c_many_params(
_: *const (),
_: *const (),
_: *const (),
_: *const (),
f: Quad,
) -> u64;
2015-10-14 20:25:38 +00:00
}
}
fn test() {
unsafe {
let null = std::ptr::null();
2020-09-01 21:12:52 +00:00
let q = Quad { a: 1, b: 2, c: 3, d: 4 };
2015-10-14 20:25:38 +00:00
assert_eq!(rustrt::get_c_many_params(null, null, null, null, q), q.c);
}
}
pub fn main() {
test();
}