about summary refs log tree commit diff
path: root/src/tools/miri/tests/native-lib/fail/struct_not_extern_c.rs
blob: cf8315e0fd9d1969749267b11f3068ad9e836ae5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// Only works on Unix targets
//@ignore-target: windows wasm
//@only-on-host

#![allow(improper_ctypes)]

pub struct PassMe {
    pub value: i32,
    pub other_value: i64,
}

extern "C" {
    fn pass_struct(s: PassMe) -> i64;
}

fn main() {
    let pass_me = PassMe { value: 42, other_value: 1337 };
    unsafe { pass_struct(pass_me) }; //~ ERROR: unsupported operation: passing a non-#[repr(C)] struct over FFI
}