Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Foo is ambiguous" even though it's not #62768

Closed
oberien opened this issue Jul 17, 2019 · 2 comments
Closed

"Foo is ambiguous" even though it's not #62768

oberien opened this issue Jul 17, 2019 · 2 comments
Labels
A-resolve Area: Path resolution C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@oberien
Copy link
Contributor

oberien commented Jul 17, 2019

playpen

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?

@jonas-schievink jonas-schievink added A-resolve Area: Path resolution C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jul 17, 2019
@oberien oberien changed the title "Foo is abiguous" even though it's not "Foo is ambiguous" even though it's not Jul 25, 2019
@petrochenkov
Copy link
Contributor

This is more or less a duplicate of #62769, the root cause (#62769 (comment)) is the same.

@Mark-Simulacrum
Copy link
Member

I'm going to close this in favor of #62769 since the root causes and specific issues are so similar.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-resolve Area: Path resolution C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

4 participants