Closed
Description
Given the following code:
mod foo {
pub enum Foo {
Foo(i32),
}
}
use foo::*;
use Foo::*;
The compiler claims, that the Foo
in use Foo::*
could either mean the type foo::Foo
imported by use foo::*
, or the variant (value) Foo::Foo
imported by use Foo::*
:
error[E0659]: `Foo` is ambiguous (glob import vs glob import in the same module)
--> src/lib.rs:7:5
|
7 | use Foo::*;
| ^^^ ambiguous name
|
note: `Foo` could refer to the enum imported here
--> src/lib.rs:6:5
|
6 | use foo::*;
| ^^^^^^
= help: consider adding an explicit import of `Foo` to disambiguate
note: `Foo` could also refer to the variant imported here
--> src/lib.rs:7:5
|
7 | use Foo::*;
| ^^^^^^
= help: consider adding an explicit import of `Foo` to disambiguate
How can a name refer to something that's not imported yet?