summaryrefslogtreecommitdiffstats
path: root/compiler/rustc_error_codes/src/error_codes/E0130.md
blob: 2cd27b5ec0523b7752fd4437695ccb7de34a76a5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
A pattern was declared as an argument in a foreign function declaration.

Erroneous code example:

```compile_fail,E0130
extern "C" {
    fn foo((a, b): (u32, u32)); // error: patterns aren't allowed in foreign
                                //        function declarations
}
```

To fix this error, replace the pattern argument with a regular one. Example:

```
struct SomeStruct {
    a: u32,
    b: u32,
}

extern "C" {
    fn foo(s: SomeStruct); // ok!
}
```

Or:

```
extern "C" {
    fn foo(a: (u32, u32)); // ok!
}
```