]> git.lizzy.rs Git - rust.git/blob - compiler/rustc_error_codes/src/error_codes/E0130.md
Rollup merge of #92310 - ehuss:rustdoc-ice, r=estebank
[rust.git] / compiler / rustc_error_codes / src / error_codes / E0130.md
1 A pattern was declared as an argument in a foreign function declaration.
2
3 Erroneous code example:
4
5 ```compile_fail,E0130
6 extern "C" {
7     fn foo((a, b): (u32, u32)); // error: patterns aren't allowed in foreign
8                                 //        function declarations
9 }
10 ```
11
12 To fix this error, replace the pattern argument with a regular one. Example:
13
14 ```
15 struct SomeStruct {
16     a: u32,
17     b: u32,
18 }
19
20 extern "C" {
21     fn foo(s: SomeStruct); // ok!
22 }
23 ```
24
25 Or:
26
27 ```
28 extern "C" {
29     fn foo(a: (u32, u32)); // ok!
30 }
31 ```