Skip to main content

E0012: Type Already Defined

You tried to define a type with a name that's already in use.

Example

struct Point {
x: i64,
y: i64,
}

struct Point { // Error: type `Point` is already defined in this module
a: i64,
b: i64,
}

How to fix

Use a different name for the second type:

struct Point {
x: i64,
y: i64,
}

struct Point2D {
a: i64,
b: i64,
}