Error code E0061

An invalid number of arguments was passed when calling a function.

Erroneous code example:

fn f(u: i32) {}

f(); // error!
Run

The number of arguments passed to a function must match the number of arguments specified in the function signature.

For example, a function like:

fn f(a: u16, b: &str) {}
Run

Must always be called with exactly two arguments, e.g., f(2, "test").

Note that Rust does not have a notion of optional function arguments or variadic functions (except for its C-FFI).

Back to list of error codes