W3cubDocs

/Rust

Error code E0130

A pattern was declared as an argument in a foreign function declaration.

Erroneous code example:

#![allow(unused)]
fn main() {
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:

#![allow(unused)]
fn main() {
struct SomeStruct {
    a: u32,
    b: u32,
}

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

Or:

#![allow(unused)]
fn main() {
extern "C" {
    fn foo(a: (u32, u32)); // ok!
}
}

© 2010 The Rust Project Developers
Licensed under the Apache License, Version 2.0 or the MIT license, at your option.
https://doc.rust-lang.org/error_codes/E0130.html