-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
Given the following code:
use self::A::*;
use self::B::*;
enum A {
V
}
enum B {
V
}
use V;
fn main() {}
The current output is:
Compiling playground v0.0.1 (/playground)
error[[E0659]](https://doc.rust-lang.org/nightly/error-index.html#E0659): `V` is ambiguous
--> src/main.rs:12:5
|
12 | [use V;](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021#)
| ^ ambiguous name
|
= note: ambiguous because of multiple glob imports of a name in the same module
note: `V` could refer to the variant imported here
--> src/main.rs:1:5
|
1 | [use self::A::*;](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021#)
| ^^^^^^^^^^
= help: consider adding an explicit import of `V` to disambiguate
note: `V` could also refer to the variant imported here
--> src/main.rs:2:5
|
2 | [use self::B::*;](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021#)
| ^^^^^^^^^^
= help: consider adding an explicit import of `V` to disambiguate
error[[E0659]](https://doc.rust-lang.org/nightly/error-index.html#E0659): `V` is ambiguous
--> src/main.rs:12:5
|
12 | [use V;](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021#)
| ^ ambiguous name
|
= note: ambiguous because of multiple glob imports of a name in the same module
note: `V` could refer to the unit variant imported here
--> src/main.rs:1:5
|
1 | [use self::A::*;](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021#)
| ^^^^^^^^^^
= help: consider adding an explicit import of `V` to disambiguate
note: `V` could also refer to the unit variant imported here
--> src/main.rs:2:5
|
2 | [use self::B::*;](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021#)
| ^^^^^^^^^^
= help: consider adding an explicit import of `V` to disambiguate
warning: unused import: `self::B::*`
--> src/main.rs:2:5
|
2 | [use self::B::*;](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021#)
| ^^^^^^^^^^
|
= note: `#[warn(unused_imports)]` on by default
warning: unused import: `V`
--> src/main.rs:12:5
|
12 | [use V;](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021#)
| ^
For more information about this error, try `rustc --explain E0659`.
warning: `playground` (bin "playground") generated 2 warnings
error: could not compile `playground` due to 2 previous errors; 2 warnings emitted
There are duplicated diagnostics in output, Ideally the output should look like:
error[[E0659]](https://doc.rust-lang.org/nightly/error-index.html#E0659): `V` is ambiguous
--> src/main.rs:12:5
|
12 | [use V;](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021#)
| ^ ambiguous name
|
= note: ambiguous because of multiple glob imports of a name in the same module
note: `V` could refer to the variant imported here
--> src/main.rs:1:5
|
1 | [use self::A::*;](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021#)
| ^^^^^^^^^^
= help: consider adding an explicit import of `V` to disambiguate
note: `V` could also refer to the variant imported here
--> src/main.rs:2:5
|
2 | [use self::B::*;](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021#)
| ^^^^^^^^^^
= help: consider adding an explicit import of `V` to disambiguate
warning: unused import: `self::B::*`
--> src/main.rs:2:5
|
2 | [use self::B::*;](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021#)
| ^^^^^^^^^^
|
= note: `#[warn(unused_imports)]` on by default
warning: unused import: `V`
--> src/main.rs:12:5
|
12 | [use V;](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021#)
| ^
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Type
Projects
Milestone
Relationships
Development
Select code repository
Activity
lyming2007 commentedon Dec 2, 2022
@rustbot claim
add function to tell if the current ambiguity error matches a previou…
Rollup merge of rust-lang#105769 - lyming2007:issue-105177-fix, r=eholk
Rollup merge of rust-lang#105769 - lyming2007:issue-105177-fix, r=eholk
add function to tell if the current ambiguity error matches a previou…