Ruta graveolens  ·  notes from a language experiment  ·  cultivated since 2025

E0405: Duplicate type definition

CodeCategoryStability
E0405Struct and enumPermanent

Explanation

A module defines more than one struct or enum with the same type name.

Likely cause

A type declaration was duplicated, or a struct and enum in the same module were given the same name. Rename or remove one declaration; separate modules may independently use the same type name.

Examples

Duplicate type name

struct Point { x: i32 }
enum Point { Origin }
fn main() -> i32 { 0 }

Use unique type names in one module

struct Point { x: i32 }
enum Position { Origin }
fn main() -> i32 {
    Point { x: 42 }.x
}

References