error duplicate-decl
What it means#
All files of a module share one namespace (§2.1), so two top-level declarations with the same name, in the same file or in different files of the module, conflict. The same applies to two members with one name in a single data, enum or impl. (let bindings are different: they may shadow, §4.1.)
Example#
data User { id: u64 }
data User { name: str } // <- duplicate-decl
fn main() {}error
duplicate-decl
How to fix#
data User { id: u64 }
data UserProfile { name: str }
fn main() {}Rename one declaration or merge them. Declarations in different modules never conflict.