]> git.lizzy.rs Git - rust.git/blob - src/test/ui/unwind-abis/ffi-unwind-calls-lint.rs
dadf4b1218784bc04fd5fbe65a6a2d213954aa42
[rust.git] / src / test / ui / unwind-abis / ffi-unwind-calls-lint.rs
1 // build-pass
2 // needs-unwind
3 // ignore-wasm32-bare compiled with panic=abort by default
4
5 #![feature(c_unwind)]
6 #![warn(ffi_unwind_calls)]
7
8 mod foo {
9     #[no_mangle]
10     pub extern "C-unwind" fn foo() {}
11 }
12
13 extern "C-unwind" {
14     fn foo();
15 }
16
17 fn main() {
18     // Call to Rust function is fine.
19     foo::foo();
20     // Call to foreign function should warn.
21     unsafe { foo(); }
22     //~^ WARNING call to foreign function with FFI-unwind ABI
23     let ptr: extern "C-unwind" fn() = foo::foo;
24     // Call to function pointer should also warn.
25     ptr();
26     //~^ WARNING call to function pointer with FFI-unwind ABI
27 }