2021-05-30 22:05:04 -05:00
|
|
|
// revisions: no_cache cache fn_ptr
|
2021-04-15 16:19:23 -05:00
|
|
|
|
|
|
|
#[no_mangle]
|
|
|
|
fn foo() {}
|
|
|
|
|
|
|
|
fn main() {
|
2021-05-30 22:05:04 -05:00
|
|
|
#[cfg(any(cache, fn_ptr))]
|
|
|
|
extern "Rust" {
|
|
|
|
fn foo();
|
|
|
|
}
|
|
|
|
|
|
|
|
#[cfg(fn_ptr)]
|
|
|
|
unsafe { std::mem::transmute::<unsafe fn(), unsafe extern "C" fn()>(foo)() }
|
2021-12-01 20:37:06 -06:00
|
|
|
//[fn_ptr]~^ ERROR calling a function with calling convention Rust using calling convention C
|
2021-05-30 22:05:04 -05:00
|
|
|
|
|
|
|
// `Instance` caching should not suppress ABI check.
|
2021-04-15 16:19:23 -05:00
|
|
|
#[cfg(cache)]
|
2021-05-30 22:05:04 -05:00
|
|
|
unsafe { foo() }
|
|
|
|
|
2021-04-15 16:19:23 -05:00
|
|
|
{
|
2021-05-30 22:05:04 -05:00
|
|
|
#[cfg_attr(any(cache, fn_ptr), allow(clashing_extern_declarations))]
|
|
|
|
extern "C" {
|
2021-04-15 16:19:23 -05:00
|
|
|
fn foo();
|
|
|
|
}
|
|
|
|
unsafe { foo() }
|
2021-12-01 20:37:06 -06:00
|
|
|
//[no_cache]~^ ERROR calling a function with calling convention Rust using calling convention C
|
|
|
|
//[cache]~^^ ERROR calling a function with calling convention Rust using calling convention C
|
2021-04-15 16:19:23 -05:00
|
|
|
}
|
|
|
|
}
|