about summary refs log tree commit diff
path: root/src/tools/miri/tests/fail/function_calls/check_callback_abi.rs
blob: 177e38105e6fa52877c8a26007c0f7a86dbe74b5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#![feature(core_intrinsics)]

extern "C" fn try_fn(_: *mut u8) {
    unreachable!();
}

fn main() {
    unsafe {
        // Make sure we check the ABI when Miri itself invokes a function
        // as part of a shim implementation.
        std::intrinsics::catch_unwind(
            //~^ ERROR: calling a function with calling convention "C" using calling convention "Rust"
            std::mem::transmute::<extern "C" fn(*mut u8), _>(try_fn),
            std::ptr::null_mut(),
            |_, _| unreachable!(),
        );
    }
}