#E0032: 相互冲突的导入
一个名称被导入了两次且目标不同,或者它在模块或块中既被导入又被定义。用 use .. as other; 给其中一个改名,或者去掉其中一个。
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
以另一个名称导入:
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
相关错误码:E0026 名称定义了多次,E0031 有歧义的名称
发现错误? 在 GitHub 上编辑此页 最后更新: