]> git.lizzy.rs Git - rust.git/blob - compiler/rustc_error_codes/src/error_codes/E0045.md
Rollup merge of #92310 - ehuss:rustdoc-ice, r=estebank
[rust.git] / compiler / rustc_error_codes / src / error_codes / E0045.md
1 Variadic parameters have been used on a non-C ABI function.
2
3 Erroneous code example:
4
5 ```compile_fail,E0045
6 #![feature(unboxed_closures)]
7
8 extern "rust-call" {
9     fn foo(x: u8, ...); // error!
10 }
11 ```
12
13 Rust only supports variadic parameters for interoperability with C code in its
14 FFI. As such, variadic parameters can only be used with functions which are
15 using the C ABI. To fix such code, put them in an extern "C" block:
16
17 ```
18 extern "C" {
19     fn foo (x: u8, ...);
20 }
21 ```