本頁尚未翻譯,以下為英文原文。
#E0031: ambiguous name
Several glob imports (use a::*;) or packages provide this name, so it is unclear which one is meant. Import the one you want by name, or write its path.
nabi
use a::*;
use b::*;
mod a { pub fn item() -> i32 { 1 } }
mod b { pub fn item() -> i32 { 2 } }
println(f"{item()}");
error[E0031]: name `item` is ambiguous in module `<root>` - multiple glob imports resolve it: a::item, b::item --> main.nabi:6:12 | 6 | println(f"{item()}"); | ^^^^^^
Import the one you mean by name:
nabi
use a::item;
mod a { pub fn item() -> i32 { 1 } }
mod b { pub fn item() -> i32 { 2 } }
println(f"{item()}");
1
Related: E0032 conflicting imports, E0087 ambiguous associated item
Found a mistake? Edit this page on GitHub. Last updated