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