docs

v0.1.0 문서를 보고 있습니다. 이 버전은 더 이상 지원하지 않습니다. 최신 릴리스: v0.1.3 →

#E0032: 충돌하는 import

한 이름을 서로 다른 대상으로 두 번 가져왔거나, 가져오면서 모듈이나 블록 안에서 정의하기도 했습니다. 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에서 이 페이지 고치기. 마지막 수정