rust/tests/fail/function_calls/check_callback_abi.rs

19 lines
498 B
Rust
Raw Normal View History

2021-05-29 12:36:06 -05:00
#![feature(core_intrinsics)]
extern "C" fn try_fn(_: *mut u8) {
unreachable!();
}
fn main() {
unsafe {
2021-05-30 22:05:04 -05:00
// Make sure we check the ABI when Miri itself invokes a function
// as part of a shim implementation.
std::intrinsics::r#try(
//~^ ERROR: calling a function with ABI C using caller ABI Rust
2021-05-29 12:36:06 -05:00
std::mem::transmute::<extern "C" fn(*mut u8), _>(try_fn),
std::ptr::null_mut(),
|_, _| unreachable!(),
);
}
}