Skip to main content

E0013: Function Already Defined

You tried to define a function with the same name as an existing function in the same module.

Example

fn add(a: i64, b: i64) -> i64 {
a + b
}

fn add(x: i64) -> i64 { // Error: function `add` is already defined
x
}

How to fix

Use a unique name for each function:

fn add(a: i64, b: i64) -> i64 {
a + b
}

fn increment(x: i64) -> i64 {
x + 1
}

Note: Starstream does not support function overloading. Each function must have a unique name.