docs

#E0032: conflicting imports

A name is imported twice with different targets, or is both imported and defined in the module or block. Rename one with use .. as other;, or drop one of them.

nabi
use shapes::square;
fn square(x: f64) -> f64 { x * x }
mod shapes {
    pub fn square(x: f64) -> f64 { x * x }
}
error[E0032]: `square` is both imported from `shapes::square` and defined in this module
  --> main.nabi:1:5
   |
 1 | use shapes::square;
   |     ^^^^^^ imported here
 2 | fn square(x: f64) -> f64 { x * x }
   | -- defined here, which would hide the import
   |
   = help: import it under another name, `use shapes::square as shapes_square;`, or remove this `use` if the module does not need it

Import it under another name:

nabi
use shapes::square as shape_square;
fn square(x: f64) -> f64 { x * x }
mod shapes {
    pub fn square(x: f64) -> f64 { x * x }
}
println(f"{square(2.0)} {shape_square(3.0)}");
4 9

Related: E0026 name defined more than once, E0031 ambiguous name

Found a mistake? Edit this page on GitHub. Last updated